Opened 10 years ago
Closed 9 years ago
#5719 closed defect (fixed)
Using -stream_loop is wrong duration output
| Reported by: | nicol | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | ffmpeg |
| Version: | git-master | Keywords: | stream_loop |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | yes | |
| Analyzed by developer: | no |
Description
Summary of the bug: Codec copy or re encode using -stream_loop option wrong output duration time, but output frames is fine.
How to reproduce:
Create sample file.
ffmpeg -f lavfi -i testsrc2=d=1 -f lavfi -i anullsrc=r=48000:cl=stereo -shortest -vcodec libx264 -acodec aac sample.mkv
Then use stream_loop option.
Output is fine.
ffmpeg.exe -stream_loop 1 -i sample.mkv -vcodec copy sample-v-copy.mp4 -y
ffmpeg.exe -stream_loop 1 -i sample.mkv sample-no-copy.mp4 -y
Wrong output duration time.
L:\>ffmpeg.exe -v 9 -loglevel 99 -stream_loop 1 -i sample.mkv -c copy sample-c-copy.mp4 -y
ffmpeg version N-80999-gf41e37b Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.4.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 50.100 / 57. 50.100
libavformat 57. 41.100 / 57. 41.100
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 47.100 / 6. 47.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-stream_loop' ... matched as option 'stream_loop' (set number of times input stream shall be looped) with argument '1'.
Reading option '-i' ... matched as input file with argument 'sample.mkv'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option 'sample-c-copy.mp4' ... matched as output file.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file sample.mkv.
Applying option stream_loop (set number of times input stream shall be looped) with argument 1.
Successfully parsed a group of options.
Opening an input file: sample.mkv.
[file @ 02fe82a0] Setting default whitelist 'file,crypto'
Probing matroska,webm score:100 size:2048
Probing mp3 score:1 size:2048
[matroska,webm @ 02fe7bc0] Format matroska,webm probed with size=2048 and score=100
st:0 removing common factor 1000000 from timebase
st:1 removing common factor 1000000 from timebase
[matroska,webm @ 02fe7bc0] Before avformat_find_stream_info() pos: 912 bytes read:32768 seeks:0 nb_streams:2
[h264 @ 05020440] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 05020440] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 05020440] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 05020440] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 05020440] user data:"x264 - core 148 r2705 3f5ed56 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=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"
[h264 @ 05020440] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 05020440] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 05020440] user data:"x264 - core 148 r2705 3f5ed56 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=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"
[h264 @ 05020440] Reinit context to 320x240, pix_fmt: yuv420p
[h264 @ 05020440] no picture
[matroska,webm @ 02fe7bc0] All info found
[matroska,webm @ 02fe7bc0] stream 0: start_time: 0.000 duration: -9223372036854776.000
[matroska,webm @ 02fe7bc0] stream 1: start_time: 0.000 duration: -9223372036854776.000
[matroska,webm @ 02fe7bc0] format: start_time: 0.000 duration: 1.023 bitrate=293 kb/s
[matroska,webm @ 02fe7bc0] After avformat_find_stream_info() pos: 10935 bytes read:32768 seeks:0 frames:7
Input #0, matroska,webm, from 'sample.mkv':
Metadata:
ENCODER : Lavf57.41.100
Duration: 00:00:01.02, start: 0.000000, bitrate: 293 kb/s
Stream #0:0, 4, 1/1000: Video: h264 (High), 1 reference frame, yuv420p(left), 320x240 [SAR 1:1 DAR 4:3], 0/1, 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
Metadata:
ENCODER : Lavc57.50.100 libx264
DURATION : 00:00:01.021000000
Stream #0:1, 3, 1/1000: Audio: aac (LC), 48000 Hz, stereo, fltp (default)
Metadata:
ENCODER : Lavc57.50.100 aac
DURATION : 00:00:01.023000000
Successfully opened the file.
Parsing a group of options: output file sample-c-copy.mp4.
Applying option c (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: sample-c-copy.mp4.
[file @ 050e4f60] Setting default whitelist 'file,crypto'
Successfully opened the file.
[mp4 @ 0500f8e0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Last message repeated 1 times
Output #0, mp4, to 'sample-c-copy.mp4':
Metadata:
encoder : Lavf57.41.100
Stream #0:0, 0, 1/16000: Video: h264, 1 reference frame ([33][0][0][0] / 0x0021), yuv420p(left), 320x240 (0x0) [SAR 1:1 DAR 4:3], 0/1, q=2-31, 25 fps, 25 tbr, 16k tbn, 1k tbc (default)
Metadata:
ENCODER : Lavc57.50.100 libx264
DURATION : 00:00:01.021000000
Stream #0:1, 0, 1/48000: Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo (default)
Metadata:
ENCODER : Lavc57.50.100 aac
DURATION : 00:00:01.023000000
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
Last message repeated 3 times
[NULL @ 05020440] nal_unit_type: 7, nal_ref_idc: 3
[NULL @ 05020440] nal_unit_type: 8, nal_ref_idc: 3
[NULL @ 05020440] user data:"x264 - core 148 r2705 3f5ed56 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=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"
[mp4 @ 0500f8e0] Delay between the first packet and last packet in the muxing queue is 24999833 > 10000000: forcing output
[mp4 @ 0500f8e0] Delay between the first packet and last packet in the muxing queue is 24978500 > 10000000: forcing output
No more output streams to write to, finishing.
frame= 50 fps=0.0 q=-1.0 Lsize= 74kB time=00:00:27.00 bitrate= 22.3kbits/s speed=1.38e+003x
video:70kB audio:1kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 4.264328%
Input file #0 (sample.mkv):
Input stream #0:0 (video): 50 packets read (71664 bytes);
Input stream #0:1 (audio): 96 packets read (610 bytes);
Total: 146 packets (72274 bytes) demuxed
Output file #0 (sample-c-copy.mp4):
Output stream #0:0 (video): 50 packets muxed (71664 bytes);
Output stream #0:1 (audio): 96 packets muxed (610 bytes);
Total: 146 packets (72274 bytes) muxed
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0506f1c0] Statistics: 60 seeks, 191 writeouts
[AVIOContext @ 02fecda0] Statistics: 110840 bytes read, 2 seeks
Wrong output duration time.
L:\>ffmpeg.exe -v 9 -loglevel 99 -stream_loop 1 -i sample.mkv -c copy sample-c-copy.mp4 -y
ffmpeg version N-80999-gf41e37b Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.4.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 50.100 / 57. 50.100
libavformat 57. 41.100 / 57. 41.100
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 47.100 / 6. 47.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-stream_loop' ... matched as option 'stream_loop' (set number of times input stream shall be looped) with argument '1'.
Reading option '-i' ... matched as input file with argument 'sample.mkv'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option 'sample-c-copy.mp4' ... matched as output file.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file sample.mkv.
Applying option stream_loop (set number of times input stream shall be looped) with argument 1.
Successfully parsed a group of options.
Opening an input file: sample.mkv.
[file @ 02fe82a0] Setting default whitelist 'file,crypto'
Probing matroska,webm score:100 size:2048
Probing mp3 score:1 size:2048
[matroska,webm @ 02fe7bc0] Format matroska,webm probed with size=2048 and score=100
st:0 removing common factor 1000000 from timebase
st:1 removing common factor 1000000 from timebase
[matroska,webm @ 02fe7bc0] Before avformat_find_stream_info() pos: 912 bytes read:32768 seeks:0 nb_streams:2
[h264 @ 05020440] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 05020440] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 05020440] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 05020440] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 05020440] user data:"x264 - core 148 r2705 3f5ed56 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=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"
[h264 @ 05020440] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 05020440] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 05020440] user data:"x264 - core 148 r2705 3f5ed56 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=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"
[h264 @ 05020440] Reinit context to 320x240, pix_fmt: yuv420p
[h264 @ 05020440] no picture
[matroska,webm @ 02fe7bc0] All info found
[matroska,webm @ 02fe7bc0] stream 0: start_time: 0.000 duration: -9223372036854776.000
[matroska,webm @ 02fe7bc0] stream 1: start_time: 0.000 duration: -9223372036854776.000
[matroska,webm @ 02fe7bc0] format: start_time: 0.000 duration: 1.023 bitrate=293 kb/s
[matroska,webm @ 02fe7bc0] After avformat_find_stream_info() pos: 10935 bytes read:32768 seeks:0 frames:7
Input #0, matroska,webm, from 'sample.mkv':
Metadata:
ENCODER : Lavf57.41.100
Duration: 00:00:01.02, start: 0.000000, bitrate: 293 kb/s
Stream #0:0, 4, 1/1000: Video: h264 (High), 1 reference frame, yuv420p(left), 320x240 [SAR 1:1 DAR 4:3], 0/1, 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
Metadata:
ENCODER : Lavc57.50.100 libx264
DURATION : 00:00:01.021000000
Stream #0:1, 3, 1/1000: Audio: aac (LC), 48000 Hz, stereo, fltp (default)
Metadata:
ENCODER : Lavc57.50.100 aac
DURATION : 00:00:01.023000000
Successfully opened the file.
Parsing a group of options: output file sample-c-copy.mp4.
Applying option c (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: sample-c-copy.mp4.
[file @ 050e4f60] Setting default whitelist 'file,crypto'
Successfully opened the file.
[mp4 @ 0500f8e0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Last message repeated 1 times
Output #0, mp4, to 'sample-c-copy.mp4':
Metadata:
encoder : Lavf57.41.100
Stream #0:0, 0, 1/16000: Video: h264, 1 reference frame ([33][0][0][0] / 0x0021), yuv420p(left), 320x240 (0x0) [SAR 1:1 DAR 4:3], 0/1, q=2-31, 25 fps, 25 tbr, 16k tbn, 1k tbc (default)
Metadata:
ENCODER : Lavc57.50.100 libx264
DURATION : 00:00:01.021000000
Stream #0:1, 0, 1/48000: Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo (default)
Metadata:
ENCODER : Lavc57.50.100 aac
DURATION : 00:00:01.023000000
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
Last message repeated 3 times
[NULL @ 05020440] nal_unit_type: 7, nal_ref_idc: 3
[NULL @ 05020440] nal_unit_type: 8, nal_ref_idc: 3
[NULL @ 05020440] user data:"x264 - core 148 r2705 3f5ed56 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=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"
[mp4 @ 0500f8e0] Delay between the first packet and last packet in the muxing queue is 24999833 > 10000000: forcing output
[mp4 @ 0500f8e0] Delay between the first packet and last packet in the muxing queue is 24978500 > 10000000: forcing output
No more output streams to write to, finishing.
frame= 50 fps=0.0 q=-1.0 Lsize= 74kB time=00:00:27.00 bitrate= 22.3kbits/s speed=1.38e+003x
video:70kB audio:1kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 4.264328%
Input file #0 (sample.mkv):
Input stream #0:0 (video): 50 packets read (71664 bytes);
Input stream #0:1 (audio): 96 packets read (610 bytes);
Total: 146 packets (72274 bytes) demuxed
Output file #0 (sample-c-copy.mp4):
Output stream #0:0 (video): 50 packets muxed (71664 bytes);
Output stream #0:1 (audio): 96 packets muxed (610 bytes);
Total: 146 packets (72274 bytes) muxed
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0506f1c0] Statistics: 60 seeks, 191 writeouts
[AVIOContext @ 02fecda0] Statistics: 110840 bytes read, 2 seeks
Wrong output duration time.
L:\>ffmpeg.exe -v 9 -loglevel 99 -stream_loop 1 -i sample.mkv -acodec copy -vn sample-a-copy-vn.mp4 -y
ffmpeg version N-80999-gf41e37b Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.4.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 50.100 / 57. 50.100
libavformat 57. 41.100 / 57. 41.100
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 47.100 / 6. 47.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-stream_loop' ... matched as option 'stream_loop' (set number of times input stream shall be looped) with argument '1'.
Reading option '-i' ... matched as input file with argument 'sample.mkv'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'copy'.
Reading option '-vn' ... matched as option 'vn' (disable video) with argument '1'.
Reading option 'sample-a-copy-vn.mp4' ... matched as output file.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file sample.mkv.
Applying option stream_loop (set number of times input stream shall be looped) with argument 1.
Successfully parsed a group of options.
Opening an input file: sample.mkv.
[file @ 03438300] Setting default whitelist 'file,crypto'
Probing matroska,webm score:100 size:2048
Probing mp3 score:1 size:2048
[matroska,webm @ 03437c20] Format matroska,webm probed with size=2048 and score=100
st:0 removing common factor 1000000 from timebase
st:1 removing common factor 1000000 from timebase
[matroska,webm @ 03437c20] Before avformat_find_stream_info() pos: 912 bytes read:32768 seeks:0 nb_streams:2
[h264 @ 02e504e0] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 02e504e0] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 02e504e0] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 02e504e0] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 02e504e0] user data:"x264 - core 148 r2705 3f5ed56 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=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"
[h264 @ 02e504e0] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 02e504e0] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 02e504e0] user data:"x264 - core 148 r2705 3f5ed56 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - 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=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"
[h264 @ 02e504e0] Reinit context to 320x240, pix_fmt: yuv420p
[h264 @ 02e504e0] no picture
[matroska,webm @ 03437c20] All info found
[matroska,webm @ 03437c20] stream 0: start_time: 0.000 duration: -9223372036854776.000
[matroska,webm @ 03437c20] stream 1: start_time: 0.000 duration: -9223372036854776.000
[matroska,webm @ 03437c20] format: start_time: 0.000 duration: 1.023 bitrate=293 kb/s
[matroska,webm @ 03437c20] After avformat_find_stream_info() pos: 10935 bytes read:32768 seeks:0 frames:7
Input #0, matroska,webm, from 'sample.mkv':
Metadata:
ENCODER : Lavf57.41.100
Duration: 00:00:01.02, start: 0.000000, bitrate: 293 kb/s
Stream #0:0, 4, 1/1000: Video: h264 (High), 1 reference frame, yuv420p(left), 320x240 [SAR 1:1 DAR 4:3], 0/1, 25 fps, 25 tbr, 1k tbn, 50 tbc (default)
Metadata:
ENCODER : Lavc57.50.100 libx264
DURATION : 00:00:01.021000000
Stream #0:1, 3, 1/1000: Audio: aac (LC), 48000 Hz, stereo, fltp (default)
Metadata:
ENCODER : Lavc57.50.100 aac
DURATION : 00:00:01.023000000
Successfully opened the file.
Parsing a group of options: output file sample-a-copy-vn.mp4.
Applying option acodec (force audio codec ('copy' to copy stream)) with argument copy.
Applying option vn (disable video) with argument 1.
Successfully parsed a group of options.
Opening an output file: sample-a-copy-vn.mp4.
[file @ 02e50ec0] Setting default whitelist 'file,crypto'
Successfully opened the file.
[mp4 @ 02e3fde0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, mp4, to 'sample-a-copy-vn.mp4':
Metadata:
encoder : Lavf57.41.100
Stream #0:0, 0, 1/48000: Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo (default)
Metadata:
ENCODER : Lavc57.50.100 aac
DURATION : 00:00:01.023000000
Stream mapping:
Stream #0:1 -> #0:0 (copy)
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
Last message repeated 2 times
No more output streams to write to, finishing.
size= 2kB time=00:00:26.02 bitrate= 0.6kbits/s speed=4e+003x
video:0kB audio:1kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 194.262299%
Input file #0 (sample.mkv):
Input stream #0:0 (video): 4 packets read (9931 bytes);
Input stream #0:1 (audio): 96 packets read (610 bytes);
Total: 100 packets (10541 bytes) demuxed
Output file #0 (sample-a-copy-vn.mp4):
Output stream #0:0 (audio): 96 packets muxed (610 bytes);
Total: 96 packets (610 bytes) muxed
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 02e40500] Statistics: 30 seeks, 119 writeouts
[AVIOContext @ 0343ce20] Statistics: 74196 bytes read, 1 seeks
ffmpeg version f41e37b (2016-07-14)
built on ... Zeranoe
Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.
Change History (8)
comment:1 by , 10 years ago
| Component: | avutil → ffmpeg |
|---|
follow-up: 4 comment:2 by , 10 years ago
-stream_loop 1means that the input stream should be used twice in the output stream (looped once) and this is what the documentation says: https://ffmpeg.org/ffmpeg-all.html#Main-options
If your input stream has 25 frames (does it?) then 50 output frames are correct or do I misunderstand?
Yes, sample video is 25 frames, 1 second. Then use -stream_loop 1, output video is 50 frames(with movie), 2 seconds.
ffmpeg -f lavfi -i testsrc2=d=1 -f lavfi -i anullsrc=r=48000:cl=stereo -shortest -vcodec libx264 -acodec aac sample.mkv
This command output 50 frames, 2 seconds.
ffmpeg.exe -stream_loop 1 -i sample.mkv -vcodec copy sample-v-copy.mp4 -y
This command output 51 frames, 2 seconds.
ffmpeg.exe -stream_loop 1 -i sample.mkv sample-no-copy.mp4 -y
But, this command output 50 frames, 27 seconds.
ffmpeg.exe -v 9 -loglevel 99 -stream_loop 1 -i sample.mkv -c copy sample-c-copy.mp4 -y
frame= 50 fps=0.0 q=-1.0 Lsize= 74kB time=00:00:27.00 bitrate= 22.3kbits/s speed=3.41e+003x
Sorry The seconds command, I mistook to wite command.
output 50 frames, 27 seconds.
ffmpeg.exe -v 9 -loglevel 99 -stream_loop 1 -i sample.mkv -vcodec copy -an sample-v-copy-an.mp4 -y
frame= 50 fps=0.0 q=-1.0 Lsize= 71kB time=00:00:26.88 bitrate= 21.8kbits/s speed=1.12e+004x
output 26 secnods without movie.
ffmpeg.exe -v 9 -loglevel 99 -stream_loop 1 -i sample.mkv -acodec copy -vn sample-a-copy-vn.mp4 -y
size= 2kB time=00:00:26.02 bitrate= 0.6kbits/s speed=4.38e+003x
comment:3 by , 10 years ago
To add further, the DTS/PTS in the output are discontinuous at each loop joint and the timestamps 'jump'.
Illustration:
Step 1: Generate dummy video
ffmpeg -f lavfi -i color=r=5:d=1 dummy.mkv
This has sane timestamps.
ffprobe dummy.mkv -show_entries frame=pkt_pts_time -of compact=p=0:nk=1
shows as expected
0.000000 0.200000 0.400000 0.600000 0.800000
Step 2: Generate looped video
ffmpeg -stream_loop 3 -i dummy.mkv -c copy dummyx3.mp4
Timestamps are
0.000000 0.200000 0.400000 0.600000 0.800000 5.800000 6.000000 6.200000 6.400000 6.600000 11.600000 11.800000 12.000000 12.200000 12.400000 17.400000 17.600000 17.800000 18.000000 18.200000
With longer videos, I have seen jumps of 30 seconds.
comment:4 by , 10 years ago
Replying to nicol:
-stream_loop 1means that the input stream should be used twice in the output stream (looped once) and this is what the documentation says: https://ffmpeg.org/ffmpeg-all.html#Main-options
If your input stream has 25 frames (does it?) then 50 output frames are correct or do I misunderstand?
Yes, sample video is 25 frames, 1 second. Then use
-stream_loop 1, output video is 50 frames(with movie), 2 seconds.
This is the intended behaviour, no?
follow-up: 6 comment:5 by , 10 years ago
I just noticed, the jump is related to the video framerate. If the rate is X fps, the timestamps jump is X seconds at the joints.
comment:6 by , 10 years ago
Replying to cehoyos:
Yes, sample video is 25 frames, 1 second. Then use
-stream_loop 1,
output video is 50 frames(with movie), 2 seconds.
This is the intended behaviour, no?
Yes, this is the intended behaviour(1 + 1*1 = 2 seconds).
Replying to mulvya:
I just noticed, the jump is related to the video framerate. If the rate is
X fps, the timestamps jump is X seconds at the joints.
I confirmed. This is right. 1+1*1+60(fps) = 62 seconds
ffmpeg -f lavfi -i testsrc2=d=1:r=60 -f lavfi -i anullsrc=r=48000:cl=stereo -shortest -vcodec libx264 -acodec aac sample60.mkv -y` ffmpeg.exe -v 9 -loglevel 99 -stream_loop 1 -i sample60.mkv -c copy sample-c-copy60.mp4 -y frame= 120 fps=0.0 q=-1.0 Lsize= 106kB time=00:01:02.02
comment:7 by , 10 years ago
| Keywords: | stream_loop added |
|---|---|
| Reproduced by developer: | set |
| Status: | new → open |
comment:8 by , 9 years ago
| Resolution: | → fixed |
|---|---|
| Status: | open → closed |



I don't understand the ticket / I see another bug:
-stream_loop 1means that the input stream should be used twice in the output stream (looped once) and this is what the documentation says: https://ffmpeg.org/ffmpeg-all.html#Main-optionsIf your input stream has 25 frames (does it?) then 50 output frames are correct or do I misunderstand?