You will recieve your password to this address. Address is not made public.

Your preferred username that is used when logging in.

Encoding videos With FFMPEG For Flowplayer A Flowplayer tutorial

This tutorial will assume the following:

Important resources

Introduction

This tutorial serves mostly to clean up the results of a thread I made on the following Flowplayer forum entry. While there isn't much new in this tutorial that can be found in the thread, it should serve as a faster resource for people who are looking to get their videos converted quickly.

I'll include the command lines that have worked for me, but I must first stress that FFMPEG is a temperemental beast, as are many open source programs as large as this, and documentation is often patchy and incorrect. With different builds and flavours, it's unfortunate that with these command lines, it may take a little bit of testing to find a solution that will work on your machine.

If you're simply encoding on your desktop, you can download some programs with simple GUI's and default settings instead.

Hi-Definition Encoding With H.264

It seems everyone wants HD video on the Internet these days, and the best way to deliver this is with H.264 video, AAC audio and an MP4 container. Let's get down to business. Here is a command line monster that does the dirty job; it will convert your input file "input.mov" to "output.mp4":

ffmpeg -y -i input.mov -acodec libfaac -ar 44100 -ab 96k -vcodec libx264 -level 41 -crf 25 -bufsize 20000k -maxrate 25000k -g 250 -r 20 -s 1280x720 -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -flags2 +brdo+dct8x8+bpyramid -me umh -subq 7 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq 'blurCplx^(1-qComp)' -bf 16 -b_strategy 1 -bidir_refine 1 -refs 6 -deblockalpha 0 -deblockbeta 0 output.mp4

Parameters

Paramaters I can explain (or understand) that you may want to adjust:

parameter value description
y Overwrite the output file if it already exists
i input.mov The input video file
acodec libfaac Use the AAC codec
ar 44100 The audio sampling rate
ab 96k The audio bitrate
vcodec libx264 Use the x264 codec
s 1280x720 The size of the output video
crf 25 The video quality. Larger = smaller filesize
g 250 The frequency of keyframes (1 every 250 frames)
r 20 The frame rate

Okay, so there's the command line I'm using. I've been able to knock out a HD trailer from Apple's website and go from 94mb to 24mb without any reduction in resolution (while remaining HD) and with very little loss in quality. You can find a full list of parameters from FFMPG website.

Setting up the conversion on your website

If you plan on having HD video on your site, it's important to note that these are large filesizes and complicated encoding we're dealing with. Encoding video into HD is expensive and you should make sure that you've thought it through. Also, make sure you always offer at least one non-HD alternative for your users. HD video has a relatively large filesize (compared with low quality FLV files) and is also not supported by Flash versions older than 9.115.

If there is much demand, I can put together a tutorial on how to implement a full conversion system in PHP/MySQL. This involves: Upload, Analysis and Conversion. In each step, it's easy to offer a poor user experience and to waste a lot of money. But in the end, a good automated video conversion script can make a lot of money! I heard a rumour that some guy came up with a site using this concept called YouTube? Maybe you've heard of it...

Author

Author: Liam Gooding
Website: Goodings Media UK Web Development

I hope you find this useful. This tutorial is intended to be a work in progress, and I'd very much like users to pick it apart on the forums so that we can improve it and make it as informative as possible.