Convert Audio to Video with Image via Command Line

article #1367, updated 1472 days ago

Very simple via ‘ffmpeg’, there are versions for all major platforms:

ffmpeg -i audio.mp3 -i picture.jpg out.avi

The above will produce an .AVI, and if you change out ‘avi’ for ‘mp4’, ‘mov’, et cetera, ffmpeg will follow your lead and build the indicated format. However, if you want to make a file which Facebook and Youtube will accept, you’ll have to get a lot fancier:

ffmpeg -loop 1 -framerate 2 -i input_picture.jpg -i input_audio.mp3 -c:v libx264 -preset medium -tune stillimage -crf 18 -c:a copy -shortest -pix_fmt yuv420p output_video.mkv

Categories: