[FFmpeg-user] V4L2 recording results in invalid data & buffer still owned errors.

Louis Rossmann l.a.rossmann at gmail.com
Fri Sep 5 23:09:57 CEST 2014


Hi

I am using a Magewell XI100DUSB-HDMI capture device to record video from a
camera. My end goal is to be able to record two cameras simultaneously, one
with embedded audio, both HDMI sources.

Here is the command I am using to record one of the cameras

*$ 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*

Sometimes this works perfectly! Unfortunately, at other times, I get audio
without video, with this error.

*[video4linux2,v4l2 @ 0xfb3e80] The v4l2 frame is 0 bytes, but 4147200
bytes are expected*
*/dev/video1: Invalid data found when processing input*

*[video4linux2,v4l2 @ 0xfb3e80] Some buffers are still owned by the caller
on close.*

My current resolution to this problem is to simply re-run the command until
it records. Sometimes it will record on the 3rd try,sometimes it will
record on the 100th try. This is a huge inconvenience, and if I plan to
work with two of these at once in the future, it will only get worse.

Here is an example of the command when it works, and an example of it when
it does not work, just incase I left anything out in that short output
above.

*$ 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*
*ffmpeg version N-65991-g8c63a0d Copyright (c) 2000-2014 the FFmpeg
developers*
*  built on Sep  4 2014 22:48:40 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 -O3 -pipe' --extra-cflags='-march=native -O3
-pipe' --extra-cxxflags='-march=native -O3 -pipe' --disable-static
--enable-gpl --enable-postproc --enable-avfilter --enable-avresample
--disable-stripping --enable-version3 --enable-indev=v4l2
--enable-outdev=v4l2 --disable-indev=oss --disable-indev=jack
--disable-outdev=oss --enable-bzlib --disable-runtime-cpudetect
--disable-debug --disable-doc --disable-gnutls --enable-hardcoded-tables
--enable-iconv --enable-network --disable-openssl --enable-ffplay
--enable-vaapi --disable-vdpau --enable-zlib --enable-libvo-aacenc
--disable-libvo-amrwbenc --enable-libmp3lame --enable-libfaac
--enable-libtheora --disable-libtwolame --enable-libwavpack
--disable-libwebp --enable-libx264 --disable-libx265 --enable-libxvid
--disable-libcdio --disable-libiec61883 --disable-libdc1394
--disable-libcaca --disable-openal --enable-opengl --enable-libv4l2
--enable-libpulse --enable-x11grab --disable-libflite --enable-frei0r
--disable-fontconfig --disable-ladspa --disable-libass --enable-libfreetype
--disable-libsoxr --disable-pthreads --disable-libopencore-amrwb
--disable-libopencore-amrnb --disable-libfdk-aac --disable-libbluray
--disable-libcelt --disable-libgme --disable-libgsm --disable-libmodplug
--enable-libopus --disable-libquvi --disable-librtmp --disable-libssh
--disable-libschroedinger --enable-libspeex --enable-libvorbis
--disable-libvpx --disable-libzvbi --disable-armv5te --disable-armv6
--disable-armv6t2 --disable-neon --disable-vfp --disable-mips32r2
--disable-mipsdspr1 --disable-mipsdspr2 --disable-mipsfpu --disable-altivec
--disable-amd3dnow --disable-amd3dnowext --enable-avx --enable-avx2
--enable-fma3 --enable-fma4 --enable-mmxext --enable-sse3 --enable-ssse3
--enable-sse4 --enable-sse42 --cpu=host --enable-nonfree*
*  libavutil      54.  7.100 / 54.  7.100*
*  libavcodec     56.  1.100 / 56.  1.100*
*  libavformat    56.  3.100 / 56.  3.100*
*  libavdevice    56.  0.100 / 56.  0.100*
*  libavfilter     5.  0.103 /  5.  0.103*
*  libavresample   2.  1.  0 /  2.  1.  0*
*  libswscale      3.  0.100 /  3.  0.100*
*  libswresample   1.  1.100 /  1.  1.100*
*  libpostproc    53.  0.100 / 53.  0.100*
*[video4linux2,v4l2 @ 0xfb3e80] The v4l2 frame is 0 bytes, but 4147200
bytes are expected*
*Input #0, video4linux2,v4l2, from '/dev/video1':*
*  Duration: N/A, bitrate: 1990656 kb/s*
*    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080,
1990656 kb/s, 60 fps, 60 tbr, 1000k tbn, 1000k tbc*
*[pcm_s16le @ 0xfb5ea0] Warning: not compiled with thread support, using
thread emulation*
*Guessed Channel Layout for  Input Stream #1.0 : stereo*
*Input #1, alsa, from 'pulse':*
*  Duration: N/A, start: 1409951144.268999, bitrate: 1536 kb/s*
*    Stream #1:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s*
*No pixel format specified, yuv422p for H.264 encoding chosen.*
*Use -pix_fmt yuv420p for compatibility with outdated media players.*
*[libx264 @ 0xfd29a0] Warning: not compiled with thread support, using
thread emulation*
*[libx264 @ 0xfd29a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
AVX AVX2 FMA3 LZCNT BMI2*
*[libx264 @ 0xfd29a0] profile High 4:4:4 Predictive, level 4.2, 4:2:2 8-bit*
*[libx264 @ 0xfd29a0] 64 - core 142 - H.264/MPEG-4 AVC codec - Copyleft
2003-2014 - http://www.videolan.org/x264.html
<http://www.videolan.org/x264.html> - options: cabac=0 ref=1 deblock=0:0:0
analyse=0:0 me=dia subme=0 psy=0 mixed_ref=0 me_range=16 chroma_me=1
trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=0 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=0*
*[pcm_s16le @ 0xfd38c0] Warning: not compiled with thread support, using
thread emulation*
*[rawvideo @ 0xfb5040] Warning: not compiled with thread support, using
thread emulation*
*[pcm_s16le @ 0xfd14e0] Warning: not compiled with thread support, using
thread emulation*
*Output #0, matroska, to 'outfile3.mkv':*
*  Metadata:*
*    encoder         : Lavf56.3.100*
*    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv422p,
1920x1080, q=-1--1, 60 fps, 1k tbn, 60 tbc*
*    Metadata:*
*      encoder         : Lavc56.1.100 libx264*
*    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz,
stereo, s16, 1536 kb/s*
*    Metadata:*
*      encoder         : Lavc56.1.100 pcm_s16le*
*Stream mapping:*
*  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))*
*  Stream #1:0 -> #0:1 (pcm_s16le (native) -> pcm_s16le (native))*
*Press [q] to stop, [?] for help*
*[video4linux2,v4l2 @ 0xfb3e80] 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 size=       1kB time=00:00:00.47 bitrate=
 12.7kbits/sframe=    0 fps=0.0 q=0.0 size=       1kB time=00:00:00.96
bitrate=   6.3kbits/sframe=    0 fps=0.0 q=0.0 size=       1kB
time=00:00:01.47 bitrate=   4.1kbits/sframe=    0 fps=0.0 q=0.0 size=
1kB time=00:00:01.97 bitrate=   3.1kbits/sframe=    0 fps=0.0 q=0.0 Lsize=
    391kB time=00:00:02.02 bitrate=1585.6kbits/s    *
*video:0kB audio:380kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 2.976411%*
*[video4linux2,v4l2 @ 0xfb3e80] Some buffers are still owned by the caller
on close.*


More information about the ffmpeg-user mailing list