3

I am trying to stream live on Youtube using a Raspberry Pi Zero W and a raspicam. I have installed ffmpeg using the instructions in this link. I am trying to start the streaming on Youtube using the following command:

ffmpeg -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f v4l2 -codec:v h264 -framerate 30 -video_size 1920x1080 -i /dev/video0 -codec:v copy -f flv rtmp://a.rtmp.youtube.com/live2/stream_key

However, whenever I am running the program I always get the following error:

[video4linux2,v4l2 @ 0x2496530] ioctl(VIDIOC_STREAMON): Operation not permitted /dev/video0: Operation not permitted

I have tried the following steps to sort this issue-

  1. Adding to the video group with

usermod -aG video my_username

then logging out and logging in again.

  1. Adding the following /etc/modules-load.d/modules.conf file:

snd-bcm2835

i2c-dev

bcm2835-v42l2

  1. gpu_mem=128 is already set in the /boot/config.txt file

Nothing seems to set the issue and I still get the same error. The camera starts initially for a few seconds and then closes and shows the error message. I have attached the screenshot of the error message. Please suggest what else can I try to sort this issue. Thanks a lot for your time in advance.

enter image description here

Prashant
  • 73
  • 5

1 Answers1

3

My rep is too low to comment.

Have you tried lowering the video size, say starting at 320x240? I've streamed video from a Zero W before but never at the resolution you're using. That video size could require up to 15MB/s, see RaspiCam documentation.

Even at modest bitrates I've had the camera lock up and/or the Pi crashes and needs power cycling. I suspect from bits and pieces I've read that the wifi chip doesn't handle high loads very well, or at least it didn't. Have a look at this thread Zero W lockups for some suggestions if that's the case.

For 1080p and 30fps you're asking quite a lot from a single core device.

Paul
  • 171
  • 7