ffmpeg

FFmpeg video from image plus audio length issue


I'm having issues regarding the output video length when using the following code which seems to work for everybody else.

On a input mp3 of 04:56 I get a 05:09, the last part is only the image, no sound, for a longer mp3 input file I get more silent video at the end.

I'm using the "-shortest" option just before the output file as an argument , as suggested in other threads around stackoverflow/superuser.

   ffmpeg -loop 1 -i image.jpg -i audio.mp3 -c:v libx264 -tune stillimage -c:a aac -strict experimental -b:a 192k -shortest out.mp4

I already changed the input file type - wav , and the image - png, jpg, same silent "overhead" at the end of the video.


Solution

  • I was using a extra argument "-framerate 2" that was causing the extra video length , going default with 25 frames/second outputs a video closer to the audio input file length(just 2-4 seconds extra of silence)