I am trying to convert an mp3 to mp4 with images. Below are two ffmpeg commands I tried.

Length of mp3: 23 sec

  1. Here, the length of the video is same as the mp3, but video's sound does not work when trying to play on an iPhone:
ffmpeg -loop 1 -i vidimage.jpg -i my.mp3 -shortest -acodec copy -vcodec libx264 -pix_fmt yuv420p my-video.mp4
  1. Here, the mp4 plays with audio on an iPhone, but it is only 25 seconds long:
ffmpeg -loop 1 -i vidimage.jpg -i my.mp3 -shortest -acodec aac my-video.mp4

Between the two commands, how can I get an MP4 with the same length as the source audio and plays properly on an iPhone?

  • Add -fflags +shortest for a closer result. – Gyan Mar 25 '19 at 4:47
  • Unable to find a suitable output format for '+shortest' +shortest: Invalid argument – mydeve Mar 25 '19 at 5:53
  • 1
    Share full command and log. – Gyan Mar 25 '19 at 7:20

Your Answer

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

Browse other questions tagged or ask your own question.