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:




  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

  • Maybe it's a permissions issue? Try to add sudo before the rest of that command.
    – user96931
    Dec 18, 2019 at 16:53
  • I have tried added sudo to the command but its still the same.
    – Prashant
    Dec 18, 2019 at 16:56
  • Maybe this'll be of help: en.wikipedia.org/wiki/Ioctl
    – user96931
    Dec 18, 2019 at 17:23
  • The RP is being significantly overtaxed and is causing the problem
    – crasic
    Dec 19, 2019 at 3:44

1 Answer 1


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.

  • 1
    I think your answer is actually close to an answer, this is a generic error that can occurs when a resource that is busy is accessed again, especially since it starts and then crashes, it is unlikely a permission issue. As you describe the framerate and resolution require a significant amount of computational power and IO bandwidth, so either reducing the framerate or resolution, or both will help.
    – crasic
    Dec 19, 2019 at 3:42
  • Hi Paul, thanks for the reply. I changed the video size to 426x240 and lowered the fps to 10 and the camera did run continuously for about 10 minutes to about 6084 frames before crashing again. Ideally, I would like to run it for a much longer duration but I think the high video size and the large fps were the issues in the first place.
    – Prashant
    Dec 19, 2019 at 13:40
  • You could try tweaking a few settings in /boot/config.txt. People claim improved stability using over_voltage=2 and force_turbo=1. The first bumps the core voltage to 1.4V (from 1.35V) and the second keeps the CPU frequency at maximum rather than varying with load. It's suspected varying CPU freq causes instability. Have a look at raspberrypi.org/documentation/configuration/config-txt/… for other options.
    – Paul
    Dec 20, 2019 at 0:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.