[FFmpeg-user] FFMPeg reading from Logitech C920 generating H264 source produces empty output file
William C Bonner
wimbonner at gmail.com
Mon Jul 22 05:47:45 CEST 2013
I'm generally trying to do this in Linux, using the V4L2 interface, but I
decided to connect the webcam up to my windows desktop and test with dshow
and I got similar results, so I'm wondering if I'm doing something wrong,
or if this is a bug in FFMPEG? I find it interesting that FFMPEG seems to
acquire data when I'm asking it transcode and remux it, but it doesn't seem
to acquire it when all I'm asking it to do is to acquire and remux it.
In Windows I list devices, list options, and then try to stream video with
these commands:
ffmpeg -list_devices true -f dshow -i dummy
ffmpeg -f dshow -list_options true -i video="Logitech HD Pro Webcam C920"
ffmpeg -f dshow -vcodec h264 -s 1280x720 -i video="Logitech HD Pro Webcam
C920" -vcodec copy -y test.mp4
ffmpeg version N-54691-g7f4a1fd Copyright (c) 2000-2013 the FFmpeg
developers
built on Jul 12 2013 16:31:48 with gcc 4.7.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls -
-enable-iconv --enable-libass --enable-libbluray --enable-libcaca
--enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug
--enable-libmp3
lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-libopus --enable-librtmp
--enable-libschroedinger --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libx264
--enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 39.100 / 52. 39.100
libavcodec 55. 18.102 / 55. 18.102
libavformat 55. 12.102 / 55. 12.102
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 80.101 / 3. 80.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Input #0, dshow, from 'video=Logitech HD Pro Webcam C920':
Duration: N/A, start: 930235.000000, bitrate: N/A
Stream #0:0: Video: h264 (Constrained Baseline), yuvj420p, 1280x720
[SAR 1:1 DAR 16:9], 31.25 tbr, 10000k tbn, 60 tbc
Output #0, mp4, to 'test.mp4':
Metadata:
encoder : Lavf55.12.102
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuvj420p, 1280x720
[SAR 1:1 DAR 16:9], q=2-31, 10000k tbn, 10000k tbc
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame= 0 fps=0.0 q=-1.0 Lsize= 0kB time=00:00:00.00 bitrate=N/A
video:0kB audio:0kB subtitle:0 global headers:0kB muxing overhead inf%
Output file is empty, nothing was encoded (check -ss / -t / -frames
parameters if used)
If I do everything the same, except omit the "-vcodec copy" I get a decent
quality output file, and it reports that it's transcoding from h264 to
libx264 and uses a lot of CPU in the process.
ffmpeg -f dshow -vcodec h264 -s 1280x720 -i video="Logitech HD Pro Webcam
C920" -y test.mp4
ffmpeg version N-54691-g7f4a1fd Copyright (c) 2000-2013 the FFmpeg
developers
built on Jul 12 2013 16:31:48 with gcc 4.7.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls -
-enable-iconv --enable-libass --enable-libbluray --enable-libcaca
--enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug
--enable-libmp3
lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-libopus --enable-librtmp
--enable-libschroedinger --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libx264
--enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 39.100 / 52. 39.100
libavcodec 55. 18.102 / 55. 18.102
libavformat 55. 12.102 / 55. 12.102
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 80.101 / 3. 80.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Input #0, dshow, from 'video=Logitech HD Pro Webcam C920':
Duration: N/A, start: 930119.199000, bitrate: N/A
Stream #0:0: Video: h264 (Constrained Baseline), yuvj420p, 1280x720
[SAR 1:1 DAR 16:9], 31.25 tbr, 10000k tbn, 60 tbc
No pixel format specified, yuvj420p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0000000005fd1020] using SAR=1/1
[libx264 @ 0000000005fd1020] using cpu capabilities: MMX2 SSE2Fast SSSE3
Cache64 SlowShuffle
[libx264 @ 0000000005fd1020] profile High, level 3.2
[libx264 @ 0000000005fd1020] 264 - core 133 r2334 a3ac64b - H.264/MPEG-4
AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html -
options: caba
c=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1
psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1
cqm=0 deadzone=21,11
fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1
sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0
constrained_intra=0 bframes=3
b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2
keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf
mbtree=
1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'test.mp4':
Metadata:
encoder : Lavf55.12.102
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj420p,
1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 16k tbn, 31.25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> libx264)
Press [q] to stop, [?] for help
frame= 911 fps= 30 q=-1.0 Lsize= 4253kB time=00:00:29.08
bitrate=1197.7kbits/s dup=226 drop=0
video:4243kB audio:0kB subtitle:0 global headers:0kB muxing overhead
0.229996%
[libx264 @ 0000000005fd1020] frame I:17 Avg QP:18.05 size: 21517
[libx264 @ 0000000005fd1020] frame P:423 Avg QP:21.14 size: 7715
[libx264 @ 0000000005fd1020] frame B:471 Avg QP:23.06 size: 1518
[libx264 @ 0000000005fd1020] consecutive B-frames: 28.9% 6.1% 1.3% 63.7%
[libx264 @ 0000000005fd1020] mb I I16..4: 49.1% 45.3% 5.6%
[libx264 @ 0000000005fd1020] mb P I16..4: 9.1% 6.2% 0.3% P16..4: 37.8%
3.6% 3.1% 0.0% 0.0% skip:40.0%
[libx264 @ 0000000005fd1020] mb B I16..4: 0.2% 0.2% 0.0% B16..8: 29.3%
0.4% 0.0% direct: 0.9% skip:69.0% L0:47.3% L1:52.2% BI: 0.6%
[libx264 @ 0000000005fd1020] 8x8 transform intra:40.8% inter:78.3%
[libx264 @ 0000000005fd1020] coded y,uvDC,uvAC intra: 18.0% 49.1% 9.9%
inter: 4.1% 16.1% 0.5%
[libx264 @ 0000000005fd1020] i16 v,h,dc,p: 41% 22% 17% 21%
[libx264 @ 0000000005fd1020] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 17% 41% 2%
4% 4% 3% 2% 2%
[libx264 @ 0000000005fd1020] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 24% 18% 4%
8% 7% 4% 2% 4%
[libx264 @ 0000000005fd1020] i8c dc,h,v,p: 56% 21% 21% 2%
[libx264 @ 0000000005fd1020] Weighted P-Frames: Y:3.1% UV:1.7%
[libx264 @ 0000000005fd1020] ref P L0: 69.7% 3.4% 19.0% 7.7% 0.1%
[libx264 @ 0000000005fd1020] ref B L0: 87.7% 9.4% 2.9%
[libx264 @ 0000000005fd1020] ref B L1: 95.4% 4.6%
[libx264 @ 0000000005fd1020] kb/s:1192.13
Here's the similar command in linux with a recent build of FFMPEG showing
similar results, and heavily using the CPU, which is what I'm trying to
avoid.
ffmpeg -f video4linux2 -list_formats all -i /dev/video0
ffmpeg -report -f v4l2 -s 1280x720 -vcodec h264 -i /dev/video0 -vcodec copy
-y test.mp4
ffmpeg started on 2000-01-01 at 00:34:54
Report written to "ffmpeg-20000101-003454.log"ffmpeg version
N-54692-gdd1382a Copyright (c) 2000-2013 the FFmpeg developers
built on Jul 13 2013 05:15:21 with gcc 4.7.3 (Linaro GCC 4.7-2013.02-01)
20130205 (prerelease)
configuration: --enable-gpl --enable-libx264
libavutil 52. 39.100 / 52. 39.100
libavcodec 55. 18.102 / 55. 18.102
libavformat 55. 12.102 / 55. 12.102
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 80.101 / 3. 80.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Input #0, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 135.904141, bitrate: N/A
Stream #0:0: Video: h264 (Constrained Baseline), yuvj420p, 1280x720
[SAR 1:1 DAR 16:9], -5 kb/s, 30 fps, 30 tbr, 1000k tbn, 60 tbc
Output #0, mp4, to 'test.mp4':
Metadata:
encoder : Lavf55.12.102
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuvj420p, 1280x720
[SAR 1:1 DAR 16:9], q=2-31, -5 kb/s, 30 fps, 1000k tbn, 1000k tbc
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame= 0 fps=0.0 q=-1.0 Lsize= 0kB time=00:00:00.00 bitrate=N/A
video:0kB audio:0kB subtitle:0 global headers:0kB muxing overhead inf%
Output file is empty, nothing was encoded (check -ss / -t / -frames
parameters if used)
ffmpeg -report -f v4l2 -s 1280x720 -vcodec h264 -i /dev/video0 -y test.mp4
ffmpeg started on 2000-01-01 at 00:36:27
Report written to "ffmpeg-20000101-003627.log"
ffmpeg version N-54692-gdd1382a Copyright (c) 2000-2013 the FFmpeg
developers
built on Jul 13 2013 05:15:21 with gcc 4.7.3 (Linaro GCC 4.7-2013.02-01)
20130205 (prerelease)
configuration: --enable-gpl --enable-libx264
libavutil 52. 39.100 / 52. 39.100
libavcodec 55. 18.102 / 55. 18.102
libavformat 55. 12.102 / 55. 12.102
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 80.101 / 3. 80.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Input #0, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 229.309265, bitrate: N/A
Stream #0:0: Video: h264 (Constrained Baseline), yuvj420p, 1280x720
[SAR 1:1 DAR 16:9], -5 kb/s, 30 fps, 30 tbr, 1000k tbn, 60 tbc
No pixel format specified, yuvj420p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x10ebf40] using SAR=1/1
[libx264 @ 0x10ebf40] using cpu capabilities: ARMv6 NEON
[libx264 @ 0x10ebf40] profile High, level 3.1
[libx264 @ 0x10ebf40] 264 - core 133 r2334 a3ac64b - H.264/MPEG-4 AVC codec
- Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1
ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11
fast_pskip=1 chroma_qp_offset=-2 threads=1 lookahead_threads=1
sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0
constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1
weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40
intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0
qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'test.mp4':
Metadata:
encoder : Lavf55.12.102
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj420p,
1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 15360 tbn, 30 tbc
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> libx264)
Press [q] to stop, [?] for help
frame= 86 fps=2.0 q=29.0 Lsize= 137kB time=00:00:02.80 bitrate=
402.1kbits/s dup=75 drop=0
video:136kB audio:0kB subtitle:0 global headers:0kB muxing overhead
1.240864%
[libx264 @ 0x10ebf40] frame I:1 Avg QP:19.67 size: 7304
[libx264 @ 0x10ebf40] frame P:33 Avg QP:17.52 size: 3784
[libx264 @ 0x10ebf40] frame B:52 Avg QP:27.16 size: 118
[libx264 @ 0x10ebf40] consecutive B-frames: 18.6% 2.3% 0.0% 79.1%
[libx264 @ 0x10ebf40] mb I I16..4: 84.5% 11.4% 4.2%
[libx264 @ 0x10ebf40] mb P I16..4: 6.7% 3.4% 0.3% P16..4: 13.0% 1.3%
1.0% 0.0% 0.0% skip:74.3%
[libx264 @ 0x10ebf40] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 2.3% 0.0%
0.0% direct: 0.1% skip:97.6% L0:62.1% L1:37.4% BI: 0.5%
[libx264 @ 0x10ebf40] 8x8 transform intra:28.1% inter:67.4%
[libx264 @ 0x10ebf40] coded y,uvDC,uvAC intra: 13.0% 22.4% 5.0% inter: 1.3%
3.2% 0.3%
[libx264 @ 0x10ebf40] i16 v,h,dc,p: 53% 30% 15% 2%
[libx264 @ 0x10ebf40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 18% 58% 1% 2%
1% 1% 1% 2%
[libx264 @ 0x10ebf40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 20% 23% 4% 5%
4% 3% 3% 2%
[libx264 @ 0x10ebf40] i8c dc,h,v,p: 67% 18% 14% 0%
[libx264 @ 0x10ebf40] Weighted P-Frames: Y:9.1% UV:9.1%
[libx264 @ 0x10ebf40] ref P L0: 80.6% 5.4% 9.5% 4.2% 0.4%
[libx264 @ 0x10ebf40] ref B L0: 77.6% 21.9% 0.5%
[libx264 @ 0x10ebf40] ref B L1: 96.4% 3.6%
[libx264 @ 0x10ebf40] kb/s:385.92
More information about the ffmpeg-user
mailing list