X

Convert videos to Flash with FFMPEG

FFMPEG, the open-source, command-line encoder, can produce some excellent results. If you need to convert one video type to another, it can be exceedingly useful.

Craig Simms Special to CNET News
Craig was sucked into the endless vortex of tech at an early age, only to be spat back out babbling things like "phase-locked-loop crystal oscillators!". Mostly this receives a pat on the head from the listener, followed closely by a question about what laptop they should buy.
Craig Simms
2 min read

FFMPEG, the open-source, command-line encoder, can produce some excellent results. If you need to convert one video type to another, it can be exceedingly useful.

FFMPEG doing its encoding thing. (Screenshot by Craig Simms)

It can especially help if you want to produce video for the web, but don't have a copy of Adobe Flash lying around.

If you've got your produced video, here's how to get it in a Flash format. The instructions below are for Windows, but the FFMPEG arguments should be similar across all platforms.

  1. Download a 32-bit or 64-bit build of FFMPEG, whichever is best suited to your OS

  2. Extract the zip file into its own folder

  3. Open up Command Prompt, and change directory to the bin subfolder of where you extracted FFMPEG

  4. Get the path of where your video is that you want to convert. Usually we just dump a copy in the bin folder to avoid dealing with long path names

  5. Now head back to the Command Prompt. The command we use to convert is:
    ffmpeg -i [input file name] -s [output resolution] -f flv -b [bit rate] -ar [audio bit rate] [output file name]
    Here we've set the resolution using the s switch, the output file type to Flash using the f switch, the video bit rate using the b switch and the audio rate using the ar switch. Most importantly, we've put what we want as the name of the output file at the very end of the command.
    So if we wanted to output a 640x480 video, with an audio rate of 22050Hz and a video bit rate of 1000Kbps, our command may look like this:
    ffmpeg -i inputfile.avi -s 640x480 -f flv -b 1000k -ar 22050 myoutputfile.flv

  6. Hit Enter and watch things encode. You should have your Flash video shortly. Remember that if you have spaces in your path names, you will need to surround them with quote marks ("), and you may have to tweak your audio and video rates to get a result you're happy with.