MPEG / YUVMPEG / OGV (Ogg Vorbis video) to FLV

FLV is the Flash video format used on sites like Youtube. It uses MPEG layer III, better known as mp3, for its audio.

Here is an example on how to create an FLV from an YUVMPEG video file and a seperate WAV audio file.

ffmpeg -i infile.wav -i infile.m2v -f flv -acodec mp3 -ar 22050 -ab 64k -ac 1 -b 500k outfile.flv

Use a higher bitrate (-b) for better quality, for example "-b 1600k". For stereo sound double the audio bitrate ("-ab 128k") and number of channels ("-ac 2"). To scale and/or crop, insert something like this:

-vf "crop=670:576,scale=450:260"

Here is an example on how to create an FLV from an MPEG.

ffmpeg -i infile.mpg -f flv -acodec mp3 -ar 22050 -ab 64k -ac 1 -b 500k outfile.flv

Note: in 9.04 (Jaunty) and later, use libmp3lame instead of mp3. You may need to install the libavcodec-unstripped-52 package.

Note: in 14.04 and later, install package libav-tools and use the command avconv instead of ffmpeg.

Ogg Vorbis video files will work in a similar way.

In this example we chose a video bitrate of 500kbits/sec and for the audio we took a 1 channel (mono) file with a sample rate of 22050Hz and specified an audio bitrate of 64kbits/sec. Stereo, and other sampling rates and bitrates will work too. Check out the manual of Lame, option -b, to see what is allowed.

You do need to care about the image size. I noticed that specifying an input file with odd dimensions does not work. A common format found on the internet is 450x337, which you have to round off to 450x340. You can scale to this format using  "-s 450x340".