Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have many MP3 files on my website and I have decided to upload them to Youtube, but unfortunately for me, Youtube does not allow me to do that. It requires video format only.

How can I convert these MP3s to video and add same set of images (one or more images) to the resulted video format.

I need to do this in bulk, not individually, I have hundreds of MP3 files.

It can be either a Windows-based or Linux-based application.

share|improve this question

There's some info about using ffmpeg to encode audio with a still image for YouTube, here, and some advice for doing bulk conversions in Windows, here.

As for encoding, I find that this works:

ffmpeg -loop 1 -r 1 -i pic.jpg -i audio.mp3 -c:a copy -shortest output.avi

share|improve this answer

There are some solutions for Ubuntu and other Linux systems at Most are shell commands or some other quick scripting language that can be looped for all of the MP3s, outputting video files. Then, you can just queue the video files for upload to YouTube. Among the solutions listed on the page:

  1. FFmpeg, then upload files to YouTube
    ffmpeg -loop 1 -i picture.jpg -i music.mp3 -shortest -acodec copy video.mp4 Loop accordingly for all mp3 files, then upload all the resulting video files.

  2. Python, convert to mp4 then upload files to YouTube

    #! /usr/bin/env python

    import sys, os

    inputOne = sys.argv[1] inputTwo = sys.argv[2]

    for i in sys.argv[1:]: if '.mp3' in i: output = i.replace('mp3','mp4')

    cmd = 'ffmpeg -loop_input -i "'+inputOne+'" -i "'+inputTwo+'" -shortest -acodec copy "'+output+'"'


It also uses ffmpeg, and accepts music and picture as arguments.

share|improve this answer
loop_input is deprecated in ffmpeg—you need to use -loop 1 now. – slhck Jan 12 '14 at 3:45
Can we have more than one picture in the first solution (1. FFmpeg)? – Rasoul Apr 15 '15 at 18:10

You could also consider simple bash oneliner instead of python script -

for i in *.mp3; do ffmpeg -v quiet -i "picture.jpg" -i "$i" -shortest -acodec copy "`sed 's/mp3/mp4/g'<<<$i`"; done

This will convert all mp3 files in your current dir into mp4 videos with picture.jpg.

For converting flac to mp3 that would be

for i in *.flac; do ffmpeg -v quiet -i "$i" -ab 320k -ac 2 -ar 48000 "`sed 's/flac/mp3/g'<<<$i`"; done

Notice "-v quiet", which shuts ffmpeg's loud mouth and also double quotes around $i and sed - this will ensure it won't fail with filenames containing spaces.

A tip: converting to video takes quite some time (at least for me). Try using -threads 4 (or any other value, of course. It won't make any sense on single-core cpu)

Edit: I've found out that "-loop 1" (suggested by others) creates loop (how surprising!) which is actually infinite. On my gentoo that means it will eat all your tasty bites. Without "-loop 1" it works just fine, so I suggest you to go with that.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .