2

I've run into some problems using the native bcm2835_v4l2 module on my Raspberry Pi Zero W (running Raspbian Stretch). The module is loaded and the associated video device is visible:

$ v4l2-ctl --list-devices
mmal service 16.1 (platform:bcm2835-v4l2):
    /dev/video0

$ ffmpeg -f v4l2 -list_formats all -i /dev/video0
[...displays all the expected formats...]

But when I try to capture from this device, I am getting an error message:

$ ffmpeg  -f v4l2 -input_format h264 -framerate 30 -video_size 1024x768 -i /dev/video0 -c copy -t 10 video.mp4
[video4linux2,v4l2 @ 0x1053250] ioctl(VIDIOC_STREAMON): Operation not permitted
/dev/video0: Operation not permitted

Despite the error message, this doesn't appear to be a permissions issue. I see the same behavior if I run the ffmpeg command as root.

There are a number of web pages out there that appear to be running substantially the same command with the error (and remarkably few results when I search for the error message). What could be going on here?

larsks
  • 685
  • 1
  • 6
  • 19

2 Answers2

3

This appears to be code for "you haven't assigned enough memory to the GPU".

Using the raspivid command in this situation resulted in:

mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn't be enabled
mmal: main: Failed to create camera component
mmal: Only 64M of gpu_mem is configured. Try running "sudo raspi-config" and ensure that "memory_split" has a value of 128 or greater

Adding...

gpu_mem=128

...to /boot/config.txt and rebooting has resolved the problem, and ffmpeg now works as expected.

larsks
  • 685
  • 1
  • 6
  • 19
1

As an Update, it looks like this needs 256MB now (got the hint from github)

cvo
  • 11
  • 1