Opened 4 years ago
Last modified 4 years ago
#8431 new defect
-frames on 2 image streams discards 1 frame
Reported by: | Jérôme Martinez | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | git-master | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
With 2 image streams as input, " -frames" option (as well as " -frames:0 x -frames:1 x", actually " -frames:1" seems to be ignored when tested) discards 1 frame from the second (as well as third and so on) input stream.
How to reproduce:
mkdir a
ffmpeg -f lavfi -i testsrc=duration=0.080:size=16x16 a/%1d.dpx
ffmpeg -i a/%1d.dpx -i a/%1d.dpx -map 0 -map 1 -frames 2 a.mkv
ffmpeg -i a.mkv
Expected duration of 2nd stream is 2 frames (same duration as the 1st stream), the issue is visible by checking the DURATION line of each stream in the final output file.
$ mkdir a $ ffmpeg -f lavfi -i testsrc=duration=0.080:size=16x16 a/%1d.dpx ffmpeg version git-2019-12-15-ed9279a Copyright (c) 2000-2019 the FFmpeg developers built with gcc 9.2.1 (GCC) 20191125 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf libavutil 56. 36.101 / 56. 36.101 libavcodec 58. 65.100 / 58. 65.100 libavformat 58. 35.101 / 58. 35.101 libavdevice 58. 9.101 / 58. 9.101 libavfilter 7. 68.101 / 7. 68.101 libswscale 5. 6.100 / 5. 6.100 libswresample 3. 6.100 / 3. 6.100 libpostproc 55. 6.100 / 55. 6.100 Input #0, lavfi, from 'testsrc=duration=0.080:size=16x16': Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 16x16 [SAR 1:1 DAR 1:1], 25 tbr, 25 tbn, 25 tbc Stream mapping: Stream #0:0 -> #0:0 (rawvideo (native) -> dpx (native)) Press [q] to stop, [?] for help Output #0, image2, to 'a/%1d.dpx': Metadata: encoder : Lavf58.35.101 Stream #0:0: Video: dpx, rgb24, 16x16 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc Metadata: encoder : Lavc58.65.100 dpx [Parsed_testsrc_0 @ 00000264833ec100] EOF timestamp not reliable frame= 2 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.08 bitrate=N/A speed=8.01x video:5kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown $ ffmpeg -i a/%1d.dpx -i a/%1d.dpx -map 0 -map 1 -frames 2 a.mkv -y ffmpeg version git-2019-12-15-ed9279a Copyright (c) 2000-2019 the FFmpeg developers built with gcc 9.2.1 (GCC) 20191125 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf libavutil 56. 36.101 / 56. 36.101 libavcodec 58. 65.100 / 58. 65.100 libavformat 58. 35.101 / 58. 35.101 libavdevice 58. 9.101 / 58. 9.101 libavfilter 7. 68.101 / 7. 68.101 libswscale 5. 6.100 / 5. 6.100 libswresample 3. 6.100 / 3. 6.100 libpostproc 55. 6.100 / 55. 6.100 Input #0, image2, from 'a/%1d.dpx': Duration: 00:00:00.08, start: 0.000000, bitrate: N/A Stream #0:0: Video: dpx, rgb24, 16x16 [SAR 1:1 DAR 1:1], 25 tbr, 25 tbn, 25 tbc Input #1, image2, from 'a/%1d.dpx': Duration: 00:00:00.08, start: 0.000000, bitrate: N/A Stream #1:0: Video: dpx, rgb24, 16x16 [SAR 1:1 DAR 1:1], 25 tbr, 25 tbn, 25 tbc Stream mapping: Stream #0:0 -> #0:0 (dpx (native) -> h264 (libx264)) Stream #1:0 -> #0:1 (dpx (native) -> h264 (libx264)) Press [q] to stop, [?] for help [libx264 @ 0000017d98c5c540] using SAR=1/1 [libx264 @ 0000017d98c5c540] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512 [libx264 @ 0000017d98c5c540] profile High 4:4:4 Predictive, level 1.0, 4:4:4, 8-bit [libx264 @ 0000017d98c5c540] 264 - core 158 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - 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=4 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 [libx264 @ 0000017d98c5e180] using SAR=1/1 [libx264 @ 0000017d98c5e180] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512 [libx264 @ 0000017d98c5e180] profile High 4:4:4 Predictive, level 1.0, 4:4:4, 8-bit [libx264 @ 0000017d98c5e180] 264 - core 158 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - 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=4 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, matroska, to 'a.mkv': Metadata: encoder : Lavf58.35.101 Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv444p(progressive), 16x16 [SAR 1:1 DAR 1:1], q=-1--1, 25 fps, 1k tbn, 25 tbc Metadata: encoder : Lavc58.65.100 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A Stream #0:1: Video: h264 (libx264) (H264 / 0x34363248), yuv444p, 16x16 [SAR 1:1 DAR 1:1], q=-1--1, 25 fps, 1k tbn, 25 tbc Metadata: encoder : Lavc58.65.100 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A frame= 2 fps=0.0 q=28.0 Lq=28.0 size= 3kB time=00:00:00.04 bitrate= 538.0kbits/s speed=2.05x video:2kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 59.088287% [libx264 @ 0000017d98c5c540] frame I:1 Avg QP:34.00 size: 198 [libx264 @ 0000017d98c5c540] frame P:1 Avg QP:36.00 size: 12 [libx264 @ 0000017d98c5c540] mb I I16..4: 0.0% 0.0% 100.0% [libx264 @ 0000017d98c5c540] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 0.0% 0.0% 0.0% 0.0% 0.0% skip:100.0% [libx264 @ 0000017d98c5c540] 8x8 transform intra:0.0% [libx264 @ 0000017d98c5c540] coded y,u,v intra: 100.0% 100.0% 100.0% inter: 0.0% 0.0% 0.0% [libx264 @ 0000017d98c5c540] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 38% 6% 19% 6% 0% 6% 0% 12% 12% [libx264 @ 0000017d98c5c540] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 @ 0000017d98c5c540] kb/s:21.00 [libx264 @ 0000017d98c5e180] frame I:1 Avg QP:36.00 size: 175 [libx264 @ 0000017d98c5e180] mb I I16..4: 0.0% 0.0% 100.0% [libx264 @ 0000017d98c5e180] 8x8 transform intra:0.0% [libx264 @ 0000017d98c5e180] coded y,u,v intra: 100.0% 100.0% 100.0% [libx264 @ 0000017d98c5e180] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 38% 12% 25% 6% 0% 6% 0% 12% 0% [libx264 @ 0000017d98c5e180] kb/s:35.00 $ ffmpeg -i a.mkv ffmpeg version git-2019-12-15-ed9279a Copyright (c) 2000-2019 the FFmpeg developers built with gcc 9.2.1 (GCC) 20191125 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf libavutil 56. 36.101 / 56. 36.101 libavcodec 58. 65.100 / 58. 65.100 libavformat 58. 35.101 / 58. 35.101 libavdevice 58. 9.101 / 58. 9.101 libavfilter 7. 68.101 / 7. 68.101 libswscale 5. 6.100 / 5. 6.100 libswresample 3. 6.100 / 3. 6.100 libpostproc 55. 6.100 / 55. 6.100 Input #0, matroska,webm, from 'a.mkv': Metadata: ENCODER : Lavf58.35.101 Duration: 00:00:00.08, bitrate: 275 kb/s Stream #0:0: Video: h264 (High 4:4:4 Predictive), yuv444p(progressive), 16x16 [SAR 1:1 DAR 1:1], 25 fps, 25 tbr, 1k tbn, 50 tbc (default) Metadata: ENCODER : Lavc58.65.100 libx264 DURATION : 00:00:00.080000000 Stream #0:1: Video: h264 (High 4:4:4 Predictive), yuv444p(progressive), 16x16 [SAR 1:1 DAR 1:1], 25 fps, 25 tbr, 1k tbn, 50 tbc (default) Metadata: ENCODER : Lavc58.65.100 libx264 DURATION : 00:00:00.040000000 At least one output file must be specified
Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.
Change History (3)
comment:1 by , 4 years ago
comment:2 by , 4 years ago
Duration in multimedia files is measured in time (seconds etc.), number of frames is another property of video files. Please elaborate what kind of issue you see.
Expected frame count is 2 frames (same frame count as the 1st stream) as 2nd and 1st outputted streams have the same input stream.
Issue is visible by e.g checking the duration output (stream duration is frame duration time count or frames) or by checking the count of frames in the output file (check of the file directly or demux to image content).
comment:3 by , 4 years ago
As originally implemented, reaching the frames limit on any stream closes that file output for all its streams. So the file will end up with however many frames are written at time of closing. This appears to be a design choice, likely in response to a feature request, rather than a technical requirement.
Replying to Zenitram:
Duration in multimedia files is measured in time (seconds etc.), number of frames is another property of video files. Please elaborate what kind of issue you see.