#5456(undetermined:new): Videos produced with -shortest are longer than the audio
#5456: Videos produced with -shortest are longer than the audio -------------------------------------+------------------------------------- Reporter: hmemcpy | Type: defect Status: new | Priority: normal Component: | Version: undetermined | unspecified Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -------------------------------------+------------------------------------- Summary of the bug: I tried following the guide for converting an audio file to video for YouTube, and I noticed that when using the `-shortest` switch, the videos produced were about 10 seconds longer than the audio track, and it was impossible to skip. After some searching, I found an old thread that suggests this was a bug introduced sometime in 2012, and suggested using an older version. I was able to find that last good build, after which the bug happens! Last good build was: `ffmpeg-20120720-git-85761ef` found here: https://ffmpeg.zeranoe.com/builds/win64/static/ All subsequent versions after it, including the very latest, have this incorrect behavior. How to reproduce: Attached is an 8 second .flac file (and an image for still frame) Run the following: {{{ ffmpeg -loop 1 -framerate 1 -i bg.jpg -i recit24bit.flac -shortest output.mp4 }}} When done with the "good" build 85761ef, the resulting mp4 is 10 seconds long When done with any other newer version, the resulting mp4 is 1 minute 08 seconds on my machine. See attached logs for additional info. -- Ticket URL: <https://trac.ffmpeg.org/ticket/5456> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#5456: Videos produced with -shortest are longer than the audio -------------------------------------+------------------------------------- Reporter: hmemcpy | Owner: Type: defect | Status: new Priority: normal | Component: Version: unspecified | undetermined Keywords: | Resolution: Blocking: | Blocked By: Analyzed by developer: 0 | Reproduced by developer: 0 -------------------------------------+------------------------------------- Comment (by hmemcpy): The source flac sample used is: http://download.linnrecords.com/test/flac/recit24bit.aspx -- Ticket URL: <https://trac.ffmpeg.org/ticket/5456#comment:1> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#5456: Videos produced with -shortest are longer than the audio -------------------------------------+------------------------------------- Reporter: hmemcpy | Owner: Type: defect | Status: new Priority: normal | Component: Version: unspecified | undetermined Keywords: | Resolution: Blocking: | Blocked By: Analyzed by developer: 0 | Reproduced by developer: 0 -------------------------------------+------------------------------------- Comment (by AyrA): I am affected by the same issue. It looks like somewhere the calculation is off. If you don't use the input argument `-framerate` you get approximately the same video and audio stream length (2 seconds off for a 3m50s audio track). It looks like ffmpeg defaults to 25 FPS in that case. If you manually specify higher framerates (for example 60) you get closer to the audio duration. -- Ticket URL: <https://trac.ffmpeg.org/ticket/5456#comment:2> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#5456: Videos produced with -shortest are longer than the audio -------------------------------------+------------------------------------- Reporter: hmemcpy | Owner: Type: defect | Status: new Priority: normal | Component: | undetermined Version: unspecified | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -------------------------------------+------------------------------------- Comment (by RolandMunsil): Issue still appears to be present - using FFmpeg 4.2.2 (win64 build) and running into exact same problem. Increasing framerate decreases extra time added to video (1 FPS = ~1 minute extra, 25 FPS = ~3 seconds extra). I was able to kind of mitigate it by adding {{{ -fflags +shortest -max_interleave_delta 500M }}} to the end of my command, which significantly reduced the amount of extra time added to the output. -- Ticket URL: <https://trac.ffmpeg.org/ticket/5456#comment:3> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#5456: Videos produced with -shortest are longer than the audio -------------------------------------+------------------------------------- Reporter: hmemcpy | Owner: Type: defect | Status: new Priority: normal | Component: | undetermined Version: unspecified | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -------------------------------------+------------------------------------- Changes (by fireattack): * cc: human.peng@… (added) -- Ticket URL: <https://trac.ffmpeg.org/ticket/5456#comment:4> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#5456: Videos produced with -shortest are longer than the audio -------------------------------------+------------------------------------- Reporter: Igal | Owner: (none) Tabachnik | Type: defect | Status: new Priority: normal | Component: | undetermined Version: unspecified | Resolution: Keywords: | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -------------------------------------+------------------------------------- Comment (by areweAV1yet): I am still having issues creating 8k/4k videos with this. The interleave trick helped but was still leading to 50% longer videos (than the audio length) I found that converting to `aac` before and then doing a `copy` seemed to fix it ```for i in *.mp3; do ( ffmpeg -i "$i" -b:a 256k "${i%.*}.aac"; ffmpeg -r 0.01 -i image.jpg -i "${i%.*}.aac" -c:a copy -shortest -max_interleave_delta 500M -c:v libx265 -x265-params lossless=1 -pix_fmt yuvj420p -vf "loop=-1:1" -movflags faststart "${i%.*}.mp4"); done``` -- Ticket URL: <https://trac.ffmpeg.org/ticket/5456#comment:5> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
participants (1)
-
FFmpeg