I recently installed FFMPEG on my Ubuntu desktop. FFMPEG is an open-source cross-platform software capable of recording, editing and streaming audio and video formats. It supports most of the available video formats like AVI, WMV, FLV, MPG and graphics formats like JPG, GIF, PNG and audio formats like MP3, MP2, AVI, YUV, WAV, etc.
Installing FFMPEG in Ubuntu is a breeze. You can either use the Synaptic Package Manager or use the Terminal by typing the following command:
# sudo apt-get install ffmpeg
The FFMPEG program is not for the faint of heart. You have to run the program from the Terminal. There is no graphic interface, no GUI and no clicking of the mouse. Don’t be alarmed. It’s quite easy to use as you will later see.
Conversion from one format to another is easily done using the simple syntax displayed below. Of course, there area several dozen switches available to you if you want customize your own conversion, but the basic syntax is:
# ffmpeg -i input.avi output.flv
Here’s a list of the more popular options I have used extensively.
-i snow.wmv = the source file
-y snow.flv = the output file
-r 25 = video frame rate in fps
-qscale .1 = video quality .1 for high, 2 for medium, 4 for low quality
-s 300x200 = video size in pixels, use even numbers only for last digit
-ar 44100 = audio sample rate in Hz
-ab 448 = audio bitrate in kb
-ac 2 = audio channel. Use 1 or 2
To convert a WMV to FLV format in high quality, I used:
# ffmpeg -i snow.wmv -r 25 -ac 2 -ab 448 -ar 44100 -s 450x300 -qscale .1 -y snow.flv
But, I had a little problem. No audio. I was missing some codec files. I was getting messages like “the libmp3lame was not found.” I found this awesome little script that fixed my problem. The script will download the latest FFMPEG version from the repository and recompile it right before your eyes.
I downloaded the script to my Desktop and made it executable by typing this command on my Terminal. Make sure you are in the correct directory, otherwise it will say the file is not found.
Make script executable
# sudo chmod +x ffmpeg.sh
Run the shell script
Take a break and sip some coffee. This will take several minutes to complete. The script will create several temporary files and directories that you can later delete at your leisure. Once finished, you can begin experimenting with FFMPEG. Try converting different formats and use different options. Check out the documentation online.
Here’s an example of a snowboarding video I converted from the WMV to the FLV format. I’m using the JW Flash Player to display the video. I used the following options to convert from WMV to FLV format with high audio and video quality options to fit in a 450×300 video screen.
# ffmpeg -i snow.wmv -r 25 -ac 2 -ab 448 -ar 44100 -s 300x200 -qscale .1 -y snow.flv
<div id="player">This text will be replaced</div>
var so = new SWFObject('http://ulyssesonline.com/files/player.swf','mpl','270','200','9');