Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#4030 closed defect (fixed)

V4L2 recording results in invalid data & buffer still owned errors

Reported by: thender Owned by: holden
Priority: normal Component: avdevice
Version: git-master Keywords: v4l2
Cc: mywing81@gmail.com, jonathan.drolet@polymtl.ca Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: yes

Description

Summary of the bug:

If I try to record from a magewell USB3 V4L2 capture device, it works the first time. However, the 2nd time I try to record from it, I will receive this error. Occasionally capture will die in the middle of a recording with this same error.

How to reproduce:

Run this with a USB3 magewell v4l2 dongle.

ffmpeg -f v4l2 -framerate 60 -s 1920x1080 -i /dev/video1 -f alsa -i
pulse -c:v libx264 -crf 0 -preset ultrafast -c:a pcm_s16le outfile3.mkv

Stop the recording, then run it again. It won't work.

To confirm the issue is isolated to ffmpeg, try using cvlc and it will work. You can use this command as many times as you please and it will always record just fine, and never freeze in the middle of a recording.

cvlc v4l2:// :v4l2-dev=/dev/video1 :v4l2-width=1920 :v4l2-height=1080 --input-slave pulse:// --sout "#transcode{vcodec=HFYU,scale=1}:standard{access=file,dst=camcorder.avi}"

The problem is that CVLC does not allow me to set an input framerate, which is functionality I need, so that I do not stress the CPU too much recording at 60 FPS.

ffmpeg version 2.27
built on ... Gentoo Linux

Change History (38)

comment:1 Changed 5 years ago by cehoyos

  • Component changed from undetermined to avdevice
  • Keywords buffer removed

Please test current FFmpeg git head and please provide the command line together with the complete, uncut console output to make this a valid ticket. If the issue is reproducible without audio input please remove it.

comment:2 Changed 5 years ago by thender

So I compiled the latest ffmpeg from git repository, and turned off the sound recording via alsa/pulse, and here is what I get. As you can see I have to run the command several times before it works, it is totally random whether I will get a recording or an error. This is better than before, usually I have to run it 20-40 times before it works. Usually this isn't an issue but since I am using parallel to record two devices at once it means I have to be lucky enough to not get this error on two separate capture devices, so it takes 100+ tries to get it working.

$ ffmpeg -f v4l2 -framerate 30 -s 1920x1080 -i /dev/video1 -c:v libx264 -preset ultrafast -qp 20 ffmpegtest.mkv
ffmpeg version N-66880-ga92192d Copyright (c) 2000-2014 the FFmpeg developers

built on Oct 15 2014 13:52:31 with gcc 4.8.3 (Gentoo 4.8.3 p1.1, pie-0.5.9)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-gpl --enable-postproc --enable-avfilter --enable-avresample --enable-version3 --enable-indev=v4l2 --enable-outdev=v4l2 --enable-bzlib --enable-hardcoded-tables --enable-iconv --enable-network --enable-ffplay --enable-vaapi --enable-zlib --enable-libvo-aacenc --enable-libmp3lame --enable-libfaac --enable-libtheora --enable-libwavpack --enable-libx264 --enable-libxvid --enable-opengl --enable-libv4l2 --enable-libpulse --enable-x11grab --enable-frei0r --enable-libfreetype --enable-libopus --enable-libspeex --enable-libvorbis --enable-avx --enable-avx2 --enable-fma3 --enable-fma4 --enable-mmxext --enable-sse3 --enable-ssse3 --enable-sse4 --enable-sse42 --enable-nonfree
libavutil 54. 10.100 / 54. 10.100
libavcodec 56. 7.100 / 56. 7.100
libavformat 56. 9.100 / 56. 9.100
libavdevice 56. 1.100 / 56. 1.100
libavfilter 5. 1.106 / 5. 1.106
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100

[video4linux2,v4l2 @ 0x1584f80] The v4l2 frame is 0 bytes, but 4147200 bytes are expected
Input #0, video4linux2,v4l2, from '/dev/video1':

Duration: N/A, bitrate: 995328 kb/s

Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 995328 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc

No pixel format specified, yuv422p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x15876a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
[libx264 @ 0x15876a0] profile High 4:2:2, level 4.0, 4:2:2 8-bit
[libx264 @ 0x15876a0] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=20 ip_ratio=1.40 aq=0
Output #0, matroska, to 'ffmpegtest.mkv':

Metadata:

encoder : Lavf56.9.100
Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv422p, 1920x1080, q=-1--1, 30 fps, 1k tbn, 30 tbc
Metadata:

encoder : Lavc56.7.100 libx264

Stream mapping:

Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))

Press [q] to stop, ? for help
[video4linux2,v4l2 @ 0x1584f80] The v4l2 frame is 0 bytes, but 4147200 bytes are expected
/dev/video1: Invalid data found when processing input
frame= 0 fps=0.0 q=0.0 Lsize= 1kB time=00:00:00.00 bitrate=N/A
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
louis@portablebauer ~/Videos/testing $ rm *mkv && ffmpeg -f v4l2 -framerate 30 -s 1920x1080 -i /dev/video1 -c:v libx264 -preset ultrafast -qp 20 ffmpegtest.mkv
ffmpeg version N-66880-ga92192d Copyright (c) 2000-2014 the FFmpeg developers

built on Oct 15 2014 13:52:31 with gcc 4.8.3 (Gentoo 4.8.3 p1.1, pie-0.5.9)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-gpl --enable-postproc --enable-avfilter --enable-avresample --enable-version3 --enable-indev=v4l2 --enable-outdev=v4l2 --enable-bzlib --enable-hardcoded-tables --enable-iconv --enable-network --enable-ffplay --enable-vaapi --enable-zlib --enable-libvo-aacenc --enable-libmp3lame --enable-libfaac --enable-libtheora --enable-libwavpack --enable-libx264 --enable-libxvid --enable-opengl --enable-libv4l2 --enable-libpulse --enable-x11grab --enable-frei0r --enable-libfreetype --enable-libopus --enable-libspeex --enable-libvorbis --enable-avx --enable-avx2 --enable-fma3 --enable-fma4 --enable-mmxext --enable-sse3 --enable-ssse3 --enable-sse4 --enable-sse42 --enable-nonfree
libavutil 54. 10.100 / 54. 10.100
libavcodec 56. 7.100 / 56. 7.100
libavformat 56. 9.100 / 56. 9.100
libavdevice 56. 1.100 / 56. 1.100
libavfilter 5. 1.106 / 5. 1.106
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100

[video4linux2,v4l2 @ 0xcacf80] The v4l2 frame is 0 bytes, but 4147200 bytes are expected
Input #0, video4linux2,v4l2, from '/dev/video1':

Duration: N/A, bitrate: 995328 kb/s

Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 995328 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc

No pixel format specified, yuv422p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0xcaf6a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
[libx264 @ 0xcaf6a0] profile High 4:2:2, level 4.0, 4:2:2 8-bit
[libx264 @ 0xcaf6a0] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=20 ip_ratio=1.40 aq=0
Output #0, matroska, to 'ffmpegtest.mkv':

Metadata:

encoder : Lavf56.9.100
Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv422p, 1920x1080, q=-1--1, 30 fps, 1k tbn, 30 tbc
Metadata:

encoder : Lavc56.7.100 libx264

Stream mapping:

Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))

Press [q] to stop, ? for help
[video4linux2,v4l2 @ 0xcacf80] The v4l2 frame is 0 bytes, but 4147200 bytes are expected
/dev/video1: Invalid data found when processing input
frame= 0 fps=0.0 q=0.0 Lsize= 1kB time=00:00:00.00 bitrate=N/A
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
louis@portablebauer ~/Videos/testing $ rm *mkv && ffmpeg -f v4l2 -framerate 30 -s 1920x1080 -i /dev/video1 -c:v libx264 -preset ultrafast -qp 20 ffmpegtest.mkv
ffmpeg version N-66880-ga92192d Copyright (c) 2000-2014 the FFmpeg developers

built on Oct 15 2014 13:52:31 with gcc 4.8.3 (Gentoo 4.8.3 p1.1, pie-0.5.9)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-gpl --enable-postproc --enable-avfilter --enable-avresample --enable-version3 --enable-indev=v4l2 --enable-outdev=v4l2 --enable-bzlib --enable-hardcoded-tables --enable-iconv --enable-network --enable-ffplay --enable-vaapi --enable-zlib --enable-libvo-aacenc --enable-libmp3lame --enable-libfaac --enable-libtheora --enable-libwavpack --enable-libx264 --enable-libxvid --enable-opengl --enable-libv4l2 --enable-libpulse --enable-x11grab --enable-frei0r --enable-libfreetype --enable-libopus --enable-libspeex --enable-libvorbis --enable-avx --enable-avx2 --enable-fma3 --enable-fma4 --enable-mmxext --enable-sse3 --enable-ssse3 --enable-sse4 --enable-sse42 --enable-nonfree
libavutil 54. 10.100 / 54. 10.100
libavcodec 56. 7.100 / 56. 7.100
libavformat 56. 9.100 / 56. 9.100
libavdevice 56. 1.100 / 56. 1.100
libavfilter 5. 1.106 / 5. 1.106
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100

[video4linux2,v4l2 @ 0x14f4f80] The v4l2 frame is 0 bytes, but 4147200 bytes are expected
Input #0, video4linux2,v4l2, from '/dev/video1':

Duration: N/A, bitrate: 995328 kb/s

Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 995328 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc

No pixel format specified, yuv422p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x14f76a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
[libx264 @ 0x14f76a0] profile High 4:2:2, level 4.0, 4:2:2 8-bit
[libx264 @ 0x14f76a0] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=20 ip_ratio=1.40 aq=0
Output #0, matroska, to 'ffmpegtest.mkv':

Metadata:

encoder : Lavf56.9.100
Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv422p, 1920x1080, q=-1--1, 30 fps, 1k tbn, 30 tbc
Metadata:

encoder : Lavc56.7.100 libx264

Stream mapping:

Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))

Press [q] to stop, ? for help
[video4linux2,v4l2 @ 0x14f4f80] The v4l2 frame is 0 bytes, but 4147200 bytes are expected
/dev/video1: Invalid data found when processing input
frame= 0 fps=0.0 q=0.0 Lsize= 1kB time=00:00:00.00 bitrate=N/A
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
louis@portablebauer ~/Videos/testing $ rm *mkv && ffmpeg -f v4l2 -framerate 30 -s 1920x1080 -i /dev/video1 -c:v libx264 -preset ultrafast -qp 20 ffmpegtest.mkv
ffmpeg version N-66880-ga92192d Copyright (c) 2000-2014 the FFmpeg developers

built on Oct 15 2014 13:52:31 with gcc 4.8.3 (Gentoo 4.8.3 p1.1, pie-0.5.9)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-gpl --enable-postproc --enable-avfilter --enable-avresample --enable-version3 --enable-indev=v4l2 --enable-outdev=v4l2 --enable-bzlib --enable-hardcoded-tables --enable-iconv --enable-network --enable-ffplay --enable-vaapi --enable-zlib --enable-libvo-aacenc --enable-libmp3lame --enable-libfaac --enable-libtheora --enable-libwavpack --enable-libx264 --enable-libxvid --enable-opengl --enable-libv4l2 --enable-libpulse --enable-x11grab --enable-frei0r --enable-libfreetype --enable-libopus --enable-libspeex --enable-libvorbis --enable-avx --enable-avx2 --enable-fma3 --enable-fma4 --enable-mmxext --enable-sse3 --enable-ssse3 --enable-sse4 --enable-sse42 --enable-nonfree
libavutil 54. 10.100 / 54. 10.100
libavcodec 56. 7.100 / 56. 7.100
libavformat 56. 9.100 / 56. 9.100
libavdevice 56. 1.100 / 56. 1.100
libavfilter 5. 1.106 / 5. 1.106
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100

Input #0, video4linux2,v4l2, from '/dev/video1':

Duration: N/A, start: 35107.096095, bitrate: 995328 kb/s

Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 995328 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc

No pixel format specified, yuv422p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x1d55960] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
[libx264 @ 0x1d55960] profile High 4:2:2, level 4.0, 4:2:2 8-bit
[libx264 @ 0x1d55960] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=20 ip_ratio=1.40 aq=0
Output #0, matroska, to 'ffmpegtest.mkv':

Metadata:

encoder : Lavf56.9.100
Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv422p, 1920x1080, q=-1--1, 30 fps, 1k tbn, 30 tbc
Metadata:

encoder : Lavc56.7.100 libx264

Stream mapping:

Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))

Press [q] to stop, ? for help
frame= 668 fps= 30 q=-1.0 Lsize= 67100kB time=00:00:22.26 bitrate=24685.9kbits/s dup=0 drop=665
video:67094kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.009107%
[libx264 @ 0x1d55960] frame I:3 Avg QP:17.00 size:288245
[libx264 @ 0x1d55960] frame P:665 Avg QP:20.00 size:102013
[libx264 @ 0x1d55960] mb I I16..4: 100.0% 0.0% 0.0%
[libx264 @ 0x1d55960] mb P I16..4: 8.4% 0.0% 0.0% P16..4: 87.0% 0.0% 0.0% 0.0% 0.0% skip: 4.7%
[libx264 @ 0x1d55960] coded y,uvDC,uvAC intra: 21.2% 84.7% 23.6% inter: 49.6% 91.2% 16.0%
[libx264 @ 0x1d55960] i16 v,h,dc,p: 62% 21% 10% 7%
[libx264 @ 0x1d55960] i8c dc,h,v,p: 40% 23% 27% 10%
[libx264 @ 0x1d55960] kb/s:24683.82
Received signal 2: terminating.
louis@portablebauer ~/Videos/testing $ vlc ffmpegtest.mkv
VLC media player 3.0.0-git Vetinari (revision 2.2.0-git-1068-g2269959)
[0000000001037118] core libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[000000000111c4e8] qt4 interface error: Unable to load extensions module
louis@portablebauer ~/Videos/testing $ rm *mkv && ffmpeg -f v4l2 -framerate 30 -s 1920x1080 -i /dev/video1 -c:v libx264 -preset ultrafast -qp 20 ffmpegtest.mkv
ffmpeg version N-66880-ga92192d Copyright (c) 2000-2014 the FFmpeg developers

built on Oct 15 2014 13:52:31 with gcc 4.8.3 (Gentoo 4.8.3 p1.1, pie-0.5.9)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-gpl --enable-postproc --enable-avfilter --enable-avresample --enable-version3 --enable-indev=v4l2 --enable-outdev=v4l2 --enable-bzlib --enable-hardcoded-tables --enable-iconv --enable-network --enable-ffplay --enable-vaapi --enable-zlib --enable-libvo-aacenc --enable-libmp3lame --enable-libfaac --enable-libtheora --enable-libwavpack --enable-libx264 --enable-libxvid --enable-opengl --enable-libv4l2 --enable-libpulse --enable-x11grab --enable-frei0r --enable-libfreetype --enable-libopus --enable-libspeex --enable-libvorbis --enable-avx --enable-avx2 --enable-fma3 --enable-fma4 --enable-mmxext --enable-sse3 --enable-ssse3 --enable-sse4 --enable-sse42 --enable-nonfree
libavutil 54. 10.100 / 54. 10.100
libavcodec 56. 7.100 / 56. 7.100
libavformat 56. 9.100 / 56. 9.100
libavdevice 56. 1.100 / 56. 1.100
libavfilter 5. 1.106 / 5. 1.106
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100

[video4linux2,v4l2 @ 0x12a6f80] The v4l2 frame is 0 bytes, but 4147200 bytes are expected
Input #0, video4linux2,v4l2, from '/dev/video1':

Duration: N/A, bitrate: 995328 kb/s

Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 995328 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc

No pixel format specified, yuv422p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x12a96a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
[libx264 @ 0x12a96a0] profile High 4:2:2, level 4.0, 4:2:2 8-bit
[libx264 @ 0x12a96a0] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=20 ip_ratio=1.40 aq=0
Output #0, matroska, to 'ffmpegtest.mkv':

Metadata:

encoder : Lavf56.9.100
Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv422p, 1920x1080, q=-1--1, 30 fps, 1k tbn, 30 tbc
Metadata:

encoder : Lavc56.7.100 libx264

Stream mapping:

Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))

Press [q] to stop, ? for help
[video4linux2,v4l2 @ 0x12a6f80] The v4l2 frame is 0 bytes, but 4147200 bytes are expected
/dev/video1: Invalid data found when processing input
frame= 0 fps=0.0 q=0.0 Lsize= 1kB time=00:00:00.00 bitrate=N/A
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
louis@portablebauer ~/Videos/testing $

comment:3 Changed 5 years ago by thender

ffmpeg -f v4l2 -framerate 30 -s 1920x1080 -i /dev/video1 -c:v libx264 -preset ultrafast -qp 20 ffmpegtest.mkv

ffmpeg version N-66880-ga92192d Copyright (c) 2000-2014 the FFmpeg developers

built on Oct 15 2014 13:52:31 with gcc 4.8.3 (Gentoo 4.8.3 p1.1, pie-0.5.9)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-gpl --enable-postproc --enable-avfilter --enable-avresample --enable-version3 --enable-indev=v4l2 --enable-outdev=v4l2 --enable-bzlib --enable-hardcoded-tables --enable-iconv --enable-network --enable-ffplay --enable-vaapi --enable-zlib --enable-libvo-aacenc --enable-libmp3lame --enable-libfaac --enable-libtheora --enable-libwavpack --enable-libx264 --enable-libxvid --enable-opengl --enable-libv4l2 --enable-libpulse --enable-x11grab --enable-frei0r --enable-libfreetype --enable-libopus --enable-libspeex --enable-libvorbis --enable-avx --enable-avx2 --enable-fma3 --enable-fma4 --enable-mmxext --enable-sse3 --enable-ssse3 --enable-sse4 --enable-sse42 --enable-nonfree
libavutil 54. 10.100 / 54. 10.100
libavcodec 56. 7.100 / 56. 7.100
libavformat 56. 9.100 / 56. 9.100
libavdevice 56. 1.100 / 56. 1.100
libavfilter 5. 1.106 / 5. 1.106
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100

[video4linux2,v4l2 @ 0x10d4f80] The v4l2 frame is 0 bytes, but 4147200 bytes are expected
Input #0, video4linux2,v4l2, from '/dev/video1':

Duration: N/A, bitrate: 995328 kb/s

Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 995328 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc

No pixel format specified, yuv422p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x10d76a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
[libx264 @ 0x10d76a0] profile High 4:2:2, level 4.0, 4:2:2 8-bit
[libx264 @ 0x10d76a0] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=20 ip_ratio=1.40 aq=0
Output #0, matroska, to 'ffmpegtest.mkv':

Metadata:

encoder : Lavf56.9.100
Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv422p, 1920x1080, q=-1--1, 30 fps, 1k tbn, 30 tbc
Metadata:

encoder : Lavc56.7.100 libx264

Stream mapping:

Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))

Press [q] to stop, ? for help
[video4linux2,v4l2 @ 0x10d4f80] The v4l2 frame is 0 bytes, but 4147200 bytes are expected
/dev/video1: Invalid data found when processing input
frame= 0 fps=0.0 q=0.0 Lsize= 1kB time=00:00:00.00 bitrate=N/A
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

comment:4 Changed 5 years ago by thender

ffmpeg -f v4l2 -framerate 30 -s 1920x1080 -i /dev/video1 -c:v libx264 -preset ultrafast -qp 20 ffmpegtest.mkv

ffmpeg version N-66880-ga92192d Copyright (c) 2000-2014 the FFmpeg developers

built on Oct 15 2014 13:52:31 with gcc 4.8.3 (Gentoo 4.8.3 p1.1, pie-0.5.9)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-gpl --enable-postproc --enable-avfilter --enable-avresample --enable-version3 --enable-indev=v4l2 --enable-outdev=v4l2 --enable-bzlib --enable-hardcoded-tables --enable-iconv --enable-network --enable-ffplay --enable-vaapi --enable-zlib --enable-libvo-aacenc --enable-libmp3lame --enable-libfaac --enable-libtheora --enable-libwavpack --enable-libx264 --enable-libxvid --enable-opengl --enable-libv4l2 --enable-libpulse --enable-x11grab --enable-frei0r --enable-libfreetype --enable-libopus --enable-libspeex --enable-libvorbis --enable-avx --enable-avx2 --enable-fma3 --enable-fma4 --enable-mmxext --enable-sse3 --enable-ssse3 --enable-sse4 --enable-sse42 --enable-nonfree
libavutil 54. 10.100 / 54. 10.100
libavcodec 56. 7.100 / 56. 7.100
libavformat 56. 9.100 / 56. 9.100
libavdevice 56. 1.100 / 56. 1.100
libavfilter 5. 1.106 / 5. 1.106
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100

[video4linux2,v4l2 @ 0x10d4f80] The v4l2 frame is 0 bytes, but 4147200 bytes are expected
Input #0, video4linux2,v4l2, from '/dev/video1':

Duration: N/A, bitrate: 995328 kb/s

Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 995328 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc

No pixel format specified, yuv422p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x10d76a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
[libx264 @ 0x10d76a0] profile High 4:2:2, level 4.0, 4:2:2 8-bit
[libx264 @ 0x10d76a0] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=20 ip_ratio=1.40 aq=0
Output #0, matroska, to 'ffmpegtest.mkv':

Metadata:

encoder : Lavf56.9.100
Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv422p, 1920x1080, q=-1--1, 30 fps, 1k tbn, 30 tbc
Metadata:

encoder : Lavc56.7.100 libx264

Stream mapping:

Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))

Press [q] to stop, ? for help
[video4linux2,v4l2 @ 0x10d4f80] The v4l2 frame is 0 bytes, but 4147200 bytes are expected
/dev/video1: Invalid data found when processing input
frame= 0 fps=0.0 q=0.0 Lsize= 1kB time=00:00:00.00 bitrate=N/A
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

comment:5 Changed 5 years ago by cehoyos

Please test with ./configure && make ffmpeg, there are some configure options that may brake your command line.

comment:6 Changed 5 years ago by cehoyos

And use -qscale 2 instead of the x264-related options.

comment:7 Changed 5 years ago by holden

Hello, could you please also test after applying the attached patch? Thanks!

comment:8 Changed 5 years ago by thender

I tried recompiling with just configure, and I also tried your patch. Since compiling with nothing but ./configure does not give you x264 as a codec, I just decided to specify no video codec which defaulted to mpeg4. It still doesn't work.

$ ffmpeg -f v4l2 -framerate 30 -s 1920x1080 -i /dev/video0 microtester.mkv

ffmpeg version N-66880-ga92192d Copyright (c) 2000-2014 the FFmpeg developers

built on Oct 16 2014 14:08:29 with gcc 4.8.3 (Gentoo 4.8.3 p1.1, pie-0.5.9)
configuration: --prefix=/usr
libavutil 54. 10.100 / 54. 10.100
libavcodec 56. 7.100 / 56. 7.100
libavformat 56. 9.100 / 56. 9.100
libavdevice 56. 1.100 / 56. 1.100
libavfilter 5. 1.106 / 5. 1.106
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100

[video4linux2,v4l2 @ 0x1e46dc0] The v4l2 frame is 0 bytes, but 4147200 bytes are expected. Flags: 0x00002045
Input #0, video4linux2,v4l2, from '/dev/video0':

Duration: N/A, bitrate: 995328 kb/s

Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 995328 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc

Output #0, matroska, to 'microtester.mkv':

Metadata:

encoder : Lavf56.9.100
Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1920x1080, q=2-31, 200 kb/s, 30 fps, 1k tbn, 30 tbc
Metadata:

encoder : Lavc56.7.100 mpeg4

Stream mapping:

Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))

Press [q] to stop, ? for help
[video4linux2,v4l2 @ 0x1e46dc0] The v4l2 frame is 0 bytes, but 4147200 bytes are expected. Flags: 0x00002045
/dev/video0: Invalid data found when processing input
frame= 0 fps=0.0 q=0.0 Lsize= 1kB time=00:00:00.00 bitrate=N/A
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

If anyone else has this problem, VLC version 3 works with framerate. The reason I was using ffmpeg is because VLC was not letting me set the framerate of an input source with the stable version, but version 3 of VLC adds this functionality. If this buffer stuff gets fixed in ffmpeg, I'd love to go back to ffmpeg, but just incase someone else is in the same situation I am with a magewell USB3 HDMI capture device and needs something that works now, you can use a command line like this with VLC to record video & audio just fine. It never freezes and always works.

cvlc v4l2:// :v4l2-dev=/dev/video0 :v4l2-fps=30 :v4l2-width=1920 :v4l2-height=1080 --input-slave pulse:// --sout "#transcode{vcodec=h264,venc=x264{preset=ultrafast,crf=10}}:standard{access=file,dst=camcorder.avi}"

comment:9 Changed 5 years ago by cehoyos

  • Status changed from new to open
  • Version changed from unspecified to git-master

comment:10 follow-up: Changed 5 years ago by holden

Hi, thanks for your feedback. Could you please test again after applying only the second patch I just attached? I hope this will solve your problem.

comment:11 in reply to: ↑ 10 ; follow-up: Changed 5 years ago by thender

Replying to holden:

Hi, thanks for your feedback. Could you please test again after applying only the second patch I just attached? I hope this will solve your problem.


libavdevice # patch -p1 <0001-lavd-v4l2-produce-a-0-byte-packet-when-a-dequeued-bu.patch v4l2.c
patch unexpectedly ends in middle of line
(Patch is indented 22 spaces.)
patch unexpectedly ends in middle of line
sh: -: command not found
patch: FAILED

comment:12 Changed 5 years ago by cehoyos

Please try from FFmpeg's root directory (not from within libavdevice).

comment:13 in reply to: ↑ 11 Changed 5 years ago by holden

Replying to thender:

libavdevice # patch -p1 <0001-lavd-v4l2-produce-a-0-byte-packet-when-a-dequeued-bu.patch v4l2.c

If it can be of any help, you can use the following procedure to apply the patch:

1) make sure your master branch is updated:

git checkout master
make distclean
git pull

2) now create a new branch and apply the patch

git checkout -b v4l2fix
git am 0001-lavd-v4l2-produce-a-0-byte-packet-when-a-dequeued-bu.patch

3) Configure / compile / test

4) When you're done you can switch to your master branch again and delete the other

git checkout master
git branch -D v4l2fix

comment:14 Changed 5 years ago by holden

  • Analyzed by developer set
  • Cc mywing81@gmail.com added
  • Owner set to holden

comment:15 Changed 5 years ago by thender

I did something embarrassingly ignorant. Your patch works fine, the error is gone. I used the most basic ./configure with nothing but prefix=usr and support for libv4l2. It works but I get only 30% CPU usage with this, so I am going to try re-configuring it with something that more closely correlates with the configuration that I get when I emerge media-video/ffmpeg with portage, and see if I have a working solution.

Thank you so much!

comment:16 follow-up: Changed 5 years ago by thender

Doh, nevermind. Spoke too soon. I get this on the 2nd recording.

[video4linux2,v4l2 @ 0x1c2ff80] Dequeued v4l2 buffer contains corrupted data (0 bytes).

And when I go to record, it leaves off where I was before.

[video4linux2,v4l2 @ 0x1c2ff80] Dequeued v4l2 buffer contains corrupted data (0 bytes).

Last message repeated 30 times

frame= 16 fps=0.0 q=12.0 size= 108kB time=00:02:15.60 bitrate= 6.5kbits/frame= 31 fps= 31 q=12.0 size= 205kB time=00:02:16.10 bitrate= 12.3kbits/frame= 46 fps= 30 q=12.0 size= 301kB time=00:02:16.60 bitrate= 18.1kbits/frame= 61 fps= 30 q=12.0 size= 398kB time=00:02:17.10 bitrate= 23.8kbits/frame= 76 fps= 30 q=12.0 size= 495kB time=00:02:17.60 bitrate= 29.5kbits/frame= 91 fps= 30 q=12.0 size= 592kB time=00:02:18.10 bitrate= 35.1kbits/frame= 107 fps= 30 q=13.0 size= 693kB time=00:02:18.63 bitrate= 40.9kbits/frame= 122 fps= 30 q=13.0 size= 785kB time=00:02:19.13 bitrate= 46.2kbits/frame= 124 fps= 30 q=-1.0 Lsize= 72085kB time=00:02:19.43 bitrate=4235.1kbits/s dup=0 drop=122
video:71134kB audio:770kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.251618%
[libx264 @ 0x1c4ee00] frame I:1 Avg QP: 7.00 size:1198492
[libx264 @ 0x1c4ee00] frame P:123 Avg QP:12.19 size:582459
[libx264 @ 0x1c4ee00] mb I I16..4: 100.0% 0.0% 0.0%
[libx264 @ 0x1c4ee00] mb P I16..4: 16.9% 0.0% 0.0% P16..4: 82.9% 0.0% 0.0% 0.0% 0.0% skip: 0.2%
[libx264 @ 0x1c4ee00] coded y,uvDC,uvAC intra: 96.0% 99.1% 97.8% inter: 98.8% 99.3% 98.3%
[libx264 @ 0x1c4ee00] i16 v,h,dc,p: 13% 14% 55% 18%
[libx264 @ 0x1c4ee00] i8c dc,h,v,p: 50% 14% 20% 16%
[libx264 @ 0x1c4ee00] kb/s:140982.55
Received signal 2: terminating.

comment:17 in reply to: ↑ 16 Changed 5 years ago by holden

Replying to thender:

Doh, nevermind. Spoke too soon. I get this on the 2nd recording.

[video4linux2,v4l2 @ 0x1c2ff80] Dequeued v4l2 buffer contains corrupted data (0 bytes).

The message above simply means that the v4l2 driver has passed a corrupt frame to the application (ffmpeg). In this case the application can just ignore it and continue (it is supposed to be a recoverable error). Apart from that warning, does the recording work when you play it again?

And when I go to record, it leaves off where I was before.

What do you mean by that? Also, could you please post the complete output adding -loglevel debug to your command line?

comment:18 Changed 5 years ago by thender

To explain a little more precisely:

Originally, the first recording worked, but the second one would not. The error one would receive on the second record was this.

[video4linux2,v4l2 @ 0x1584f80] The v4l2 frame is 0 bytes, but 4147200 bytes are expected
Input #0, video4linux2,v4l2, from '/dev/video1':

Issues of this nature also had a tendency to happen in the middle of a recording.

Now, the 2nd recording does start recording, but you get stuck with one frame, that is the last frame from the prior recording. So you get a video file of one frame, no movement with what is going on, and that video frame in the 2nd recording that makes up the entirety of the recording is the last frame from the first recording.

Here is the command line with debug.

ffmpeg -f v4l2 -framerate 30 -s 1920x1080 -i /dev/video2 -c:v libx264 -preset ultrafast -crf 10 microcorder.mkv -loglevel debug
ffmpeg version N-67063-g282c935 Copyright (c) 2000-2014 the FFmpeg developers

built on Oct 21 2014 12:12:55 with gcc 4.8.3 (Gentoo 4.8.3 p1.1, pie-0.5.9)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags='-march=native -O2 -pipe' --extra-cflags='-march=native -O2 -pipe' --extra-cxxflags='-march=native -O2 -pipe' --enable-gpl --enable-postproc --enable-avfilter --enable-avresample --enable-version3 --enable-nonfree --enable-bzlib --enable-hardcoded-tables --enable-iconv --enable-network --enable-ffplay --enable-vaapi --enable-zlib --enable-libvo-aacenc --enable-libmp3lame --enable-libfaac --enable-libtheora --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libxvid --enable-opengl --enable-libv4l2 --enable-libpulse --enable-x11grab --enable-libfreetype --enable-pthreads --enable-libvorbis --cpu=host
libavutil 54. 10.100 / 54. 10.100
libavcodec 56. 8.102 / 56. 8.102
libavformat 56. 9.101 / 56. 9.101
libavdevice 56. 1.100 / 56. 1.100
libavfilter 5. 2.100 / 5. 2.100
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100

Splitting the commandline.
Reading option '-f' ... matched as option 'f' (force format) with argument 'v4l2'.
Reading option '-framerate' ... matched as AVOption 'framerate' with argument '30'.
Reading option '-s' ... matched as option 's' (set frame size (WxH or abbreviation)) with argument '1920x1080'.
Reading option '-i' ... matched as input file with argument '/dev/video2'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'libx264'.
Reading option '-preset' ... matched as AVOption 'preset' with argument 'ultrafast'.
Reading option '-crf' ... matched as AVOption 'crf' with argument '10'.
Reading option 'microcorder.mkv' ... matched as output file.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input file /dev/video2.
Applying option f (force format) with argument v4l2.
Applying option s (set frame size (WxH or abbreviation)) with argument 1920x1080.
Successfully parsed a group of options.
Opening an input file: /dev/video2.
[video4linux2,v4l2 @ 0x17b4f80] fd:3 capabilities:84000001
[video4linux2,v4l2 @ 0x17b4f80] Current input_channel: 0, input_name: Camera 1, input_std: 0
[video4linux2,v4l2 @ 0x17b4f80] Setting time per frame to 1/30
[video4linux2,v4l2 @ 0x17b4f80] The V4L2 driver changed the pixel format from 0x32315559 to 0x56595559
[video4linux2,v4l2 @ 0x17b4f80] Trying to set codec:rawvideo pix_fmt:yuv420p
[video4linux2,v4l2 @ 0x17b4f80] The V4L2 driver changed the pixel format from 0x32315559 to 0x56595559
[video4linux2,v4l2 @ 0x17b4f80] Trying to set codec:rawvideo pix_fmt:yuv420p
[video4linux2,v4l2 @ 0x17b4f80] The V4L2 driver changed the pixel format from 0x32315659 to 0x56595559
[video4linux2,v4l2 @ 0x17b4f80] Trying to set codec:rawvideo pix_fmt:yuv422p
[video4linux2,v4l2 @ 0x17b4f80] The V4L2 driver changed the pixel format from 0x50323234 to 0x56595559
[video4linux2,v4l2 @ 0x17b4f80] Trying to set codec:rawvideo pix_fmt:yuyv422
[video4linux2,v4l2 @ 0x17b4f80] Dequeued v4l2 buffer contains corrupted data (0 bytes).
[video4linux2,v4l2 @ 0x17b4f80] All info found
Input #0, video4linux2,v4l2, from '/dev/video2':

Duration: N/A, start: 0.000000, bitrate: 995328 kb/s

Stream #0:0, 1, 1/1000000: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 1/1000000, 995328 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc

Successfully opened the file.
Parsing a group of options: output file microcorder.mkv.
Applying option c:v (codec name) with argument libx264.
Successfully parsed a group of options.
Opening an output file: microcorder.mkv.
Successfully opened the file.
detected 4 logical cores
[graph 0 input from stream 0:0 @ 0x17b4e80] Setting 'video_size' to value '1920x1080'
[graph 0 input from stream 0:0 @ 0x17b4e80] Setting 'pix_fmt' to value '1'
[graph 0 input from stream 0:0 @ 0x17b4e80] Setting 'time_base' to value '1/1000000'
[graph 0 input from stream 0:0 @ 0x17b4e80] Setting 'pixel_aspect' to value '0/1'
[graph 0 input from stream 0:0 @ 0x17b4e80] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 0x17b4e80] Setting 'frame_rate' to value '30/1'
[graph 0 input from stream 0:0 @ 0x17b4e80] w:1920 h:1080 pixfmt:yuyv422 tb:1/1000000 fr:30/1 sar:0/1 sws_param:flags=2
[format @ 0x17abf60] compat: called with args=[yuv420p|yuvj420p|yuv422p|yuvj422p|yuv444p|yuvj444p|nv12|nv16]
[format @ 0x17abf60] Setting 'pix_fmts' to value 'yuv420p|yuvj420p|yuv422p|yuvj422p|yuv444p|yuvj444p|nv12|nv16'
[auto-inserted scaler 0 @ 0x17b84c0] Setting 'flags' to value '0x4'
[auto-inserted scaler 0 @ 0x17b84c0] w:iw h:ih flags:'0x4' interl:0
[format @ 0x17abf60] auto-inserting filter 'auto-inserted scaler 0' between the filter 'Parsed_null_0' and the filter 'format'
[AVFilterGraph @ 0x17abec0] query_formats: 4 queried, 2 merged, 1 already done, 0 delayed
[auto-inserted scaler 0 @ 0x17b84c0] picking yuv422p out of 7 ref:yuyv422 alpha:0
[auto-inserted scaler 0 @ 0x17b84c0] w:1920 h:1080 fmt:yuyv422 sar:0/1 -> w:1920 h:1080 fmt:yuv422p sar:0/1 flags:0x4
No pixel format specified, yuv422p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x17b7980] using mv_range_thread = 88
[libx264 @ 0x17b7980] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
[libx264 @ 0x17b7980] profile High 4:2:2, level 4.0, 4:2:2 8-bit
[libx264 @ 0x17b7980] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=10.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
Output #0, matroska, to 'microcorder.mkv':

Metadata:

encoder : Lavf56.9.101
Stream #0:0, 0, 1/1000: Video: h264 (libx264) (H264 / 0x34363248), yuv422p, 1920x1080, 1/30, q=-1--1, 30 fps, 1k tbn, 30 tbc
Metadata:

encoder : Lavc56.8.102 libx264

Stream mapping:

Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))

Press [q] to stop, ? for help
[video4linux2,v4l2 @ 0x17b4f80] Dequeued v4l2 buffer contains corrupted data (0 bytes).

Last message repeated 30 times

* dropping frame 3 from stream 0 at ts 212910
* dropping frame 4 from stream 0 at ts 212911
* dropping frame 5 from stream 0 at ts 212912
* dropping frame 6 from stream 0 at ts 212913
* dropping frame 7 from stream 0 at ts 212914
[libx264 @ 0x17b7980] frame= 0 QP=7.00 NAL=3 Slice:I Poc:0 I:8160 P:0 SKIP:0 size=876606 bytes
[matroska @ 0x17b6980] Writing block at offset 639, size 877191, pts 7096967, dts 7096967, duration 33, flags 128
* dropping frame 8 from stream 0 at ts 212915
[libx264 @ 0x17b7980] frame= 1 QP=9.00 NAL=2 Slice:P Poc:2 I:105 P:8055 SKIP:0 size=528337 bytes
[matroska @ 0x17b6980] Writing block at offset 877839, size 528337, pts 7097000, dts 7097000, duration 33, flags 0
* dropping frame 9 from stream 0 at ts 212916
[libx264 @ 0x17b7980] frame= 2 QP=9.00 NAL=2 Slice:P Poc:4 I:435 P:7725 SKIP:0 size=569116 bytes
[matroska @ 0x17b6980] Writing block at offset 1406184, size 569116, pts 7097033, dts 7097033, duration 33, flags 0
* dropping frame 10 from stream 0 at ts 212917
[libx264 @ 0x17b7980] frame= 3 QP=9.00 NAL=2 Slice:P Poc:6 I:2346 P:5814 SKIP:0 size=650612 bytes
[matroska @ 0x17b6980] Writing block at offset 1975308, size 650612, pts 7097067, dts 7097067, duration 33, flags 0
* dropping frame 11 from stream 0 at ts 212918
[libx264 @ 0x17b7980] frame= 4 QP=9.00 NAL=2 Slice:P Poc:8 I:1929 P:6231 SKIP:0 size=646936 bytes
[matroska @ 0x17b6980] Writing block at offset 2625928, size 646936, pts 7097100, dts 7097100, duration 33, flags 0
* dropping frame 12 from stream 0 at ts 212919
[libx264 @ 0x17b7980] frame= 5 QP=9.00 NAL=2 Slice:P Poc:10 I:1904 P:6256 SKIP:0 size=646795 bytes
[matroska @ 0x17b6980] Writing block at offset 3272872, size 646795, pts 7097133, dts 7097133, duration 33, flags 0
* dropping frame 13 from stream 0 at ts 212920
[libx264 @ 0x17b7980] frame= 6 QP=9.00 NAL=2 Slice:P Poc:12 I:1835 P:6325 SKIP:0 size=649169 bytes
[matroska @ 0x17b6980] Writing block at offset 3919675, size 649169, pts 7097167, dts 7097167, duration 33, flags 0
* dropping frame 14 from stream 0 at ts 212921
[libx264 @ 0x17b7980] frame= 7 QP=9.00 NAL=2 Slice:P Poc:14 I:1940 P:6220 SKIP:0 size=652170 bytes
[matroska @ 0x17b6980] Writing block at offset 4568852, size 652170, pts 7097200, dts 7097200, duration 33, flags 0
* dropping frame 15 from stream 0 at ts 212922
[libx264 @ 0x17b7980] frame= 8 QP=9.00 NAL=2 Slice:P Poc:16 I:1878 P:6282 SKIP:0 size=649026 bytes
[matroska @ 0x17b6980] Writing block at offset 5221030, size 649026, pts 7097233, dts 7097233, duration 33, flags 0
frame= 16 fps=0.0 q=9.0 size= 5732kB time=01:58:17.26 bitrate= 6.6kbits/s* dropping frame 16 from stream 0 at ts 212923
[libx264 @ 0x17b7980] frame= 9 QP=9.00 NAL=2 Slice:P Poc:18 I:1955 P:6205 SKIP:0 size=653694 bytes
[matroska @ 0x17b6980] Starting new cluster at offset 5870064 bytes, pts 7097267dts 7097267
[matroska @ 0x17b6980] Writing block at offset 5870081, size 653694, pts 7097267, dts 7097267, duration 33, flags 0
* dropping frame 17 from stream 0 at ts 212924
[libx264 @ 0x17b7980] frame= 10 QP=9.00 NAL=2 Slice:P Poc:20 I:1971 P:6189 SKIP:0 size=652942 bytes
[matroska @ 0x17b6980] Writing block at offset 6523783, size 652942, pts 7097300, dts 7097300, duration 33, flags 0
* dropping frame 18 from stream 0 at ts 212925
[libx264 @ 0x17b7980] frame= 11 QP=9.00 NAL=2 Slice:P Poc:22 I:1829 P:6331 SKIP:0 size=652226 bytes
[matroska @ 0x17b6980] Writing block at offset 7176733, size 652226, pts 7097333, dts 7097333, duration 33, flags 0
* dropping frame 19 from stream 0 at ts 212926
[libx264 @ 0x17b7980] frame= 12 QP=9.00 NAL=2 Slice:P Poc:24 I:1969 P:6191 SKIP:0 size=654018 bytes
[matroska @ 0x17b6980] Writing block at offset 7828967, size 654018, pts 7097367, dts 7097367, duration 33, flags 0
* dropping frame 20 from stream 0 at ts 212927
[libx264 @ 0x17b7980] frame= 13 QP=9.00 NAL=2 Slice:P Poc:26 I:1922 P:6238 SKIP:0 size=653584 bytes
[matroska @ 0x17b6980] Writing block at offset 8482993, size 653584, pts 7097400, dts 7097400, duration 33, flags 0
* dropping frame 21 from stream 0 at ts 212928
[libx264 @ 0x17b7980] frame= 14 QP=9.00 NAL=2 Slice:P Poc:28 I:1869 P:6291 SKIP:0 size=652748 bytes
[matroska @ 0x17b6980] Writing block at offset 9136585, size 652748, pts 7097433, dts 7097433, duration 33, flags 0
* dropping frame 22 from stream 0 at ts 212929
[libx264 @ 0x17b7980] frame= 15 QP=9.00 NAL=2 Slice:P Poc:30 I:1915 P:6245 SKIP:0 size=652861 bytes
[matroska @ 0x17b6980] Writing block at offset 9789341, size 652861, pts 7097467, dts 7097467, duration 33, flags 0
* dropping frame 23 from stream 0 at ts 212930
[libx264 @ 0x17b7980] frame= 16 QP=9.00 NAL=2 Slice:P Poc:32 I:1941 P:6219 SKIP:0 size=655914 bytes
[matroska @ 0x17b6980] Writing block at offset 10442210, size 655914, pts 7097500, dts 7097500, duration 33, flags 0
* dropping frame 24 from stream 0 at ts 212931
[libx264 @ 0x17b7980] frame= 17 QP=9.00 NAL=2 Slice:P Poc:34 I:1897 P:6263 SKIP:0 size=655666 bytes
[matroska @ 0x17b6980] Writing block at offset 11098132, size 655666, pts 7097533, dts 7097533, duration 33, flags 0
* dropping frame 25 from stream 0 at ts 212932
[libx264 @ 0x17b7980] frame= 18 QP=9.00 NAL=2 Slice:P Poc:36 I:1886 P:6274 SKIP:0 size=653662 bytes
[matroska @ 0x17b6980] Starting new cluster at offset 11753806 bytes, pts 7097567dts 7097567
[matroska @ 0x17b6980] Writing block at offset 11753823, size 653662, pts 7097567, dts 7097567, duration 33, flags 0
* dropping frame 26 from stream 0 at ts 212933
[libx264 @ 0x17b7980] frame= 19 QP=9.00 NAL=2 Slice:P Poc:38 I:1918 P:6242 SKIP:0 size=654459 bytes
[matroska @ 0x17b6980] Writing block at offset 12407493, size 654459, pts 7097600, dts 7097600, duration 33, flags 0
* dropping frame 27 from stream 0 at ts 212934
[libx264 @ 0x17b7980] frame= 20 QP=9.00 NAL=2 Slice:P Poc:40 I:1933 P:6227 SKIP:0 size=655209 bytes
[matroska @ 0x17b6980] Writing block at offset 13061960, size 655209, pts 7097633, dts 7097633, duration 33, flags 0
* dropping frame 28 from stream 0 at ts 212935
[libx264 @ 0x17b7980] frame= 21 QP=9.00 NAL=2 Slice:P Poc:42 I:1855 P:6305 SKIP:0 size=654998 bytes
[matroska @ 0x17b6980] Writing block at offset 13717177, size 654998, pts 7097667, dts 7097667, duration 33, flags 0
* dropping frame 29 from stream 0 at ts 212936
[libx264 @ 0x17b7980] frame= 22 QP=9.00 NAL=2 Slice:P Poc:44 I:1921 P:6239 SKIP:0 size=652845 bytes
[matroska @ 0x17b6980] Writing block at offset 14372183, size 652845, pts 7097700, dts 7097700, duration 33, flags 0
* dropping frame 30 from stream 0 at ts 212937
frame= 30 fps= 29 q=9.0 size= 14673kB time=01:58:17.73 bitrate= 16.9kbits/s[libx264 @ 0x17b7980] frame= 23 QP=9.00 NAL=2 Slice:P Poc:46 I:1857 P:6303 SKIP:0 size=657522 bytes
[matroska @ 0x17b6980] Writing block at offset 15025036, size 657522, pts 7097733, dts 7097733, duration 33, flags 0
* dropping frame 31 from stream 0 at ts 212938
[libx264 @ 0x17b7980] frame= 24 QP=9.00 NAL=2 Slice:P Poc:48 I:1857 P:6303 SKIP:0 size=653710 bytes
[matroska @ 0x17b6980] Writing block at offset 15682566, size 653710, pts 7097767, dts 7097767, duration 33, flags 0
* dropping frame 32 from stream 0 at ts 212939
[libx264 @ 0x17b7980] frame= 25 QP=9.00 NAL=2 Slice:P Poc:50 I:1897 P:6263 SKIP:0 size=655173 bytes
[matroska @ 0x17b6980] Writing block at offset 16336284, size 655173, pts 7097800, dts 7097800, duration 33, flags 0
* dropping frame 33 from stream 0 at ts 212940
[libx264 @ 0x17b7980] frame= 26 QP=9.00 NAL=2 Slice:P Poc:52 I:1887 P:6273 SKIP:0 size=654544 bytes
[matroska @ 0x17b6980] Writing block at offset 16991465, size 654544, pts 7097833, dts 7097833, duration 33, flags 0
* dropping frame 34 from stream 0 at ts 212941
[libx264 @ 0x17b7980] frame= 27 QP=9.00 NAL=2 Slice:P Poc:54 I:1914 P:6246 SKIP:0 size=652925 bytes
[matroska @ 0x17b6980] Starting new cluster at offset 17646017 bytes, pts 7097867dts 7097867
[matroska @ 0x17b6980] Writing block at offset 17646034, size 652925, pts 7097867, dts 7097867, duration 33, flags 0
* dropping frame 35 from stream 0 at ts 212942
[libx264 @ 0x17b7980] frame= 28 QP=9.00 NAL=2 Slice:P Poc:56 I:1892 P:6268 SKIP:0 size=655587 bytes
[matroska @ 0x17b6980] Writing block at offset 18298967, size 655587, pts 7097900, dts 7097900, duration 33, flags 0
* dropping frame 36 from stream 0 at ts 212943
[libx264 @ 0x17b7980] frame= 29 QP=9.00 NAL=2 Slice:P Poc:58 I:1859 P:6301 SKIP:0 size=654975 bytes
[matroska @ 0x17b6980] Writing block at offset 18954562, size 654975, pts 7097933, dts 7097933, duration 33, flags 0
* dropping frame 37 from stream 0 at ts 212944
[libx264 @ 0x17b7980] frame= 30 QP=9.00 NAL=2 Slice:P Poc:60 I:1985 P:6175 SKIP:0 size=654340 bytes
[matroska @ 0x17b6980] Writing block at offset 19609545, size 654340, pts 7097967, dts 7097967, duration 33, flags 0
* dropping frame 38 from stream 0 at ts 212945
[libx264 @ 0x17b7980] frame= 31 QP=9.00 NAL=2 Slice:P Poc:62 I:1935 P:6225 SKIP:0 size=656391 bytes
[matroska @ 0x17b6980] Writing block at offset 20263893, size 656391, pts 7098000, dts 7098000, duration 33, flags 0
* dropping frame 39 from stream 0 at ts 212946
[libx264 @ 0x17b7980] frame= 32 QP=9.00 NAL=2 Slice:P Poc:64 I:1866 P:6294 SKIP:0 size=653822 bytes
[matroska @ 0x17b6980] Writing block at offset 20920292, size 653822, pts 7098033, dts 7098033, duration 33, flags 0
* dropping frame 40 from stream 0 at ts 212947
[libx264 @ 0x17b7980] frame= 33 QP=9.00 NAL=2 Slice:P Poc:66 I:1941 P:6219 SKIP:0 size=656975 bytes
[matroska @ 0x17b6980] Writing block at offset 21574122, size 656975, pts 7098067, dts 7098067, duration 33, flags 0
* dropping frame 41 from stream 0 at ts 212948
[libx264 @ 0x17b7980] frame= 34 QP=9.00 NAL=2 Slice:P Poc:68 I:1928 P:6232 SKIP:0 size=656025 bytes
[matroska @ 0x17b6980] Writing block at offset 22231105, size 656025, pts 7098100, dts 7098100, duration 33, flags 0
* dropping frame 42 from stream 0 at ts 212949
frame= 42 fps= 27 q=9.0 size= 22351kB time=01:58:18.13 bitrate= 25.8kbits/s[libx264 @ 0x17b7980] frame= 35 QP=9.00 NAL=2 Slice:P Poc:70 I:1906 P:6254 SKIP:0 size=654506 bytes
[matroska @ 0x17b6980] Writing block at offset 22887138, size 654506, pts 7098133, dts 7098133, duration 33, flags 0
* dropping frame 43 from stream 0 at ts 212950
[libx264 @ 0x17b7980] frame= 36 QP=9.00 NAL=2 Slice:P Poc:72 I:1867 P:6293 SKIP:0 size=653731 bytes
[matroska @ 0x17b6980] Starting new cluster at offset 23541652 bytes, pts 7098167dts 7098167
[matroska @ 0x17b6980] Writing block at offset 23541669, size 653731, pts 7098167, dts 7098167, duration 33, flags 0
* dropping frame 44 from stream 0 at ts 212951
[libx264 @ 0x17b7980] frame= 37 QP=9.00 NAL=2 Slice:P Poc:74 I:1889 P:6271 SKIP:0 size=656269 bytes
[matroska @ 0x17b6980] Writing block at offset 24195408, size 656269, pts 7098200, dts 7098200, duration 33, flags 0
* dropping frame 45 from stream 0 at ts 212952
[libx264 @ 0x17b7980] frame= 38 QP=9.00 NAL=2 Slice:P Poc:76 I:1854 P:6306 SKIP:0 size=654673 bytes
[matroska @ 0x17b6980] Writing block at offset 24851685, size 654673, pts 7098233, dts 7098233, duration 33, flags 0
* dropping frame 46 from stream 0 at ts 212953
[libx264 @ 0x17b7980] frame= 39 QP=9.00 NAL=2 Slice:P Poc:78 I:1917 P:6243 SKIP:0 size=655443 bytes
[matroska @ 0x17b6980] Writing block at offset 25506366, size 655443, pts 7098267, dts 7098267, duration 33, flags 0
[libx264 @ 0x17b7980] frame= 40 QP=9.00 NAL=2 Slice:P Poc:80 I:1999 P:6161 SKIP:0 size=655840 bytes
[matroska @ 0x17b6980] Writing block at offset 26161817, size 655840, pts 7098300, dts 7098300, duration 33, flags 0
[libx264 @ 0x17b7980] frame= 41 QP=9.00 NAL=2 Slice:P Poc:82 I:1872 P:6288 SKIP:0 size=656266 bytes
[matroska @ 0x17b6980] Writing block at offset 26817665, size 656266, pts 7098333, dts 7098333, duration 33, flags 0
[libx264 @ 0x17b7980] frame= 42 QP=9.00 NAL=2 Slice:P Poc:84 I:1874 P:6286 SKIP:0 size=654788 bytes
[matroska @ 0x17b6980] Writing block at offset 27473939, size 654788, pts 7098367, dts 7098367, duration 33, flags 0
[libx264 @ 0x17b7980] frame= 43 QP=9.00 NAL=2 Slice:P Poc:86 I:1893 P:6267 SKIP:0 size=655624 bytes
[matroska @ 0x17b6980] Writing block at offset 28128735, size 655624, pts 7098400, dts 7098400, duration 33, flags 0
[libx264 @ 0x17b7980] frame= 44 QP=9.00 NAL=2 Slice:P Poc:88 I:1948 P:6212 SKIP:0 size=652990 bytes
[matroska @ 0x17b6980] Writing block at offset 28784367, size 652990, pts 7098433, dts 7098433, duration 33, flags 0
[libx264 @ 0x17b7980] frame= 45 QP=9.00 NAL=2 Slice:P Poc:90 I:1863 P:6297 SKIP:0 size=654899 bytes
[matroska @ 0x17b6980] Starting new cluster at offset 29437365 bytes, pts 7098467dts 7098467
[matroska @ 0x17b6980] Writing block at offset 29437382, size 654899, pts 7098467, dts 7098467, duration 33, flags 0
[libx264 @ 0x17b7980] frame= 46 QP=9.00 NAL=2 Slice:P Poc:92 I:1910 P:6250 SKIP:0 size=655587 bytes
[matroska @ 0x17b6980] Writing block at offset 30092289, size 655587, pts 7098500, dts 7098500, duration 33, flags 0
[matroska @ 0x17b6980] end duration = 7098533
frame= 47 fps= 26 q=-1.0 Lsize= 30027kB time=01:58:18.53 bitrate= 34.7kbits/s dup=0 drop=44
video:30026kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.003682%
Input file #0 (/dev/video2):

Input stream #0:0 (video): 123 packets read (377395200 bytes); 91 frames decoded;
Total: 123 packets (377395200 bytes) demuxed

Output file #0 (microcorder.mkv):

Output stream #0:0 (video): 47 frames encoded; 47 packets muxed (30746783 bytes);
Total: 47 packets (30746783 bytes) muxed

91 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x17ba8e0] Statistics: 34 seeks, 978 writeouts
[libx264 @ 0x17b7980] frame I:1 Avg QP: 7.00 size:876606
[libx264 @ 0x17b7980] frame P:46 Avg QP: 9.00 size:649339
[libx264 @ 0x17b7980] mb I I16..4: 100.0% 0.0% 0.0%
[libx264 @ 0x17b7980] mb P I16..4: 22.6% 0.0% 0.0% P16..4: 77.4% 0.0% 0.0% 0.0% 0.0% skip: 0.0%
[libx264 @ 0x17b7980] coded y,uvDC,uvAC intra: 100.0% 100.0% 100.0% inter: 99.0% 100.0% 100.0%
[libx264 @ 0x17b7980] i16 v,h,dc,p: 1% 4% 85% 10%
[libx264 @ 0x17b7980] i8c dc,h,v,p: 63% 14% 10% 13%
[libx264 @ 0x17b7980] kb/s:157001.86
Received signal 2: terminating.

Version 0, edited 5 years ago by thender (next)

comment:19 follow-up: Changed 5 years ago by thender

If it would help a developer to resolve this issue I would be happy to provide one of these capture devices & also a portable camcorder with hdmi output to you so you can try for yourself. Let me know if you would like to take me up on this offer. I am not a developer or manufacturer, just an end user that really likes ffmpeg. I have an extra one of these that works, and also a portable camcorder I never use. It would be more than sufficient, all you would need is a computer with a good USB 3.0 port to do the testing.

comment:20 Changed 5 years ago by cehoyos

Do you see the same problems if you test with a significantly smaller resolution?

comment:21 in reply to: ↑ 19 Changed 5 years ago by holden

Thanks for your feedback. Some comments:

1) Please test the following command, this will tell us what the hardware actually supports:

ffmpeg -f video4linux2 -list_formats all -i /dev/video0

2) -s is not a v4l2 device option. You can read about all the valid options here:
http://ffmpeg.org/ffmpeg-devices.html#video4linux2_002c-v4l2
the valid command line would be:

ffmpeg -loglevel debug -f v4l2 -framerate 30 -video_size 1920x1080 -i /dev/video2 -c:v libx264 -preset ultrafast -crf 10 microcorder.mkv

Does the problem still exist with using this command? Also, as Carl suggested, test with a smaller resolution.

Replying to thender:

If it would help a developer to resolve this issue I would be happy to provide one of these capture devices & also a portable camcorder with hdmi output to you so you can try for yourself. Let me know if you would like to take me up on this offer. I am not a developer or manufacturer, just an end user that really likes ffmpeg. I have an extra one of these that works, and also a portable camcorder I never use. It would be more than sufficient, all you would need is a computer with a good USB 3.0 port to do the testing.

That would help a lot, yes, so if we can't solve the issue I might take you up on that offer. Also, having a box with remote ssh access would help as an alternative. If you're on IRC ping me sometime (my nick is Holden), I could ask you to do some tests in real time and maybe we could get this fixed faster.

comment:22 follow-up: Changed 5 years ago by corco

I have the exact same issue with a different device, an INOGENI 4K2USB. I should probably disclaim that I am one of the hardware designers.

The issue is the same, after the device is connected, any ffmpeg command will work. However, if ffmpeg is stopped and the same command (or another) is inputted, it fails with "The v4l2 frame is 0 bytes, but XXXXXXX bytes are expected".

The issue doesn't affect every kernel. I don't have any problem with my Centos 3.10.0 kernel, but the problem was reported and confirmed on Ubuntu 14.04 3.16.0 kernel. So the issue may be with the V4L2 driver, but FFmpeg is the only one to complain about it; gstreamer and VLC are fine.

I tested the 0001-lavd-v4l2-print-buffer-flags-in-case-of-error.patch from holden and was pleased to see that it fixed the problem, albeit a rather harmless error message at the beginning. Is there any chance to apply the patch to upstream?

If you're interested in investigating the issue, I could provide SSH to the ubuntu machine.

comment:23 in reply to: ↑ 22 Changed 4 years ago by holden

Replying to corco:

The issue doesn't affect every kernel. I don't have any problem with my Centos 3.10.0 kernel, but the problem was reported and confirmed on Ubuntu 14.04 3.16.0 kernel. So the issue may be with the V4L2 driver, but FFmpeg is the only one to complain about it; gstreamer and VLC are fine.

Yes, probably something changed in the v4l2 driver with recent kernels.

I tested the 0001-lavd-v4l2-print-buffer-flags-in-case-of-error.patch from holden and was pleased to see that it fixed the problem, albeit a rather harmless error message at the beginning. Is there any chance to apply the patch to upstream?

That patch only modified a message to include the flags of the buffer that gave an error, so I doubt it can actually fix the problem. Nonetheless, I sent it upstream anyway and it was integrated. Maybe you meant the other patch (0001-lavd-v4l2-produce-a-0-byte-packet-when-a-dequeued-bu.patch)?

If you're interested in investigating the issue, I could provide SSH to the ubuntu machine.

Yes, if we can't solve it easily that might help, thanks.

comment:24 Changed 4 years ago by corco

Yes, I did mean the 0001-lavd-v4l2-produce-a-0-byte-packet-when-a-dequeued-bu.patch patch, my mistake.

comment:25 Changed 4 years ago by hendry

Same issue on 4.0.1-1-ARCH. I don't think it's a kernel issue since the Magewell XI100DUSB-HDMI device works fine in gstreamer. http://stackoverflow.com/a/29944546/4534

comment:26 follow-up: Changed 4 years ago by artwait

For whatever it's worth, I too am having the same issue using the Magewell USB3 capture dongle: I'm able to record one time, then subsequent innvocations are met with the "The v4l2 frame is 0 bytes..." error.

I had a similar problem a few months back with Gstreamer, and the dev there did discover it was a v4l2 problem in a recent kernel, so he put together a patch to workaround it: https://bugzilla.gnome.org/show_bug.cgi?id=740040

comment:27 in reply to: ↑ 26 Changed 4 years ago by corco

Replying to artwait:

For whatever it's worth, I too am having the same issue using the Magewell USB3 capture dongle: I'm able to record one time, then subsequent innvocations are met with the "The v4l2 frame is 0 bytes..." error.

I had a similar problem a few months back with Gstreamer, and the dev there did discover it was a v4l2 problem in a recent kernel, so he put together a patch to workaround it: https://bugzilla.gnome.org/show_bug.cgi?id=740040

Did you (or artwait) try the 0001-lavd-v4l2-produce-a-0-byte-packet-when-a-dequeued-bu.patch? Does it fix the issue on your setup?

comment:28 Changed 4 years ago by artwait

Yep, I applied the patch to v. 2.6 and it did indeed solve the issue for me. Yay!

Will it be going into the next release?

comment:29 Changed 4 years ago by holden

Hello guys, thanks for your feedback. I just saw that the original patch doesn't apply cleanly anymore, so I'll just post a new patch in the following days and ask you for another round of testing. After that I'll send the patch upstream for integration. Thanks.

comment:30 follow-up: Changed 4 years ago by holden

Hi, could you please test again the latest git head with the new attached patch (0003-lavd-v4l2-produce-a-0-byte-packet-when-a-dequeued-bu.patch)? If you need help on how to apply the patch please see comment 13 on this page (just make sure you change the patch name on step 2). Thanks.

comment:31 in reply to: ↑ 30 ; follow-up: Changed 4 years ago by corco

Replying to holden:

Hi, could you please test again the latest git head with the new attached patch (0003-lavd-v4l2-produce-a-0-byte-packet-when-a-dequeued-bu.patch)? If you need help on how to apply the patch please see comment 13 on this page (just make sure you change the patch name on step 2). Thanks.

On ubuntu 14.04, I confirmed the bug on git head, applied the patch and now the bug is gone!

Thanks you again holden

comment:32 Changed 4 years ago by corco

  • Cc jonathan.drolet@polymtl.ca added

comment:33 in reply to: ↑ 31 Changed 4 years ago by holden

Replying to corco:

On ubuntu 14.04, I confirmed the bug on git head, applied the patch and now the bug is gone!

Thanks you again holden

Great, thanks for testing again, I've sent the patch upstream and hopefully it'll be applied shortly.

comment:34 Changed 4 years ago by holden

  • Resolution set to fixed
  • Status changed from open to closed

Okay, the patch was accepted upstream so I am closing this bug. Feel free to leave a comment or reopen it if you still have problems. Thanks.

Note: See TracTickets for help on using tickets.