Opened 21 months ago
Last modified 21 months ago
#10252 new defect
v4l2 fails on AMD Geode
Reported by: | cherniaev.andrei | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | ffmpeg |
Version: | git-master | Keywords: | avcodec |
Cc: | cherniaev.andrei | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description (last modified by )
I try get photo from my webcam. But ffmpeg process was killed by Linux because of two reasons.
How to reproduce:
ffmpeg -v 9 -loglevel 99 -f video4linux2 -i /dev/video0 -vframes 1 -video_size 640x480 test.jpeg
I use Ubuntu 22 with kernel 5.19.0-35-generic on my x86-64 PC. My webcam works good.
I use Buildroot with kernel 5.4.228 on my AMD Geode. (I also try 4.19.269 and 6.2.2) My webcam (ffmpeg) fails becasue of:
Reason 1) Look at libavdevice/v4l2.c Why 256 buffers in
static const int desired_video_buffers = 256;
?
My Geode can't work with 256 buffers. I don't know why. But i try to set
static const int desired_video_buffers = 2;
And no more fails because of reason 1)
Reason 2) Looks at libavcodec/raw.c
What happend in avcodec_pix_fmt_to_codec_tag() ?
while (tags->pix_fmt >= 0) { ... tags++; }
Looks like this functions should use while like in find_pix_fmt()
while (tags->pix_fmt != AV_PIX_FMT_NONE) { ... tags++; }
Isn't it?
In my case ffmpeg fails in avcodec_pix_fmt_to_codec_tag(). To solve Reason 2) I make:
unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat fmt) { return 0; //rude decision }
After I fix reason 1) and reason 2) my ffmpeg allow me to get photo using AMD Geode.
This is information about ffmpeg (without any patch) on my AMD Geode. ffmpeg 6.0 has the same code. Buildroot with Linux Kernel is 5.4.228
# ffmpeg -v 9 -loglevel 99 -f video4linux2 -i /dev/video0 -vframes 1 -video_size 640x480 test.jpeg
ffmpeg version 5.1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 12.2.0 (Buildroot -gaff43177-dirty)
configuration: --enable-cross-compile --cross-prefix=/home/a/LINUX_TARGET/Buildroot_repo/buildroot/output/host/bin/i586-buildroot-linux-gnu- --sysroot=/home/a/LINUX_TARGET/Buildroot_repo/buildroot/output/host/i586-buildroot-linux-gnu/sysroot --host-cc=/usr/bin/gcc --arch=i586 --target-os=linux --disable-stripping --pkg-config=/home/a/LINUX_TARGET/Buildroot_repo/buildroot/output/host/bin/pkg-config --disable-static --enable-shared --prefix=/usr --enable-avfilter --disable-version3 --enable-logging --disable-optimizations --disable-extra-warnings --enable-avdevice --enable-avcodec --enable-avformat --disable-network --disable-gray --enable-swscale-alpha --disable-small --enable-dct --enable-fft --enable-mdct --enable-rdft --disable-crystalhd --disable-dxva2 --enable-runtime-cpudetect --disable-hardcoded-tables --disable-mipsdsp --disable-mipsdspr2 --disable-msa --enable-hwaccels --disable-cuda --disable-cuvid --disable-nvenc --disable-avisynth --disable-frei0r --disable-libopencore-amrnb --disable-libopencore-amrwb --disable-libdc1394 --disable-libgsm --disable-libilbc --disable-libvo-amrwbenc --disable-symver --disable-doc --enable-gpl --enable-nonfree --enable-ffmpeg --disable-ffplay --enable-libv4l2 --disable-ffprobe --disable-libxcb --enable-postproc --enable-swscale --enable-indevs --disable-alsa --disable-outdevs --enable-pthreads --enable-zlib --enable-bzlib --disable-libfdk-aac --disable-libcdio --enable-gnutls --disable-openssl --disable-libdrm --disable-libopenh264 --disable-vaapi --disable-vdpau --disable-mmal --disable-omx --disable-omx-rpi --disable-libopencv --disable-libopus --disable-libvpx --disable-libass --disable-libbluray --disable-libmfx --disable-librtmp --disable-libmp3lame --disable-libmodplug --disable-libspeex --disable-libtheora --disable-iconv --disable-libfreetype --disable-fontconfig --disable-libopenjpeg --disable-libx264 --disable-libx265 --disable-libdav1d --disable-x86asm --enable-mmx --disable-sse --disable-sse2 --disable-sse3 --disable-ssse3 --disable-sse4 --disable-sse42 --disable-avx --disable-avx2 --disable-armv6 --disable-armv6t2 --disable-vfp --disable-neon --disable-altivec --extra-libs=-latomic --enable-pic --cpu=geode
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
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'video4linux2'.
Reading option '-i' ... matched as input url with argument '/dev/video0'.
Reading option '-vframes' ... matched as option 'vframes' (set the number of video frames to output) with argument '1'.
Reading option '-video_size' ... matched as AVOption 'video_size' with argument '640x480'.
Reading option 'test.jpeg' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input url /dev/video0.
Applying option f (force format) with argument video4linux2.
Successfully parsed a group of options.
Opening an input file: /dev/video0.
[video4linux2,v4l2 @ 0x197b2c0] fd:3 capabilities:84a00001
[video4linux2,v4l2 @ 0x197b2c0] Current input_channel: 0, input_name: Camera 1, input_std: 0
[video4linux2,v4l2 @ 0x197b2c0] Querying the device for the current frame size
[video4linux2,v4l2 @ 0x197b2c0] Setting frame size to 3840x2160
[video4linux2,v4l2 @ 0x197b2c0] The V4L2 driver changed the pixel format from 0x32315559 to 0x47504A4D
[video4linux2,v4l2 @ 0x197b2c0] Trying to set codec:rawvideo pix_fmt:yuv420p
[video4linux2,v4l2 @ 0x197b2c0] The V4L2 driver changed the pixel format from 0x32315559 to 0x47504A4D
[video4linux2,v4l2 @ 0x197b2c0] Trying to set codec:rawvideo pix_fmt:yuv420p
[video4linux2,v4l2 @ 0x197b2c0] The V4L2 driver changed the pixel format from 0x32315659 to 0x47504A4D
[video4linux2,v4l2 @ 0x197b2c0] Trying to set codec:rawvideo pix_fmt:yuv422p
[video4linux2,v4l2 @ 0x197b2c0] The V4L2 driver changed the pixel format from 0x50323234 to 0x47504A4D
[video4linux2,v4l2 @ 0x197b2c0] Trying to set codec:rawvideo pix_fmt:yuyv422
Killed
This is information about ffmpeg on my PC (ffmpeg works without any patch)
a@PC:~$ ffmpeg --version
ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --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-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --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-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Webcam is ELP-USB4K02AF-KL100W http://www.elpcctv.com/elp-128-sony-imx415-sensor-night-vision-4k-usb-camera-with-white-led-p-169.html
Change History (2)
comment:1 by , 21 months ago
Description: | modified (diff) |
---|
comment:2 by , 21 months ago
Description: | modified (diff) |
---|