[FFmpeg-user] Use of the -t option with multiple output files.
William C Bonner
wimbonner at gmail.com
Sun Sep 1 21:16:00 CEST 2013
I was not losing my mind. I happened to remove the last patch (
https://trac.ffmpeg.org/attachment/ticket/2882/patchv4l2parseh264.diff except
with AVSTREAM_PARSE_HEADERS instead of AVSTREAM_PARSE_FULL) I applied and
the exact same command I was testing didn't quit encoding at the end of 20
seconds.
ffmpeg -f v4l2 -vcodec h264 -i /dev/video0 -copyinkf -vcodec copy -report
-y -t 20 test.mp4 -vcodec copy -f rtp -t 20 rtp://192.168.0.10:8090/
So I put the patch back in, retested it, and ffmpeg exited correctly. While
I like the results of the patch for both its intended purpose and this
functionality, it certainly shows why wide testing of patches is useful.
On Sat, Aug 31, 2013 at 3:16 PM, William C Bonner <wimbonner at gmail.com>wrote:
> I think I'm losing my mind now. I applied a patch related to the h264
> stream from Logitech C920 between when I started this thread and now. Then
> I just created the three log files below, the first writing to a local file
> for 20 seconds, the second streaming over the network for 20 seconds, and
> the third going in both direction for 20 seconds. I trimmed the middle of
> the streaming logs because the "rtp" seems to put lots of information in
> the log. Each report shows the command line, as well as how it parses.
>
> Now everything appears to stop correctly at 20 seconds. I don't know if
> the patch made any difference to this. I don't think it should, but I
> really don't want to spend more of my Saturday working on this.
>
> Here are a couple of report files:
>
> ffmpeg started on 2013-08-31 at 21:59:19
> Report written to "ffmpeg-20130831-215919.log"
> Command line:
> ffmpeg -f v4l2 -vcodec h264 -i /dev/video0 -copyinkf -vcodec copy -report
> -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 '-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 '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 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: 68731.055123, 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, 1000k 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 @ 0x112ea30] Non-monotonous DTS in output stream 0:0; previous: 0,
> current: -61985; changing to 1. This may result in incorrect timestamps in
> the output file.
> [mp4 @ 0x112ea30] Non-monotonous DTS in output stream 0:0; previous: 1,
> current: -29099; changing to 2. This may result in incorrect timestamps in
> the output file.
> [mp4 @ 0x112ea30] Non-monotonous DTS in output stream 0:0; previous:
> 102277, current: 33333; changing to 102278. This may result in incorrect
> timestamps in the output file.
> [mp4 @ 0x112ea30] Non-monotonous DTS in output stream 0:0; previous:
> 102278, current: 62919; changing to 102279. This may result in incorrect
> timestamps in the output file.
> [mp4 @ 0x112ea30] Non-monotonous DTS in output stream 0:0; previous:
> 102279, current: 92188; changing to 102280. This may result in incorrect
> timestamps in the output file.
> [mp4 @ 0x112ea30] Non-monotonous DTS in output stream 0:0; previous:
> 5835281, current: 5834961; changing to 5835282. This may result in
> incorrect timestamps in the output file.
> [mp4 @ 0x112ea30] Non-monotonous DTS in output stream 0:0; previous:
> 5856054, current: 5850994; changing to 5856055. This may result in
> incorrect timestamps in the output file.
> [NULL @ 0x1098880] Current profile doesn't provide more RBSP data in PPS,
> skipping
> [mp4 @ 0x112ea30] Non-monotonous DTS in output stream 0:0; previous:
> 10327582, current: 10319514; changing to 10327583. This may result in
> incorrect timestamps in the output file.
> [mp4 @ 0x112ea30] Non-monotonous DTS in output stream 0:0; previous:
> 12350461, current: 12346682; changing to 12350462. This may result in
> incorrect timestamps in the output file.
> [mp4 @ 0x112ea30] Non-monotonous DTS in output stream 0:0; previous:
> 14622450, current: 14615804; changing to 14622451. This may result in
> incorrect timestamps in the output file.
> [mp4 @ 0x112ea30] Non-monotonous DTS in output stream 0:0; previous:
> 16918632, current: 16918418; changing to 16918633. This may result in
> incorrect timestamps in the output file.
> [mp4 @ 0x112ea30] Non-monotonous DTS in output stream 0:0; previous:
> 17053197, current: 17052122; changing to 17053198. This may result in
> incorrect timestamps in the output file.
> [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:19.99
> bitrate=3077.8kbits/s
> video:7504kB audio:0kB subtitle:0 global headers:0kB muxing overhead
> 0.106255%
> 0 frames successfully decoded, 0 decoding errors
> [AVIOContext @ 0x113ff80] Statistics: 34 seeks, 634 writeouts
>
> ffmpeg started on 2013-08-31 at 22:00:20
> Report written to "ffmpeg-20130831-220020.log"
> Command line:
> ffmpeg -f v4l2 -vcodec h264 -i /dev/video0 -copyinkf -vcodec copy -report
> -y -t 20 -f rtp rtp://192.168.0.10:8090/
> 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 '-f' ... matched as option 'f' (force format) with argument
> 'rtp'.
> Reading option 'rtp://192.168.0.10:8090/' ... 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 @ 0x1098030] fd:4 capabilities:84000001
> [video4linux2,v4l2 @ 0x1098030] Current input_channel: 0, input_name:
> Camera 1
> [video4linux2,v4l2 @ 0x1098030] Querying the device for the current frame
> size
> [video4linux2,v4l2 @ 0x1098030] Setting frame size to 1280x720
> [h264 @ 0x1098890] Current profile doesn't provide more RBSP data in PPS,
> skipping
> [video4linux2,v4l2 @ 0x1098030] All info found
> Input #0, video4linux2,v4l2, from '/dev/video0':
> Duration: N/A, start: 68791.794510, 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 rtp://192.168.0.10:8090/.
> 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.
> Applying option f (force format) with argument rtp.
> Successfully parsed a group of options.
> Opening an output file: rtp://192.168.0.10:8090/.
> Successfully opened the file.
> Output #0, rtp, to 'rtp://192.168.0.10:8090/':
> 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
> [rtp @ 0x11325d0] Sending NAL 7 of len 37 M=0
> [rtp @ 0x11325d0] Sending NAL 8 of len 4 M=0
> [rtp @ 0x11325d0] Sending NAL 5 of len 7328 M=0
> [rtp @ 0x11325d0] NAL size 7328 > 1460
> [rtp @ 0x11325d0] Sending NAL 5 of len 7808 M=0
> [rtp @ 0x11325d0] NAL size 7808 > 1460
> [rtp @ 0x11325d0] Sending NAL 5 of len 6700 M=0
> [rtp @ 0x11325d0] NAL size 6700 > 1460
> [rtp @ 0x11325d0] Sending NAL 5 of len 2910 M=1
> [rtp @ 0x11325d0] NAL size 2910 > 1460
> [rtp @ 0x11325d0] Non-monotonous DTS in output stream 0:0; previous: 0,
> current: -6041; changing to 1. This may result in incorrect
> timestamps in the output file.
>
> [rtp @ 0x11325d0] Sending NAL 1 of len 3427 M=0=00:00:19.96
> bitrate=3101.7kbits/s
> [rtp @ 0x11325d0] NAL size 3427 > 1460
> [rtp @ 0x11325d0] Sending NAL 1 of len 3071 M=0
> [rtp @ 0x11325d0] NAL size 3071 > 1460
> [rtp @ 0x11325d0] Sending NAL 1 of len 3922 M=0
> [rtp @ 0x11325d0] NAL size 3922 > 1460
> [rtp @ 0x11325d0] Sending NAL 1 of len 1380 M=1
> [rtp @ 0x11325d0] Sending NAL 1 of len 3366 M=0
> [rtp @ 0x11325d0] NAL size 3366 > 1460
> [rtp @ 0x11325d0] Sending NAL 1 of len 2992 M=0
> [rtp @ 0x11325d0] NAL size 2992 > 1460
> [rtp @ 0x11325d0] Sending NAL 1 of len 4438 M=0
> [rtp @ 0x11325d0] NAL size 4438 > 1460
> [rtp @ 0x11325d0] Sending NAL 1 of len 948 M=1
> No more output streams to write to, finishing.
> frame= 606 fps= 31 q=-1.0 Lsize= 7584kB time=00:00:20.02
> bitrate=3102.1kbits/s
> video:7505kB audio:0kB subtitle:0 global headers:0kB muxing overhead
> 1.051934%
> 0 frames successfully decoded, 0 decoding errors
> [AVIOContext @ 0x1139370] Statistics: 0 seeks, 6654 writeouts
>
> ffmpeg started on 2013-08-31 at 22:07:26
> Report written to "ffmpeg-20130831-220726.log"
> Command line:
> ffmpeg -f v4l2 -vcodec h264 -i /dev/video0 -copyinkf -vcodec copy -report
> -y -t 20 test.mp4 -vcodec copy -f rtp -t 20 rtp://192.168.
> 0.10:8090/
> 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 'test.mp4' ... matched as output file.
> Reading option '-vcodec' ... matched as option 'vcodec' (force video codec
> ('copy' to copy stream)) with argument 'copy'.
> Reading option '-f' ... matched as option 'f' (force format) with argument
> 'rtp'.
> Reading option '-t' ... matched as option 't' (record or transcode
> "duration" seconds of audio/video) with argument '20'.
> Reading option 'rtp://192.168.0.10:8090/' ... 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 @ 0x109df50] fd:4 capabilities:84000001
> [video4linux2,v4l2 @ 0x109df50] Current input_channel: 0, input_name:
> Camera 1
> [video4linux2,v4l2 @ 0x109df50] Querying the device for the current frame
> size
> [video4linux2,v4l2 @ 0x109df50] Setting frame size to 1280x720
> [h264 @ 0x109e7b0] Current profile doesn't provide more RBSP data in PPS,
> skipping
> [video4linux2,v4l2 @ 0x109df50] All info found
> Input #0, video4linux2,v4l2, from '/dev/video0':
> Duration: N/A, start: 69218.589487, 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.
> Parsing a group of options: output file rtp://192.168.0.10:8090/.
> Applying option vcodec (force video codec ('copy' to copy stream)) with
> argument copy.
> Applying option f (force format) with argument rtp.
> Applying option t (record or transcode "duration" seconds of audio/video)
> with argument 20.
> Successfully parsed a group of options.
> Opening an output file: rtp://192.168.0.10:8090/.
> 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
> Output #1, rtp, to 'rtp://192.168.0.10:8090/':
> Metadata:
> encoder : Lavf55.15.100
> Stream #1: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)
> Stream #0:0 -> #1:0 (copy)
> Press [q] to stop, [?] for help
> [rtp @ 0x1130f40] Sending NAL 7 of len 37 M=0
> [rtp @ 0x1130f40] Sending NAL 8 of len 4 M=0
> [rtp @ 0x1130f40] Sending NAL 5 of len 7500 M=0
> [rtp @ 0x1130f40] NAL size 7500 > 1460
>
> [rtp @ 0x1130f40] Sending NAL 1 of len 3254 M=0kB time=00:00:19.96
> bitrate=2670.0kbits/s
> [rtp @ 0x1130f40] NAL size 3254 > 1460
> [rtp @ 0x1130f40] Sending NAL 1 of len 3316 M=0
> [rtp @ 0x1130f40] NAL size 3316 > 1460
> [rtp @ 0x1130f40] Sending NAL 1 of len 3774 M=0
> [rtp @ 0x1130f40] NAL size 3774 > 1460
> [rtp @ 0x1130f40] Sending NAL 1 of len 1698 M=1
> [rtp @ 0x1130f40] NAL size 1698 > 1460
> [rtp @ 0x1130f40] Sending NAL 1 of len 3334 M=0
> [rtp @ 0x1130f40] NAL size 3334 > 1460
> [rtp @ 0x1130f40] Sending NAL 1 of len 3153 M=0
> [rtp @ 0x1130f40] NAL size 3153 > 1460
> [rtp @ 0x1130f40] Sending NAL 1 of len 2794 M=0
> [rtp @ 0x1130f40] NAL size 2794 > 1460
> [rtp @ 0x1130f40] Sending NAL 1 of len 2662 M=1
> [rtp @ 0x1130f40] NAL size 2662 > 1460
> No more output streams to write to, finishing.
> frame= 528 fps= 27 q=-1.0 Lq=-1.0 size= 6539kB time=00:00:20.02
> bitrate=2674.5kbits/s
> video:13063kB audio:0kB subtitle:0 global headers:0kB muxing overhead
> -49.946109%
> 0 frames successfully decoded, 0 decoding errors
> [AVIOContext @ 0x113f9a0] Statistics: 34 seeks, 555 writeouts
> [AVIOContext @ 0x11304f0] Statistics: 0 seeks, 5745 writeouts
>
>
>
> On Sat, Aug 31, 2013 at 2:44 PM, Carl Eugen Hoyos <cehoyos at ag.or.at>wrote:
>
>> William C Bonner <wimbonner <at> gmail.com> writes:
>>
>> > ffmpeg -s 1280x720 -f v4l2 -vcodec h264 -i /dev/video0
>> > -copyinkf -vcodec copy -f rtp rtp://192.168.0.10:8090/
>> > -vcodec copy test.mp4
>> >
>> > I want it to only run for a set period of time. For
>> > testing I've been trying to use 30 seconds. What I've
>> > not been able to figure out is where is the
>> > appropriate place to put a "-t 30" in the command line.
>>
>> That depends on your use case.
>>
>> > When I was creating a single output file, I put it
>> > right before the name of the output and everything
>> > worked correctly.
>>
>> > If I duplicate the -t 30 in front of each file things
>> > work for the first 30 seconds, but then ffmpeg stops
>> > visibly outputting, but doesn't exit.
>>
>> Command line and complete, uncut console output missing.
>>
>> > If I put it before the -i (input) ffmpeg doesn't stop
>> > at 30 seconds.
>>
>> Command line and complete, uncut console output missing.
>>
>> Carl Eugen
>>
>> _______________________________________________
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>
>
More information about the ffmpeg-user
mailing list