Snippets/ Applications/ ffmpeg

Sun, 9 Feb. 2020 by Thomas Bendler, approximately 1 min to read.

ffmpeg is a powerful command line tool to create, record, manipulate, stream and convert video files.

How to create a video from a mp3 and a picture (freeze image)

For YouTube upload:

> ffmpeg -loop 1 -framerate 1 -i image.jpg -i music.mp3 \
         -c:v libx264 -preset veryslow -crf 0 -c:a copy -shortest output.mkv

A more generic approach that should work with every player:

> ffmpeg -loop 1 -i image.png -i music.mp3 -vf "scale='min(1280,iw)':-2,format=yuv420p" \
         -c:v libx264 -preset veryslow -profile:v main -c:a aac -shortest -movflags \
         +faststart output.mp4

Share on: