[FFmpeg-trac] #11336(ffmpeg:new): Pipe output produces file with incorrect duration metadata

FFmpeg trac at avcodec.org
Sat Dec 7 04:10:36 EET 2024


#11336: Pipe output produces file with incorrect duration metadata
--------------------------------+--------------------------------------
             Reporter:  Xorgon  |                     Type:  defect
               Status:  new     |                 Priority:  normal
            Component:  ffmpeg  |                  Version:  git-master
             Keywords:  pipe    |               Blocked By:
             Blocking:          |  Reproduced by developer:  0
Analyzed by developer:  0       |
--------------------------------+--------------------------------------
 Summary of the bug:

 Using the pipe output from ffmpeg results in the duration in the metadata
 being incorrect.

 How to reproduce:
 {{{
 % ffmpeg -y -i .\test.mp4 -f avi -c:v libx264 - > output.avi
 ffmpeg version 2024-12-04-git-2f95bc3cb3-full_build-www.gyan.dev Copyright
 (c) 2000-2024 the FFmpeg developers
   built with gcc 14.2.0 (Rev1, Built by MSYS2 project)
   configuration: --enable-gpl --enable-version3 --enable-static --disable-
 w32threads --disable-autodetect --enable-fontconfig --enable-iconv
 --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma
 --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt
 --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray
 --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption
 --enable-libdav1d --enable-libdavs2 --enable-libopenjpeg --enable-libquirc
 --enable-libuavs3d --enable-libxevd --enable-libzvbi --enable-libqrencode
 --enable-librav1e --enable-libsvtav1 --enable-libvvenc --enable-libwebp
 --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxeve
 --enable-libxvid --enable-libaom --enable-libjxl --enable-libvpx --enable-
 mediafoundation --enable-libass --enable-frei0r --enable-libfreetype
 --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-
 libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-
 llvm --enable-cuvid --enable-dxva2 --enable-d3d11va --enable-d3d12va
 --enable-ffnvcodec --enable-libvpl --enable-nvdec --enable-nvenc --enable-
 vaapi --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-
 opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-
 libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-
 libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc
 --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-liblc3
 --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-
 libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-
 libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
   libavutil      59. 47.101 / 59. 47.101
   libavcodec     61. 26.100 / 61. 26.100
   libavformat    61.  9.100 / 61.  9.100
   libavdevice    61.  4.100 / 61.  4.100
   libavfilter    10.  6.101 / 10.  6.101
   libswscale      8. 12.100 /  8. 12.100
   libswresample   5.  4.100 /  5.  4.100
   libpostproc    58.  4.100 / 58.  4.100
 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '.\porous_plates_high_angle.mp4':
   Metadata:
     major_brand     : mp42
     minor_version   : 0
     compatible_brands: isommp42
     creation_time   : 2022-08-10T12:54:09.000000Z
   Duration: 00:00:06.67, start: 0.000000, bitrate: 567 kb/s
   Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661),
 yuv420p(progressive), 384x264 [SAR 1:1 DAR 16:11], 563 kb/s, 30 fps, 30
 tbr, 30k tbn (default)
     Metadata:
       creation_time   : 2022-08-10T12:54:09.000000Z
       handler_name    : Mainconcept MP4 Video Media Handler
       vendor_id       : [0][0][0][0]
       encoder         : AVC Coding
 Stream mapping:
   Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
 Press [q] to stop, [?] for help
 [libx264 @ 00000190e94bb600] using SAR=1/1
 [libx264 @ 00000190e94bb600] using cpu capabilities: MMX2 SSE2Fast SSSE3
 SSE4.2 AVX FMA3 BMI2 AVX2
 [libx264 @ 00000190e94bb600] profile High, level 2.1, 4:2:0, 8-bit
 Output #0, avi, to 'pipe:':
   Metadata:
     major_brand     : mp42
     minor_version   : 0
     compatible_brands: isommp42
     ISFT            : Lavf61.9.100
   Stream #0:0(eng): Video: h264 (H264 / 0x34363248), yuv420p(tv,
 progressive), 384x264 [SAR 1:1 DAR 16:11], q=2-31, 30 fps, 30 tbn
 (default)
     Metadata:
       encoder         : Lavc61.26.100 libx264
       creation_time   : 2022-08-10T12:54:09.000000Z
       handler_name    : Mainconcept MP4 Video Media Handler
       vendor_id       : [0][0][0][0]
     Side data:
       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
 [out#0/avi @ 00000190e94ba780] video:82KiB audio:0KiB subtitle:0KiB other
 streams:0KiB global headers:0KiB muxing overhead: 3.631060%
 frame=  200 fps=0.0 q=-1.0 Lsize=      85KiB time=00:00:06.60 bitrate=
 105.9kbits/s speed=66.6x
 [libx264 @ 00000190e94bb600] frame I:1     Avg QP:16.12  size:  3659
 [libx264 @ 00000190e94bb600] frame P:80    Avg QP:21.31  size:   647
 [libx264 @ 00000190e94bb600] frame B:119   Avg QP:26.74  size:   243
 [libx264 @ 00000190e94bb600] consecutive B-frames:  3.0% 53.0%  0.0% 44.0%
 [libx264 @ 00000190e94bb600] mb I  I16..4: 17.6% 70.6% 11.8%
 [libx264 @ 00000190e94bb600] mb P  I16..4:  0.8%  1.7%  0.6%  P16..4:
 17.6%  4.6%  3.3%  0.0%  0.0%    skip:71.4%
 [libx264 @ 00000190e94bb600] mb B  I16..4:  0.1%  0.3%  0.2%  B16..8:
 11.7%  1.4%  0.4%  direct: 0.6%  skip:85.4%  L0:32.0% L1:59.7% BI: 8.3%
 [libx264 @ 00000190e94bb600] 8x8 transform intra:59.6% inter:62.4%
 [libx264 @ 00000190e94bb600] coded y,uvDC,uvAC intra: 48.5% 0.0% 0.0%
 inter: 3.5% 0.0% 0.0%
 [libx264 @ 00000190e94bb600] i16 v,h,dc,p: 19% 39% 25% 17%
 [libx264 @ 00000190e94bb600] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 25% 30%
 3%  3%  4%  4%  4%  5%
 [libx264 @ 00000190e94bb600] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 20% 16%
 6%  8%  8%  8%  5%  6%
 [libx264 @ 00000190e94bb600] i8c dc,h,v,p: 100%  0%  0%  0%
 [libx264 @ 00000190e94bb600] Weighted P-Frames: Y:0.0% UV:0.0%
 [libx264 @ 00000190e94bb600] ref P L0: 76.2%  7.9% 11.2%  4.7%
 [libx264 @ 00000190e94bb600] ref B L0: 85.6% 12.9%  1.5%
 [libx264 @ 00000190e94bb600] ref B L1: 97.7%  2.3%
 [libx264 @ 00000190e94bb600] kb/s:101.19
 }}}

 Using ffprobe we can see that the duration does not match the counted
 number of frames and the frame rate.

 {{{
 % ffprobe -v error -count_frames -show_entries
 stream=duration,nb_read_frames,r_frame_rate .\output.avi
 [STREAM]
 r_frame_rate=30/1
 duration=728.233333
 nb_read_frames=200
 [/STREAM]
 }}}

 Full debug output log and test videos are attached.
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/11336>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list