#11668(undetermined:new): Audio being much longer than video will make -shortest clamp to 1 second
#11668: Audio being much longer than video will make -shortest clamp to 1 second --------------------------------------+---------------------------------- Reporter: RavenWorks | Type: defect Status: new | Priority: normal Component: undetermined | Version: 7.1 Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | --------------------------------------+---------------------------------- Summary of the bug: Feeding (for example) a 0.15 sec video file and a 50 sec audio file into ffmpeg with -shortest will produce a 1 sec file (a length that doesn't correspond to EITHER input). Notably though, a 0.15 sec video and **5** sec audio will give the correct output (0.15 sec file). I first encountered this with anullsrc for the audio source, but I reproduced it with regular wav files just to be certain that it wasn't something about anullsrc in particular. Don't mind the fact that I'm recompressing the video for nothing in this example; in the original context I need to be recompressing the video for unrelated reasons (and, notably, the bug *doesn't* occur when using -c:v copy.) It might be hard to even see the video files in VLC due to their shortness; MPV and Firefox can both loop them fine. How to reproduce: {{{ % ffmpeg -y -i .\50sec.wav -i .\no_audio.mp4 -shortest silent_audio.mp4 ffmpeg version 7.1.1-full_build-www.gyan.dev Copyright (c) 2000-2025 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-lcms2 --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-libdvdnav --enable-libdvdread --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. 39.100 / 59. 39.100 libavcodec 61. 19.101 / 61. 19.101 libavformat 61. 7.100 / 61. 7.100 libavdevice 61. 3.100 / 61. 3.100 libavfilter 10. 4.100 / 10. 4.100 libswscale 8. 3.100 / 8. 3.100 libswresample 5. 3.100 / 5. 3.100 libpostproc 58. 3.100 / 58. 3.100 [aist#0:0/pcm_s16le @ 000001cccab59200] Guessed Channel Layout: mono Input #0, wav, from '.\50sec.wav': Duration: 00:00:50.00, bitrate: 705 kb/s Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '.\no_audio.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf61.7.100 Duration: 00:00:00.15, start: 0.000000, bitrate: 157 kb/s Stream #1:0[0x1](und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(progressive), 256x64, 110 kb/s, 60 fps, 60 tbr, 15360 tbn (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0] encoder : Lavc61.19.101 libx264 Stream mapping: Stream #1:0 -> #0:0 (h264 (native) -> h264 (libx264)) Stream #0:0 -> #0:1 (pcm_s16le (native) -> aac (native)) Press [q] to stop, [?] for help [libx264 @ 000001cccaac7e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264 @ 000001cccaac7e00] profile High, level 1.2, 4:2:0, 8-bit [libx264 @ 000001cccaac7e00] 264 - core 164 r3204 373697b - H.264/MPEG-4 AVC codec - Copyleft 2003-2025 - 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=2 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, mp4, to 'silent_audio.mp4': Metadata: encoder : Lavf61.7.100 Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(tv, progressive), 256x64, q=2-31, 60 fps, 15360 tbn (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0] encoder : Lavc61.19.101 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 69 kb/s Metadata: encoder : Lavc61.19.101 aac [out#0/mp4 @ 000001cccaabf1c0] video:2KiB audio:9KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 15.732564% frame= 9 fps=0.0 q=-1.0 Lsize= 13KiB time=00:00:00.11 bitrate= 880.7kbits/s speed=5.52x [libx264 @ 000001cccaac7e00] frame I:4 Avg QP:31.54 size: 243 [libx264 @ 000001cccaac7e00] frame P:5 Avg QP:22.03 size: 71 [libx264 @ 000001cccaac7e00] mb I I16..4: 11.7% 74.6% 13.7% [libx264 @ 000001cccaac7e00] mb P I16..4: 0.0% 2.8% 3.4% P16..4: 4.7% 0.0% 0.0% 0.0% 0.0% skip:89.1% [libx264 @ 000001cccaac7e00] 8x8 transform intra:72.5% inter:100.0% [libx264 @ 000001cccaac7e00] coded y,uvDC,uvAC intra: 8.5% 0.0% 0.0% inter: 0.2% 0.0% 0.0% [libx264 @ 000001cccaac7e00] i16 v,h,dc,p: 10% 0% 90% 0% [libx264 @ 000001cccaac7e00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 45% 1% 53% 1% 0% 0% 0% 0% 0% [libx264 @ 000001cccaac7e00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 21% 38% 8% 3% 3% 3% 4% 4% [libx264 @ 000001cccaac7e00] i8c dc,h,v,p: 100% 0% 0% 0% [libx264 @ 000001cccaac7e00] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 @ 000001cccaac7e00] ref P L0: 46.7% 0.0% 26.7% 26.7% [libx264 @ 000001cccaac7e00] kb/s:70.93 [aac @ 000001cccb099ac0] Qavg: 32.825 }}} And just to be clear: {{{ % ffmpeg -y -i .\5sec.wav -i .\no_audio.mp4 -shortest silent_audio.mp4 }}} produces an output that is NOT bugged (provided to demonstrate that the problem seems to be related to audio length). -- Ticket URL: <https://trac.ffmpeg.org/ticket/11668> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11668: Audio being much longer than video will make -shortest clamp to 1 second -------------------------------------+------------------------------------- Reporter: RavenWorks | Owner: (none) Type: defect | Status: new Priority: normal | Component: | undetermined Version: 7.1 | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -------------------------------------+------------------------------------- Changes (by RavenWorks): * Attachment "no_audio.mp4" added. the source video file to which a silent audio track should be added -- Ticket URL: <https://trac.ffmpeg.org/ticket/11668> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11668: Audio being much longer than video will make -shortest clamp to 1 second -------------------------------------+------------------------------------- Reporter: RavenWorks | Owner: (none) Type: defect | Status: new Priority: normal | Component: | undetermined Version: 7.1 | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -------------------------------------+------------------------------------- Changes (by RavenWorks): * Attachment "25sec.wav" added. an input audio file that will cause the bug -- Ticket URL: <https://trac.ffmpeg.org/ticket/11668> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11668: Audio being much longer than video will make -shortest clamp to 1 second -------------------------------------+------------------------------------- Reporter: RavenWorks | Owner: (none) Type: defect | Status: new Priority: normal | Component: | undetermined Version: 7.1 | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -------------------------------------+------------------------------------- Changes (by RavenWorks): * Attachment "5sec.wav" added. an input audio file that will NOT cause the bug, provided for reference -- Ticket URL: <https://trac.ffmpeg.org/ticket/11668> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11668: Audio being much longer than video will make -shortest clamp to 1 second -------------------------------------+------------------------------------- Reporter: RavenWorks | Owner: (none) Type: defect | Status: new Priority: normal | Component: | undetermined Version: 7.1 | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -------------------------------------+------------------------------------- Changes (by RavenWorks): * Attachment "silent_audio.mp4" added. the too-long output file that I get when running the provided command -- Ticket URL: <https://trac.ffmpeg.org/ticket/11668> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11668: Audio being much longer than video will make -shortest clamp to 1 second -------------------------------------+------------------------------------- Reporter: RavenWorks | Owner: (none) Type: defect | Status: new Priority: normal | Component: | undetermined Version: 7.1 | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -------------------------------------+------------------------------------- Old description:
Summary of the bug: Feeding (for example) a 0.15 sec video file and a 50 sec audio file into ffmpeg with -shortest will produce a 1 sec file (a length that doesn't correspond to EITHER input). Notably though, a 0.15 sec video and **5** sec audio will give the correct output (0.15 sec file).
I first encountered this with anullsrc for the audio source, but I reproduced it with regular wav files just to be certain that it wasn't something about anullsrc in particular.
Don't mind the fact that I'm recompressing the video for nothing in this example; in the original context I need to be recompressing the video for unrelated reasons (and, notably, the bug *doesn't* occur when using -c:v copy.)
It might be hard to even see the video files in VLC due to their shortness; MPV and Firefox can both loop them fine.
How to reproduce: {{{ % ffmpeg -y -i .\50sec.wav -i .\no_audio.mp4 -shortest silent_audio.mp4 ffmpeg version 7.1.1-full_build-www.gyan.dev Copyright (c) 2000-2025 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-lcms2 --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-libdvdnav --enable- libdvdread --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. 39.100 / 59. 39.100 libavcodec 61. 19.101 / 61. 19.101 libavformat 61. 7.100 / 61. 7.100 libavdevice 61. 3.100 / 61. 3.100 libavfilter 10. 4.100 / 10. 4.100 libswscale 8. 3.100 / 8. 3.100 libswresample 5. 3.100 / 5. 3.100 libpostproc 58. 3.100 / 58. 3.100 [aist#0:0/pcm_s16le @ 000001cccab59200] Guessed Channel Layout: mono Input #0, wav, from '.\50sec.wav': Duration: 00:00:50.00, bitrate: 705 kb/s Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '.\no_audio.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf61.7.100 Duration: 00:00:00.15, start: 0.000000, bitrate: 157 kb/s Stream #1:0[0x1](und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(progressive), 256x64, 110 kb/s, 60 fps, 60 tbr, 15360 tbn (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0] encoder : Lavc61.19.101 libx264 Stream mapping: Stream #1:0 -> #0:0 (h264 (native) -> h264 (libx264)) Stream #0:0 -> #0:1 (pcm_s16le (native) -> aac (native)) Press [q] to stop, [?] for help [libx264 @ 000001cccaac7e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264 @ 000001cccaac7e00] profile High, level 1.2, 4:2:0, 8-bit [libx264 @ 000001cccaac7e00] 264 - core 164 r3204 373697b - H.264/MPEG-4 AVC codec - Copyleft 2003-2025 - 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=2 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, mp4, to 'silent_audio.mp4': Metadata: encoder : Lavf61.7.100 Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(tv, progressive), 256x64, q=2-31, 60 fps, 15360 tbn (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0] encoder : Lavc61.19.101 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 69 kb/s Metadata: encoder : Lavc61.19.101 aac [out#0/mp4 @ 000001cccaabf1c0] video:2KiB audio:9KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 15.732564% frame= 9 fps=0.0 q=-1.0 Lsize= 13KiB time=00:00:00.11 bitrate= 880.7kbits/s speed=5.52x [libx264 @ 000001cccaac7e00] frame I:4 Avg QP:31.54 size: 243 [libx264 @ 000001cccaac7e00] frame P:5 Avg QP:22.03 size: 71 [libx264 @ 000001cccaac7e00] mb I I16..4: 11.7% 74.6% 13.7% [libx264 @ 000001cccaac7e00] mb P I16..4: 0.0% 2.8% 3.4% P16..4: 4.7% 0.0% 0.0% 0.0% 0.0% skip:89.1% [libx264 @ 000001cccaac7e00] 8x8 transform intra:72.5% inter:100.0% [libx264 @ 000001cccaac7e00] coded y,uvDC,uvAC intra: 8.5% 0.0% 0.0% inter: 0.2% 0.0% 0.0% [libx264 @ 000001cccaac7e00] i16 v,h,dc,p: 10% 0% 90% 0% [libx264 @ 000001cccaac7e00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 45% 1% 53% 1% 0% 0% 0% 0% 0% [libx264 @ 000001cccaac7e00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 21% 38% 8% 3% 3% 3% 4% 4% [libx264 @ 000001cccaac7e00] i8c dc,h,v,p: 100% 0% 0% 0% [libx264 @ 000001cccaac7e00] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 @ 000001cccaac7e00] ref P L0: 46.7% 0.0% 26.7% 26.7% [libx264 @ 000001cccaac7e00] kb/s:70.93 [aac @ 000001cccb099ac0] Qavg: 32.825 }}}
And just to be clear: {{{ % ffmpeg -y -i .\5sec.wav -i .\no_audio.mp4 -shortest silent_audio.mp4 }}} produces an output that is NOT bugged (provided to demonstrate that the problem seems to be related to audio length).
New description: Summary of the bug: Feeding (for example) a 0.15 sec video file and a 25 sec audio file into ffmpeg with -shortest will produce a 1 sec file (a length that doesn't correspond to EITHER input). Notably though, a 0.15 sec video and **5** sec audio will give the correct output (0.15 sec file). I first encountered this with anullsrc for the audio source, but I reproduced it with regular wav files just to be certain that it wasn't something about anullsrc in particular. Don't mind the fact that I'm recompressing the video for nothing in this example; in the original context I need to be recompressing the video for unrelated reasons (and, notably, the bug *doesn't* occur when using -c:v copy.) It might be hard to even see the video files in VLC due to their shortness; MPV and Firefox can both loop them fine. How to reproduce: {{{ ffmpeg -y -i .\25sec.wav -i .\no_audio.mp4 -shortest silent_audio.mp4 ffmpeg version 7.1.1-full_build-www.gyan.dev Copyright (c) 2000-2025 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-lcms2 --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-libdvdnav --enable-libdvdread --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. 39.100 / 59. 39.100 libavcodec 61. 19.101 / 61. 19.101 libavformat 61. 7.100 / 61. 7.100 libavdevice 61. 3.100 / 61. 3.100 libavfilter 10. 4.100 / 10. 4.100 libswscale 8. 3.100 / 8. 3.100 libswresample 5. 3.100 / 5. 3.100 libpostproc 58. 3.100 / 58. 3.100 [aist#0:0/pcm_s16le @ 0000017f66bd9200] Guessed Channel Layout: mono Input #0, wav, from '.\25sec.wav': Duration: 00:00:25.00, bitrate: 705 kb/s Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, mono, s16, 705 kb/s Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '.\no_audio.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf61.7.100 Duration: 00:00:00.15, start: 0.000000, bitrate: 157 kb/s Stream #1:0[0x1](und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(progressive), 256x64, 110 kb/s, 60 fps, 60 tbr, 15360 tbn (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0] encoder : Lavc61.19.101 libx264 Stream mapping: Stream #1:0 -> #0:0 (h264 (native) -> h264 (libx264)) Stream #0:0 -> #0:1 (pcm_s16le (native) -> aac (native)) Press [q] to stop, [?] for help [libx264 @ 0000017f66b47e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264 @ 0000017f66b47e00] profile High, level 1.2, 4:2:0, 8-bit [libx264 @ 0000017f66b47e00] 264 - core 164 r3204 373697b - H.264/MPEG-4 AVC codec - Copyleft 2003-2025 - 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=2 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, mp4, to 'silent_audio.mp4': Metadata: encoder : Lavf61.7.100 Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p(tv, progressive), 256x64, q=2-31, 60 fps, 15360 tbn (default) Metadata: handler_name : VideoHandler vendor_id : [0][0][0][0] encoder : Lavc61.19.101 libx264 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 69 kb/s Metadata: encoder : Lavc61.19.101 aac [out#0/mp4 @ 0000017f66b3f1c0] video:2KiB audio:9KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 15.708502% frame= 9 fps=0.0 q=-1.0 Lsize= 13KiB time=00:00:00.11 bitrate= 881.9kbits/s speed=5.15x [libx264 @ 0000017f66b47e00] frame I:4 Avg QP:31.54 size: 243 [libx264 @ 0000017f66b47e00] frame P:5 Avg QP:22.03 size: 71 [libx264 @ 0000017f66b47e00] mb I I16..4: 11.7% 74.6% 13.7% [libx264 @ 0000017f66b47e00] mb P I16..4: 0.0% 2.8% 3.4% P16..4: 4.7% 0.0% 0.0% 0.0% 0.0% skip:89.1% [libx264 @ 0000017f66b47e00] 8x8 transform intra:72.5% inter:100.0% [libx264 @ 0000017f66b47e00] coded y,uvDC,uvAC intra: 8.5% 0.0% 0.0% inter: 0.2% 0.0% 0.0% [libx264 @ 0000017f66b47e00] i16 v,h,dc,p: 10% 0% 90% 0% [libx264 @ 0000017f66b47e00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 45% 1% 53% 1% 0% 0% 0% 0% 0% [libx264 @ 0000017f66b47e00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 21% 38% 8% 3% 3% 3% 4% 4% [libx264 @ 0000017f66b47e00] i8c dc,h,v,p: 100% 0% 0% 0% [libx264 @ 0000017f66b47e00] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 @ 0000017f66b47e00] ref P L0: 46.7% 0.0% 26.7% 26.7% [libx264 @ 0000017f66b47e00] kb/s:70.93 [aac @ 0000017f67199e80] Qavg: 35.527 }}} And just to be clear: {{{ % ffmpeg -y -i .\5sec.wav -i .\no_audio.mp4 -shortest silent_audio.mp4 }}} produces an output that is NOT bugged (provided to demonstrate that the problem seems to be related to audio length). -- Comment (by RavenWorks): the 50sec.wav file I had originally mentioned in the description was too big to attach; I made a 25sec.wav file that fits (and still reproduces the bug), and edited the description accordingly. -- Ticket URL: <https://trac.ffmpeg.org/ticket/11668#comment:1> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11668: Audio being much longer than video will make -shortest clamp to 1 second -------------------------------------+------------------------------------- Reporter: RavenWorks | Owner: (none) Type: defect | Status: new Priority: normal | Component: | undetermined Version: 7.1 | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -------------------------------------+------------------------------------- Comment (by RavenWorks): Two other points that I just thought of to mention: 1. Sometimes the bug simply won't happen, and then WILL happen next time despite re-entering the exact same command! 2. I tried replacing 50sec.wav with a 50sec.mp3 file, but I found that that caused the bug NOT to happen?? So I wonder if maybe it's related to filesize rather than length? Just food for thought, I'm out of my depth at this point -- Ticket URL: <https://trac.ffmpeg.org/ticket/11668#comment:2> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11668: "-shortest" malfunction with audio much longer than video? ------------------------------------+---------------------------------- Reporter: RavenWorks | Owner: (none) Type: defect | Status: new Priority: normal | Component: ffmpeg Version: 7.1 | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 1 | ------------------------------------+---------------------------------- Changes (by MasterQuestionable): * analyzed: 0 => 1 * cc: MasterQuestionable (added) * component: undetermined => ffmpeg * summary: Audio being much longer than video will make -shortest clamp to 1 second => "-shortest" malfunction with audio much longer than video? Comment: ͏ Does it reproduce? ͏ `ffmpeg -y -v debug -hide_banner -nostdin -nostats -f lavfi -i "anullsrc=mono:d=50" -f lavfi -i "testsrc2=r=60:d=0.15" -shortest "Out.mp4"` ͏ Verification helper: ͏ `ffprobe -hide_banner -threads 0 -show_entries "stream=time_base:format=size" -of "flat=h=0" "Out.mp4"` ͏ `ffprobe -v warning -hide_banner -threads 0 -show_entries "frame" -select_streams v:0 -of "xml" "Out.mp4" -o "Out.mp4.xml"` ͏ `ffprobe -v warning -hide_banner -threads 0 -show_entries "frame" -select_streams a:0 -of "xml" "Out.mp4" -o "Out.mp4.a.xml"` ͏ The input audio is likely equivalent as that generated by: ͏ `ffmpeg -y -v debug -hide_banner -nostdin -nostats -f lavfi -i "anullsrc=mono:d=50" "long.wav"` ͏ ; alike. ͏ Your [/raw-attachment/ticket/11668/silent_audio.mp4 ͏"silent_audio.mp4"] had unusually long audio. ͏ Nevertheless I cannot seem to reproduce your problem. ͏ (haven't tested the exact Gyan build on Windows though) -- Ticket URL: <https://trac.ffmpeg.org/ticket/11668#comment:3> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11668: "-shortest" malfunction with audio much longer than video? ------------------------------------+---------------------------------- Reporter: RavenWorks | Owner: (none) Type: defect | Status: new Priority: normal | Component: ffmpeg Version: 7.1 | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 1 | ------------------------------------+---------------------------------- Comment (by RavenWorks):
Does it reproduce? Trying this command did *not* reproduce the problem (even after several attempts). However, it led me to something interesting:
As already mentioned, this (usually) produces the bug: {{{ ffmpeg -y -i .\25sec.wav -i .\no_audio.mp4 -shortest silent_audio.mp4 }}} However, if I add -v debug, the bug consistently DOES NOT reproduce! {{{ ffmpeg -y -v debug -i .\25sec.wav -i .\no_audio.mp4 -shortest silent_audio.mp4 }}} Between these facts: - setting a different log level can consistently prevent the bug - using different compression on the input audio file can consistently prevent the bug - the bug can sometimes happen and sometimes not when repeating a command UNCHANGED I'm really thinking it must be some race condition? (This would also explain why it doesn't occur on your machine; the combination of disk speed and processor speed might require a different 'tipping point' of input file length to work...) -- Ticket URL: <https://trac.ffmpeg.org/ticket/11668#comment:4> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11668: "-shortest" malfunction with audio much longer than video? ------------------------------------+---------------------------------- Reporter: RavenWorks | Owner: (none) Type: defect | Status: new Priority: normal | Component: ffmpeg Version: 7.1 | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 1 | ------------------------------------+---------------------------------- Comment (by MasterQuestionable): ͏ Applying "-v debug" or not may affect the issue..? ͏ What about "-v info" (the default)? ͏ Would it be related with "-shortest_buf_duration"? ͏ [ !^ https://ffmpeg.org/ffmpeg.html#Advanced-options ] ͏ Would you further test on the "lavfi"-based commands? ͏ (try using "lavfi" input as much as possible; and attempt with "long.wav" instead) ͏ What about using a different Windows build of similar version? ͏ Relevant code of "shortest": ͏ https://github.com/FFmpeg/FFmpeg/blob/0e7c2a6287f977c30e08e2a211385c6a80614f... -- Ticket URL: <https://trac.ffmpeg.org/ticket/11668#comment:5> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11668: "-shortest" malfunction with audio much longer than video? ------------------------------------+---------------------------------- Reporter: RavenWorks | Owner: (none) Type: defect | Status: new Priority: normal | Component: ffmpeg Version: 7.1 | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 1 | ------------------------------------+---------------------------------- Comment (by RavenWorks): Aha! `-shortest_buf_duration 20` reproduces the bug, and `-shortest_buf_duration 30` avoids the bug!! (This is with the input audio file 25 seconds long.) By the way, `-v info` gave the same results as omitting `-v`. I will test some combinations of lavfi input soon. -- Ticket URL: <https://trac.ffmpeg.org/ticket/11668#comment:6> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11668: "-shortest" malfunction with audio much longer than video? ------------------------------------+---------------------------------- Reporter: RavenWorks | Owner: (none) Type: defect | Status: new Priority: normal | Component: ffmpeg Version: 7.1 | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 1 | ------------------------------------+---------------------------------- Comment (by RavenWorks): Well this is also fascinating: {{{ ffmpeg -y -f lavfi -i "anullsrc=mono:d=50" -i .\no_audio.mp4 -shortest silent_audio.mp4 }}} ... consistently reproduces the bug. {{{ ffmpeg -y -i .\25sec.wav -f lavfi -i "testsrc2=r=60:d=0.15" -shortest silent_audio.mp4 }}} ... consistently reproduces the bug. but, {{{ ffmpeg -y -f lavfi -i "anullsrc=mono:d=50" -f lavfi -i "testsrc2=r=60:d=0.15" -shortest silent_audio.mp4 }}} ... USUALLY does NOT reproduce the bug! (Though SOMETIMES it still does!) I think `-shortest_buf_duration 30` is still the bigger breakthrough, but these are both interesting bits of information... -- Ticket URL: <https://trac.ffmpeg.org/ticket/11668#comment:7> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
participants (1)
-
FFmpeg