请教关于树莓派csi摄像头的问题

撒旦撒旦 2024-05-01182 次点击
我使用命令 libcamera-jpeg -o test.jpg 可以成功拍照
但是换了 ffmpeg -i /dev/video0 -frames:v 1 -f image2 output.jpg 却报错
报错信息如下:
pi@raspberrypi:~$ ffmpeg -i /dev/video0 -frames:v 1 -f image2 output.jpg
ffmpeg version 5.1.4-0+rpt3+deb12u1 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 12 (Raspbian 12.2.0-14+rpi1)
configuration: --prefix=/usr --extra-version=0+rpt3+deb12u1 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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 --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 --libdir=/usr/lib/arm-linux-gnueabihf --cpu=arm1176jzf-s --arch=arm
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
[video4linux2,v4l2 @ 0x1c8c040] ioctl(VIDIOC_G_PARM): Inappropriate ioctl for device
[video4linux2,v4l2 @ 0x1c8c040] Time per frame unknown
[video4linux2,v4l2 @ 0x1c8c040] ioctl(VIDIOC_STREAMON): Invalid argument
/dev/video0: Invalid argument

我确认video0就是摄像头设备
请问这是什么毛病呢?
收藏 ♥ 感谢
Spoony 小组长 2024-05-01 
ffmpeg -i /dev/video0 -frames:v 1 -f image2 output.jpg

ffmpeg 命令的参数可能不支持,或者没有配置摄像头相关的内核驱动导致 ffmpeg 不支持 /dev/video0 操作

驱动配置相关教程仅供参考:https://shumeipai.nxez.com/2023/05/14/camera-module-v3-configuration-and-libcamera-usage.html

登录注册 后可回复。