Tuesday, April 27, 2010

Using ffmpeg to convert videos to FLV format

Linux has a wonderful tool called ffmpeg that makes video conversion easy....as long as you're OK with the command line.

Here is a sample command line argument that would help you convert to the FLV format:

ffmpeg -i input.mp4 -ar 22050 -ab 32 -f flv output.flv
Let's explain some of the operators in this command:

  • "-i" indicates that the next word is the input file name (input.mp4)
  • "-ar 22050" indicates an audio sampling rate of 22050 Hz
  • "-ab 32" indicates that the audio bitrate is 32kbits/second
  • "-f flv" indicates that we wish to convert the video to the FLV format
  • You could also force the video to convert to a particular resultion with "-s 320x240"
This is useful for a service such as blip.tv, which automatically converts your files to flv format, but can occasionally have issues. For more info, check out the ffmpeg website. Have fun converting!