Home > Uncategorized > Why I love FFMPEG: Flexibility, interoperability, encoding options.

Why I love FFMPEG: Flexibility, interoperability, encoding options.

Why I love FFMPEG ? The first reason is the flexibility, interoperability and the rich set of encoding options. FFMPEG is an open source project, it’s free and works well both on Windows and Linux. I can use this tool to create FLV files starting from a wide range of video and audio source files. I can use it to convert one shot or in batch both on desktop and server environment (exist also a PHP extension to handle this last possibility). FFMPEG supports: AVI, WMV9, DIVX, MP3, MPEG1-2-4, DV, MJPEG, H.263, H.264, 3GPP, AMR, FLV and many others.

It’s not surprising to know that Google Video (http://video.google.it) uses FFMPEG extensively to convert any sort of video sources to FLV. The cost (0), the options and the performances offered by this free tool have definitely convinced Google’s developer.
The lack of support for the last flash video codec (VP6) its the only negative spot. Unfortunately, being the VP6 a proprietary format, I think we will never see such a support in FFMPEG. On the other hand, at this moment it’s impossible to do more of what FFMPEG can do with other solutions and at a better price/performance ratio. Using server side On2’s solution or batch Sorenson conversion to produce VP6 videos is possible but not always convenient. Infact FFMPEG is much more fast, it’s free and, at the moment, it’s the only solution to re-compress a FMS (FCS) recorded FLV.

Let’s take a look at FFMPEG command line:

FFMPEG.exe -i inputfile.xxx [parameters] outputfile.flv

To convert video files to FLV, the most important parameters are:

-b, it’s the average bitrate. see also -maxrate -bufsize.
-r, frame rate. use -re to read input at native frame rate.
-s, frame size. ie: -s 320×200.
-maxrate, use this instead of -b for low bit rate video.
-minrate, set the minimum bitrate. Set maxrate=minrate=b to have a costant bitrate.
-bufsize, set (in KByte/s) the size of the buffer used to control the average bandwidth.
-sameq, convert video using the same per macroblock quantization of source.
-pass n, to launch the first pass setting use -pass 1, and for the second -pass2.
-g, distance beetween keyframes.
-i_qfactor, use it to set a difference in quantization beetween p frame and keyframe
-qscale, to set a fixed macrobloc quantization (range:0-32, 0 better quality, 32 worst)
-qmin, minimum quantization (max MB quality), try a value higher than 3-4 for low bitrate
-qmax, maximum quantization (min MB quality), default 32.
-me, motion extimation. Default is “epzs”, try the “full” value for a little more quality.
-deinterlace, deinterlace the source probably using Bob technique.

-ar, audio frequency (5500, 11000, 22000, 44000 samples/s)
-ab, audio bitrate in kbit (160, 128, 96, 80, 64, 48, 32, 24, 16)
-ac, number of channels (1-2)
-acodec copy, leave the audio tags untouched.

Depending by the setting, it’s possible to encode in variable and costant bandwidth, it’s possible to control max and min quality level, it’s possible to encode with a specific prebuffer in mind. It’s possible to deinterlace (standard Flash8’s encoder completely lacks this feature).

Spark encoded FLV are still good for hi bitrate (600-700Kbit/s depending by the contents of the video source). While are clearly inferior to VP6 for low-med bitrate (expecially under 350Kbit/s). To better encode at low bitrate I suggest to cut frame-rate, limit -qmin (try use 5-6 or higher instead of the default 2), set -maxrate istead of -b, or use a wide prebuffer (-bufsize). Try also double pass encoding (which offers alternate results) and an i_qfactor of 2-4.

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: