FFmpeg Converting Audio To Video That Youtube Uploader Will Support

FFmpeg Converting Audio To Video That Youtube Uploader Will Support

Wanted to post this command as I use it regularly to convert DJ sets in .aiff or .mp3 to a video mov file that will be accepted by Youtubes uploader.

It also adds a background image for the video that will show throughout.

ffmpeg -i audio.mp3 -f image2 -loop 1 -i youtube.jpg -r 15 -s 1280x720 -c:v libx264 -crf 18 -tune stillimage -preset medium -shortest youtube_video.mov
ffmpeg -loop 1 -y -i youtube.jpg -i audio.mp3 -shortest -acodec copy -vcodec mjpeg youtube_video.mp4

The seconds one is significantly faster you can benchmark with ffmpeg using the time command like this.

time ffmpeg -loop 1 -y -i wp.png -i audio.mp3 -shortest -acodec copy -vcodec mjpeg youtube_hose.mp4

This finished (3136.49s user 29.52s system 307% cpu 17:07.98 total) for a 1 hour 20 minutes mp3.

time ffmpeg -y -i audio.mp3 -f image2 -loop 1 -i wp.png -r 15 -s 1280x720 -c:v libx264 -crf 18 -tune stillimage -preset medium -shortest youtube_hose2.mov

This finished for a 1 hour 20 minutes mp3.

Use this command important scale your image to the correct dimensions this will massively affect the encoding time.

time ffmpeg -r 1 -loop 1 -i youtube_scaled.jpg -i audio.mp3 -r 1 -shortest -vf scale=1280:720 -preset ultrafast output.mp4
Benchmarked

11.58s user 3.22s system 120% cpu 1:35.03 total

Leave a comment