Creating video with audio and still image for YouTube

ffmpegmp3videoyoutube

I'm running the following command:

ffmpeg -i audio.mp3 -ar 44100 -f image2 -i logo.jpg -r 15 -b 1800 -s 640x480 foo.mov

Which successfully outputs a video with my recorded audio and an image on it.

When I try and upload this to YouTube it fails to process, regardless of the formats I try: .mov, .avi, .flv, .mp4

Is there some setting I'm missing in the above that would generate a format Youtube will accept? I've tried looking through the ffmpeg documentation but I'm in over my head.

I did an experiment by putting a 2 second video with a 30 second mp3. When I uploaded to youtube, the resulting video was only 2 seconds long. So it may be that YouTube looks only to the video track for the length, and since a picture is only a frame long or whatever, maybe that borks it.

Best Answer

Here's what worked:

ffmpeg -i audio.mp3 -f image2 -loop 1 -i logo.jpg 
-r 15 -s 640x480 \
-c:v libx264 -crf 18 -tune stillimage -preset medium \
-shortest foo.mov

Specifically, the loop option, which will duplicate the image as frames. It will also then need the shortest option to keep the file from growing and growing (this way it truncates it to the length of the shortest stream – here, the audio file).

The r option changes the frame rate, and crf 18 sets the quality (use a higher value here for lower video quality). See here for more details: FFmpeg: The ultimate Video and Audio Manipulation Tool

Related Question