0

I am using the following command to make a video from a single image;

ffmpeg -loop 1 -i MyInputImage.png -i MyInputSound.m4a ^
  -c:v libx264 -pix_fmt yuv420p -c:a aac ^
  -shortest MyOutputVideo.mp4

Note that I have used the -shortest option;

But I have noticed my resulting video IS ALWAYS 2 seconds longer than my AUDIO length. Why ?

For example, if audio=5 secs, output vid lenght is 7 secs; if audio=9 secs, output video is 11 seconds long.

1 Answer 1

0

This was due to an imperfect implementation of -shortest, now rectified in version 5.0. So, upgrade.

2
  • "ffmpeg -version" does not show version? ffmpeg version 2022-05-19-git-dd99d34d67-essentials_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers built with gcc 11.3.0 (Rev1, Built by MSYS2 project) configuration: --enable-gpl libavutil 57. 24.101 / 57. 24.101 libavcodec 59. 28.100 / 59. 28.100 libavformat 59. 24.100 / 59. 24.100 libavdevice 59. 6.100 / 59. 6.100 libavfilter 8. 38.100 / 8. 38.100 libswscale 6. 6.100 / 6. 6.100 libswresample 4. 6.100 / 4. 6.100 libpostproc 56. 5.100 / 56. 5.100
    – joedotnot
    Jun 25 at 4:18
  • That's a git build from 2022-05-19 so newer than 5.0 which was released on 2022-01-14
    – Gyan
    Jun 25 at 4:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.