Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

4 Answers 4

up vote 9 down vote accepted

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

share|improve this answer
1  
Doesn't work for me. I get an one-frame movie. –  Pavel Vlasov Aug 23 '11 at 22:46
    
I does work for me now. –  molnarg Mar 22 at 11:03

A piece of code that works for me, from another forum:

ffmpeg -loop 1 -r ntsc -i image.jpg -i song.mp3 -c:a copy -c:v libx264 -preset fast -threads 0 -shortest output.mkv 
share|improve this answer

I took Pavel's code, that worked for me too, and shortened it by trimming needless options:

ffmpeg -loop 1 -shortest -i <audio file> -i <image file> <output video file>

this is a general form that works with any image and audio file as input and produce a video file as output.

That said, since your video stream will be made of a single picture repeated indefinitely, you could set a low frame rate (that is the number of images that appears in a second) with -r. Note that not all output containers allow low frame rates. One that does is avi, so you might do:

ffmpeg -loop 1 -shortest -r 0.1 -i <audio file> -i <image file> output.avi

this would create a video file with a frame rate of 0.1 (i.e. one image each 10 seconds) instead of the default of 25. This will affect file size but not video quality. Eventually, you can set the audio bitrate to get a better audio quality with -ab. This is the command I actually use to make this kind of videos for youtube:

ffmpeg -loop 1 -shortest -r 0.1 -i <audio file> -i <image file> -ab 128k output.avi
share|improve this answer
    
Thanks. I ran ffmpeg -loop 1 -shortest -r 0.1 -i audio.mp3 -i image.jpg output.avi but got 'Option loop not found.' Any ideas? –  Colonel Panic Dec 15 '12 at 1:12
    
@col If you're still interested: you need the loop option before the image input, not before the audio. –  slhck Mar 20 '13 at 15:04
    
this is what worked for me: ffmpeg -i <audio file> -loop 1 -i <image file> -shortest <output video file> –  Karolinger Apr 5 '13 at 2:18

with avconv:

avconv -i input.mp3 -loop 1 -f image2 -i logo.png -r 15 -s 640x480 -ab 128k -ar 44100 -ac 1 foo.ogv
share|improve this answer
    
Welcome to SuperUser and thanks for your answer. Some more detail about what you are proposing and why would be helpful. –  Brad Patton Mar 20 '13 at 15:23
    
the response is because of ffmpeg is deprecated –  ZiTAL Mar 22 '13 at 11:13
1  
No the ffmpeg project is ongoing. There was a dispute that lead to the deprecated message. See stackoverflow.com/questions/9477115/… –  Brad Patton Mar 22 '13 at 11:17
    
ah ok, anyway, another way to do the same with different application, specially for me, i usually forget how to do it with avconv ;) –  ZiTAL Mar 22 '13 at 12:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.