[FFmpeg-user] FFMPeg reading from Logitech C920 generating H264 source produces empty output file

William C Bonner wimbonner at gmail.com
Sat Aug 31 23:53:24 CEST 2013


Here's a local file example command that creates a test.mp4 file from the
C920 without transcoding. I added -y -t 20 to simplify the testing.

ffmpeg -report -s 1280x720 -f v4l2 -vcodec h264 -i /dev/video0 -copyinkf
-vcodec copy -y -t 20 test.mp4

It sometimes produces a bunch of error messages:
[mp4 @ 0x111aac0] Non-monotonous DTS in output stream 0:0; previous:
202760, current: 136127; changing to 202761. This may result in incorrect
timestamps in the output file.

I looked at https://trac.ffmpeg.org/ticket/2882 as well as looking at the
patch submitted. (
https://trac.ffmpeg.org/attachment/ticket/2882/patchv4l2parseh264.diff)

I just now manually installed the patch in my local copy of the source and
rebuilt ffmpeg. Now things seem to work with or without the -copyinfk flag.

Here's three report files, the last being one outputing an h264 file
instead of mp4.

ffmpeg started on 2013-08-31 at 21:39:21
Report written to "ffmpeg-20130831-213921.log"
Command line:
ffmpeg -report -s 1280x720 -f v4l2 -vcodec h264 -i /dev/video0 -copyinkf
-vcodec copy -y -t 20 test.mp4
ffmpeg version N-55922-g454a11a Copyright (c) 2000-2013 the FFmpeg
developers
  built on Aug 31 2013 01:46:23 with gcc 4.7.3 (Linaro GCC 4.7-2013.02-01)
20130205 (prerelease)
  configuration: --prefix=/usr --enable-gpl --enable-libx264
  libavutil      52. 43.100 / 52. 43.100
  libavcodec     55. 29.100 / 55. 29.100
  libavformat    55. 15.100 / 55. 15.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 82.102 /  3. 82.102
  libswscale      2.  5.100 /  2.  5.100
  libswresample   0. 17.103 /  0. 17.103
  libpostproc    52.  3.100 / 52.  3.100
Splitting the commandline.
Reading option '-report' ... matched as option 'report' (generate a report)
with argument '1'.
Reading option '-s' ... matched as option 's' (set frame size (WxH or
abbreviation)) with argument '1280x720'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'v4l2'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec
('copy' to copy stream)) with argument 'h264'.
Reading option '-i' ... matched as input file with argument '/dev/video0'.
Reading option '-copyinkf' ... matched as option 'copyinkf' (copy initial
non-keyframes) with argument '1'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec
('copy' to copy stream)) with argument 'copy'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with
argument '1'.
Reading option '-t' ... matched as option 't' (record or transcode
"duration" seconds of audio/video) with argument '20'.
Reading option 'test.mp4' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file /dev/video0.
Applying option s (set frame size (WxH or abbreviation)) with argument
1280x720.
Applying option f (force format) with argument v4l2.
Applying option vcodec (force video codec ('copy' to copy stream)) with
argument h264.
Successfully parsed a group of options.
Opening an input file: /dev/video0.
[video4linux2,v4l2 @ 0x1098020] fd:4 capabilities:84000001
[video4linux2,v4l2 @ 0x1098020] Current input_channel: 0, input_name:
Camera 1
[h264 @ 0x10989d0] Current profile doesn't provide more RBSP data in PPS,
skipping
[video4linux2,v4l2 @ 0x1098020] All info found
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 67532.978161, bitrate: N/A
    Stream #0:0, 8, 1/1000000: Video: h264 (Constrained Baseline),
yuvj420p, 1280x720 [SAR 1:1 DAR 16:9], -5 kb/s, 30 fps, 30 tbr, 1
000k tbn, 60 tbc
Successfully opened the file.
Parsing a group of options: output file test.mp4.
Applying option copyinkf (copy initial non-keyframes) with argument 1.
Applying option vcodec (force video codec ('copy' to copy stream)) with
argument copy.
Applying option t (record or transcode "duration" seconds of audio/video)
with argument 20.
Successfully parsed a group of options.
Opening an output file: test.mp4.
Successfully opened the file.
Output #0, mp4, to 'test.mp4':
  Metadata:
    encoder         : Lavf55.15.100
    Stream #0:0, 0, 1/1000000: 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
[mp4 @ 0x10e2060] Non-monotonous DTS in output stream 0:0; previous: 0,
current: -66915; changing to 1. This may result in incorrect
 timestamps in the output file.
[mp4 @ 0x10e2060] Non-monotonous DTS in output stream 0:0; previous: 1,
current: -33840; changing to 2. This may result in incorrect
 timestamps in the output file.
[mp4 @ 0x10e2060] Non-monotonous DTS in output stream 0:0; previous: 2,
current: -849; changing to 3. This may result in incorrect t
imestamps in the output file.
[mp4 @ 0x10e2060] Non-monotonous DTS in output stream 0:0; previous: 64404,
current: 3549; changing to 64405. This may result in inc
orrect timestamps in the output file.
[mp4 @ 0x10e2060] Non-monotonous DTS in output stream 0:0; previous: 64405,
current: 33333; changing to 64406. This may result in in
correct timestamps in the output file.
[mp4 @ 0x10e2060] Non-monotonous DTS in output stream 0:0; previous: 64406,
current: 63033; changing to 64407. This may result in in
correct timestamps in the output file.
frame=  121 fps= 35 q=-1.0 size=    1355kB time=00:00:03.50
bitrate=3167.2kbits/s
[mp4 @ 0x10e2060] Non-monotonous DTS in output stream 0:0; previous:
5891441, current: 5848004; changing to 5891442. This may result
 in incorrect timestamps in the output file.
[mp4 @ 0x10e2060] Non-monotonous DTS in output stream 0:0; previous:
5891442, current: 5877547; changing to 5891443. This may result
 in incorrect timestamps in the output file.
[mp4 @ 0x10e2060] Non-monotonous DTS in output stream 0:0; previous:
7915502, current: 7909242; changing to 7915503. This may result
 in incorrect timestamps in the output file.
[NULL @ 0x10989d0] Current profile doesn't provide more RBSP data in PPS,
skipping
[mp4 @ 0x10e2060] Non-monotonous DTS in output stream 0:0; previous:
10297665, current: 10294977; changing to 10297666. This may res
ult in incorrect timestamps in the output file.
No more output streams to write to, finishing.e=00:00:11.34
bitrate=3129.1kbits/s
frame=  348 fps= 29 q=-1.0 Lsize=    4339kB time=00:00:11.34
bitrate=3132.6kbits/s
video:4334kB audio:0kB subtitle:0 global headers:0kB muxing overhead
0.112955%
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x113a180] Statistics: 34 seeks, 375 writeouts


ffmpeg started on 2013-08-31 at 21:40:30Report written to
"ffmpeg-20130831-214030.log"
Command line:
ffmpeg -report -s 1280x720 -f v4l2 -vcodec h264 -i /dev/video0 -vcodec copy
-y -t 20 test.mp4
ffmpeg version N-55922-g454a11a Copyright (c) 2000-2013 the FFmpeg
developers
  built on Aug 31 2013 01:46:23 with gcc 4.7.3 (Linaro GCC 4.7-2013.02-01)
20130205 (prerelease)
  configuration: --prefix=/usr --enable-gpl --enable-libx264
  libavutil      52. 43.100 / 52. 43.100
  libavcodec     55. 29.100 / 55. 29.100
  libavformat    55. 15.100 / 55. 15.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 82.102 /  3. 82.102
  libswscale      2.  5.100 /  2.  5.100
  libswresample   0. 17.103 /  0. 17.103
  libpostproc    52.  3.100 / 52.  3.100
Splitting the commandline.
Reading option '-report' ... matched as option 'report' (generate a report)
with argument '1'.
Reading option '-s' ... matched as option 's' (set frame size (WxH or
abbreviation)) with argument '1280x720'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'v4l2'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec
('copy' to copy stream)) with argument 'h264'.
Reading option '-i' ... matched as input file with argument '/dev/video0'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec
('copy' to copy stream)) with argument 'copy'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with
argument '1'.
Reading option '-t' ... matched as option 't' (record or transcode
"duration" seconds of audio/video) with argument '20'.
Reading option 'test.mp4' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file /dev/video0.
Applying option s (set frame size (WxH or abbreviation)) with argument
1280x720.
Applying option f (force format) with argument v4l2.
Applying option vcodec (force video codec ('copy' to copy stream)) with
argument h264.
Successfully parsed a group of options.
Opening an input file: /dev/video0.
[video4linux2,v4l2 @ 0x1098020] fd:4 capabilities:84000001
[video4linux2,v4l2 @ 0x1098020] Current input_channel: 0, input_name:
Camera 1
[h264 @ 0x10989d0] Current profile doesn't provide more RBSP data in PPS,
skipping
[video4linux2,v4l2 @ 0x1098020] All info found
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 67602.272846, bitrate: N/A
    Stream #0:0, 8, 1/1000000: Video: h264 (Constrained Baseline),
yuvj420p, 1280x720 [SAR 1:1 DAR 16:9], -5 kb/s, 30 fps, 30 tbr, 1
000k tbn, 60 tbc
Successfully opened the file.
Parsing a group of options: output file test.mp4.
Applying option vcodec (force video codec ('copy' to copy stream)) with
argument copy.
Applying option t (record or transcode "duration" seconds of audio/video)
with argument 20.
Successfully parsed a group of options.
Opening an output file: test.mp4.
Successfully opened the file.
Output #0, mp4, to 'test.mp4':
  Metadata:
    encoder         : Lavf55.15.100
    Stream #0:0, 0, 1/1000000: 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
[mp4 @ 0x10e1df0] Non-monotonous DTS in output stream 0:0; previous: 0,
current: -67749; changing to 1. This may result in incorrect
 timestamps in the output file.
[mp4 @ 0x10e1df0] Non-monotonous DTS in output stream 0:0; previous: 1,
current: -35520; changing to 2. This may result in incorrect
 timestamps in the output file.
[mp4 @ 0x10e1df0] Non-monotonous DTS in output stream 0:0; previous: 68806,
current: 2950; changing to 68807. This may result in inc
orrect timestamps in the output file.
[mp4 @ 0x10e1df0] Non-monotonous DTS in output stream 0:0; previous: 68807,
current: 33333; changing to 68808. This may result in in
correct timestamps in the output file.
[mp4 @ 0x10e1df0] Non-monotonous DTS in output stream 0:0; previous: 68808,
current: 62767; changing to 68809. This may result in in
correct timestamps in the output file.
[mp4 @ 0x10 fps= 35 q=-1.0 size=    1357kB time=00:00:03.52
bitrate=3151.3kbits/s
1df0] Non-monotonous DTS in output stream 0:0; previous: 3624926, current:
3613914; changing to 3624927. This may result in incorrec
t timestamps in the output file.
[mp4 @ 0x10e1df0] Non-monotonous DTS in output stream 0:0; previous:
5835696, current: 5828676; changing to 5835697. This may result
 in incorrect timestamps in the output file.
[mp4 @ 0x10e1df0] Non-monotonous DTS in output stream 0:0; previous:
5859518, current: 5847887; changing to 5859519. This may result
 in incorrect timestamps in the output file.
[mp4 @ 0x10e1df0] Non-monotonous DTS in output stream 0:0; previous:
7908361, current: 7903403; changing to 7908362. This may result
 in incorrect timestamps in the output file.
[NULL @ 0x10989d0] Current profile doesn't provide more RBSP data in PPS,
skipping
frame=  406 fps= 31 q=-1.0 size=    4858kB time=00:00:12.87
bitrate=3091.8kbits/s
frame=  498 fps= 31 q=-1.0 size=    5969kB time=00:00:15.81
bitrate=3092.2kbits/s
[mp4 @ 0x10e1df0] Non-monotonous DTS in output stream 0:0; previous:
16874078, current: 16872688; changing to 16874079. This may res
ult in incorrect timestamps in the output file.
[NULL @ 0x1 fps= 31 q=-1.0 size=    7279kB time=00:00:19.48
bitrate=3060.6kbits/s
989d0] Current profile doesn't provide more RBSP data in PPS, skipping
No more output streams to write to, finishing.e=00:00:19.92
bitrate=3078.5kbits/s
frame=  606 fps= 31 q=-1.0 Lsize=    7519kB time=00:00:19.98
bitrate=3082.1kbits/s
video:7511kB audio:0kB subtitle:0 global headers:0kB muxing overhead
0.106004%
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x1139a50] Statistics: 34 seeks, 634 writeouts

ffmpeg started on 2013-08-31 at 21:50:20
Report written to "ffmpeg-20130831-215020.log"
Command line:
ffmpeg -f v4l2 -vcodec h264 -i /dev/video0 -copyinkf -vcodec copy -report
-y -t 20 out.h264
ffmpeg version N-55922-g454a11a Copyright (c) 2000-2013 the FFmpeg
developers
  built on Aug 31 2013 01:46:23 with gcc 4.7.3 (Linaro GCC 4.7-2013.02-01)
20130205 (prerelease)
  configuration: --prefix=/usr --enable-gpl --enable-libx264
  libavutil      52. 43.100 / 52. 43.100
  libavcodec     55. 29.100 / 55. 29.100
  libavformat    55. 15.100 / 55. 15.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 82.102 /  3. 82.102
  libswscale      2.  5.100 /  2.  5.100
  libswresample   0. 17.103 /  0. 17.103
  libpostproc    52.  3.100 / 52.  3.100
Splitting the commandline.
Reading option '-f' ... matched as option 'f' (force format) with argument
'v4l2'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec
('copy' to copy stream)) with argument 'h264'.
Reading option '-i' ... matched as input file with argument '/dev/video0'.
Reading option '-copyinkf' ... matched as option 'copyinkf' (copy initial
non-keyframes) with argument '1'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec
('copy' to copy stream)) with argument 'copy'.
Reading option '-report' ... matched as option 'report' (generate a report)
with argument '1'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with
argument '1'.
Reading option '-t' ... matched as option 't' (record or transcode
"duration" seconds of audio/video) with argument '20'.
Reading option 'out.h264' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file /dev/video0.
Applying option f (force format) with argument v4l2.
Applying option vcodec (force video codec ('copy' to copy stream)) with
argument h264.
Successfully parsed a group of options.
Opening an input file: /dev/video0.
[video4linux2,v4l2 @ 0x1098020] fd:4 capabilities:84000001
[video4linux2,v4l2 @ 0x1098020] Current input_channel: 0, input_name:
Camera 1
[video4linux2,v4l2 @ 0x1098020] Querying the device for the current frame
size
[video4linux2,v4l2 @ 0x1098020] Setting frame size to 1280x720
[h264 @ 0x1098880] Current profile doesn't provide more RBSP data in PPS,
skipping
[video4linux2,v4l2 @ 0x1098020] All info found
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 68191.750827, bitrate: N/A
    Stream #0:0, 8, 1/1000000: Video: h264 (Constrained Baseline),
yuvj420p, 1280x720 [SAR 1:1 DAR 16:9], -5 kb/s, 30 fps, 30 tbr, 1
000k tbn, 60 tbc
Successfully opened the file.
Parsing a group of options: output file out.h264.
Applying option copyinkf (copy initial non-keyframes) with argument 1.
Applying option vcodec (force video codec ('copy' to copy stream)) with
argument copy.
Applying option t (record or transcode "duration" seconds of audio/video)
with argument 20.
Successfully parsed a group of options.
Opening an output file: out.h264.
Successfully opened the file.
Output #0, h264, to 'out.h264':
  Metadata:
    encoder         : Lavf55.15.100
    Stream #0:0, 0, 1/90000: Video: h264, yuvj420p, 1280x720 [SAR 1:1 DAR
16:9], q=2-31, -5 kb/s, 30 fps, 90k tbn, 30 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[h264 @ 0x10dded0] Application provided invalid, non monotonically
increasing dts to muxer in stream 0: 6262 >= 340
[h264 @ 0x10dded0] Application provided invalid, non monotonically
increasing dts to muxer in stream 0: 6262 >= 3000
[h264 @ 0x10dded0] Application provided invalid, non monotonically
increasing dts to muxer in stream 0: 6262 >= 5653
[h264 @ 0x10dded0] Application provided invalid, non monotonically
increasing dts to muxer in stream 0: 125079 >= 124360
[h264 @ 0x10dded0] Application provided invalid, non monotonically
increasing dts to muxer in str
am 0: 326116 >= 325444
frame=  212 fps= 32 q=-1.0 size=    2472kB time=00:00:06.41
bitrate=3156.4kbits/s
[h264 @ 0x10dded0] Application provided invalid, non monotonically
increasing dts to muxer in stream 0: 713881 >= 713620
[NULL @ 0x1098880] Current profile doesn't provide more RBSP data in PPS,
skipping
[h264 @ 0x10dded0] Application provided invalid, non monotonically
increasing dts to muxer in stream 0: 919585 >= 917567
[h264 @ 0x10dded0] Application provided invalid, non monotonically
increasing dts to muxer in stream 0: 919585 >= 918262
[h264 @ 0x10dded0] Application provided invalid, non monotonically
increasing dts to muxer in stream 0: 1114481 >= 1114054
[h264 @ 0x10dded0] Application provided invalid, non monotonically
increasing dts to muxer in stream 0: 1118358 >= 1118248
[h264 @ 0x10dded0] Application provided invalid, non monotonically
increasing dts to muxer in str
am 0: 1325028 >= 1323257
[h264 @ 0x10dded0] Application provided invalid, non monotonically
increasing dts to muxer in stream 0: 1531328 >= 1530286
[h264 @ 0x10dded0] Application provided invalid, non monotonically
increasing dts to muxer in str
am 0: 1739153 >= 1738400
[NULL @ 0x1098880] Current profile doesn't provide more RBSP data in PPS,
skipping
No more output streams to write to, finishing.
frame=  606 fps= 31 q=-1.0 Lsize=    7512kB time=00:00:20.02
bitrate=3072.5kbits/s
video:7512kB audio:0kB subtitle:0 global headers:0kB muxing overhead
0.000000%
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x1135fc0] Statistics: 0 seeks, 608 writeouts


More information about the ffmpeg-user mailing list