Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5004

Camera board • Not enough buffers for FFMPEG

$
0
0
Hello everyone !

I am trying to use the new camera stack to generate an MP4 flux usable for the MediaSource API in the Web. The issue I currently have is I can't achieve to use Video4Linux2 with FFMPEG and the libcamera-apps.

My hardware is an official Raspberry Pi Camera 3 bought at Mouser Electronics, as well as a standard Raspberry Pi 4 Model B with a touchscreen display from element14 (but this does not matter as I have tried to unplug the screen and I get the same error). The hardware I am using is completely fine as I can use libcamera-jpeg or any of the other commands properly, here is the result of the command "libcamera-jpeg -o output.jpeg"

Code:

[0:00:49.172651729] [1906] ERROR IPAModule ipa_module.cpp:172 Symbol ipaModuleInfo not found[0:00:49.172726970] [1906] ERROR IPAModule ipa_module.cpp:292 v4l2-compat.so: IPA module has no valid info[0:00:49.172839358] [1906]  INFO Camera camera_manager.cpp:284 libcamera v0.2.0+46-075b54d5[0:00:49.306727618] [1911]  WARN RPiSdn sdn.cpp:39 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise[0:00:49.309011099] [1911]  INFO RPI vc4.cpp:447 Registered camera /base/soc/i2c0mux/i2c@1/imx708@1a to Unicam device /dev/media4 and ISP device /dev/media2[0:00:49.309302581] [1911]  INFO RPI pipeline_base.cpp:1144 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml'Preview window unavailableMode selection for 2304:1296:12:P    SRGGB10_CSI2P,1536x864/0 - Score: 3400    SRGGB10_CSI2P,2304x1296/0 - Score: 1000    SRGGB10_CSI2P,4608x2592/0 - Score: 1900Stream configuration adjusted[0:00:49.311640470] [1906]  INFO Camera camera.cpp:1183 configuring streams: (0) 2304x1296-YUV420 (1) 2304x1296-SBGGR10_CSI2P[0:00:49.312066914] [1911]  INFO RPI vc4.cpp:611 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 2304x1296-SBGGR10_1X10 - Selected unicam format: 2304x1296-pBAA#0 (0.00 fps) exp 32680.00 ag 3.82 dg 1.06...#142 (30.01 fps) exp 32680.00 ag 4.20 dg 1.01Mode selection for 4608:2592:12:P    SRGGB10_CSI2P,1536x864/0 - Score: 10600    SRGGB10_CSI2P,2304x1296/0 - Score: 8200    SRGGB10_CSI2P,4608x2592/0 - Score: 1000[0:00:54.521840633] [1906]  INFO Camera camera.cpp:1183 configuring streams: (0) 4608x2592-YUV420 (1) 4608x2592-SBGGR10_CSI2P[0:00:54.530237578] [1911]  INFO RPI vc4.cpp:611 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 4608x2592-SBGGR10_1X10 - Selected unicam format: 4608x2592-pBAAStill capture image received
Due to my requirements of generating MP4 with certain flags and a certain structure, I have to use FFMPEG (or I believe I can't use libcamera-vid directly to output the exact format I need but this would also work for me).

As the issue happened with my mp4 ffmpeg command, I decided to switch to an easier command to test the behavior of FFMPEG on a simple issue and I decided to generate a simple frame using jpeg in the same way as libcamera-jpeg does. After adding the v4l2 compatibility layer, my command looks like "libcamerify ffmpeg -f video4linux2 -i /dev/video0 -vframes 2 -video_size 640x480 test%3d.jpeg" and I get the following output

Code:

ffmpeg version 5.1.4-0+rpt3+deb12u1 Copyright (c) 2000-2023 the FFmpeg developers  built with gcc 12 (Debian 12.2.0-14)  configuration: --prefix=/usr --extra-version=0+rpt3+deb12u1 --toolchain=hardened --incdir=/usr/include/aarch64-linux-gnu --enable-gpl --disable-stripping --disable-mmal --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sand --enable-sdl2 --disable-sndio --enable-libjxl --enable-neon --enable-v4l2-request --enable-libudev --enable-epoxy --libdir=/usr/lib/aarch64-linux-gnu --arch=arm64 --enable-pocketsphinx --enable-librsvg --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared  libavutil      57. 28.100 / 57. 28.100  libavcodec     59. 37.100 / 59. 37.100  libavformat    59. 27.100 / 59. 27.100  libavdevice    59.  7.100 / 59.  7.100  libavfilter     8. 44.100 /  8. 44.100  libswscale      6.  7.100 /  6.  7.100  libswresample   4.  7.100 /  4.  7.100  libpostproc    56.  6.100 / 56.  6.100[0:18:05.751632805] [2038] ERROR IPAModule ipa_module.cpp:172 Symbol ipaModuleInfo not found[0:18:05.751746875] [2038] ERROR IPAModule ipa_module.cpp:292 v4l2-compat.so: IPA module has no valid info[0:18:05.751838723] [2038]  INFO Camera camera_manager.cpp:284 libcamera v0.2.0+46-075b54d5[0:18:05.877426688] [2041]  WARN RPiSdn sdn.cpp:39 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise[0:18:05.879716143] [2041]  INFO RPI vc4.cpp:447 Registered camera /base/soc/i2c0mux/i2c@1/imx708@1a to Unicam device /dev/media4 and ISP device /dev/media2[0:18:05.880850288] [2038]  INFO Camera camera.cpp:1183 configuring streams: (0) 800x600-YUV420[0:18:05.881309217] [2041]  INFO RPI vc4.cpp:611 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 1536x864-SBGGR10_1X10 - Selected unicam format: 1536x864-pBAA[video4linux2,v4l2 @ 0x55c0b19d00] ioctl(VIDIOC_G_PARM): Inappropriate ioctl for device[video4linux2,v4l2 @ 0x55c0b19d00] Time per frame unknown[0:18:05.882669076] [2038]  INFO Camera camera.cpp:1183 configuring streams: (0) 800x600-YUV420[0:18:05.882977472] [2041]  INFO RPI vc4.cpp:611 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 1536x864-SBGGR10_1X10 - Selected unicam format: 1536x864-pBAA[0:18:05.896757669] [2041] ERROR V4L2 v4l2_videodevice.cpp:1248 /dev/video14[17:cap]: Not enough buffers provided by V4L2VideoDevice[video4linux2,v4l2 @ 0x55c0b19d00] ioctl(VIDIOC_REQBUFS): Cannot allocate memory/dev/video0: Cannot allocate memory
In this log, I have noticed three errors (that I believe could be the sources), the first one is about the IPA module but it didn't stress me that much as the error also happens with libcamera-jpeg. Then there are the two ioctl issues, but I believe the second one is the most critical as the first one does not halt ffmpeg.

I know that this error is really similar to this error viewtopic.php?t=355800 but I don't believe FFMPEG would try and request more than 32 buffers from video4linux2 as this is the default limit for the linux kernel so I haven't tried yet to recompile the kernel.

I have also noticed that my FFMPEG version is a bit old but I don't believe it would be a problem as the version isn't that old and I expect that Video4Linux2 was supported since a long time, but I might try to upgrade it by compiling from source as it is the latest version I can install using apt.

Is there anything I am doing wrong with FFMPEG or the camera stack ? If so, what might I do to fix it ?

Thanks for anyone taking time to read this !

*Sidenote : I am running the Bookworm OS with a fresh installation from less than 2 weeks ago and my version of libcamera should be the latest, as well as all the software on my machine.

Statistics: Posted by thimote75 — Wed Mar 13, 2024 6:51 pm — Replies 0 — Views 32



Viewing all articles
Browse latest Browse all 5004

Trending Articles