Join Audio and Image -> Output as Video using FFmpeg

I have 1 image (jpg) and 1 audio file (MP3) and I would like to output this as a video file (say AVI for example).

Does anyone know how to use FFMPEG to join the two? I'd like to show the image for the duration of the audio.

Any ideas anyone?


If you are in Windows, You can do it in Windows Movie maker too ... if you need instructions please leave a comment

For FFmpeg use this

ffmpeg -loop_input -vframes 14490 -i imagine.jpg -i audio.mp3 -y -r 30 
    -b 2500k -acodec ac3 -ab 384k -vcodec mpeg4 result.mp4
  • vframes 14490 is the number of frames that should be looped in order to have a continuous image for the entire audio.mp3 file

    Ex: For 8 minutes and 3 seconds ((8m x 60s + 3s) x 30fps = 14490 vf)

Resource from here


There is a much simpler way than those suggested here, that doesn't require calculating the number of frames or inputting the length of individual files (especially better for batch processing). With a recent version of ffmpeg, you can use the -shortest option, which stops encoding when the shortest stream ends - in this case, input.mp3 (since the image will loop forever, it has infinite length):

ffmpeg -i input.mp3 -f image2 -loop 1 -r 2 -i input.jpg \
-shortest -c:a copy -c:v libx264 -crf 23 -preset veryfast output.mp4

This uses 2 frames per second for the image/video, which should be fine, but you can set it to a more standard 25 if you want.