If things look a little dusty around here, it's because I'm away on a mission for two years. I'll be back in August 2012, but in the mean time feel free to fork my projects on github.
Convert videos with ffmpeg
Jan 06, 2009
by Jared
FFmpeg logo

FFmpeg is a wonderful tool which every aspiring linux guru should get familiar with. The thing it does, just about better than anything else, is handle media files. You can mux them, demux them, encode/decode, resize, compress .....you name it.

Unfortunately, all that versatility means that it can be somewhat confusing, if, say all you want to do is convert this one file.

Well, actually, most of the time, ffmpeg will play nice, and theres this one simple command that will do you:

ffmpeg -i "infile.abc" "outfile.cba"

In this manner, you can convert wav to mp3, wmv to avi, or flv to mpg.

The problems start, of course, when ffmpeg starts spitting out errors. This happens when the settings for your infile are incompatible woth the format of your outfile...so the solution is to manually set those settings.

if it complains about "timebase not supported by mpeg 4 standard", try adding this parameter (before the outfile param):

-r 25

this sets the framerate to the ffmpeg default

Another error I got was "Sampling rate 11025 is not allowed in mp2"

to fix that, just set the sampling rate to the default with

-ar 44100

Another handy option is the file size limit -- great for compressing a video, when you dont want to mess with bitrates and framerates and the like. The file size is specified in bytes, thus

ffmpeg -i "large.mov" -fs 10000000 -s qvga "small.avi"

the "-s qvga" parameter resizes the video as well -- down to 320x240.

For extensive technical documentation for ffmpeg, go here.

blog comments powered by Disqus