Serving videos on your sites can really eat up your bandwidth. This can cost a lot of money, but so can buying Adobe's Flash software just to create videos in their format. It currently sells for about $700.
I personally use MPlayer as my video player of choice in Linux. It has an encoding program call MEncoder that we will use to convert our video. MEncoder should convert any video that MPlayer will play. If you are using Fedora Core, as I do, then you can find both MPlayer and MEncoder in the Fedora repositories. First we need a video to start with. For the purpose of this example we will use this video. It is a short, 2.4MB video of Built To Spill front-man Doug Martsch doing an acoustic version of “Car” somewhere, I do not recall the specific details. The video is DivX 4 with MP3 audio and is 480 x 360 pixels at approximately 15 frames per second. The following command will convert it to the Flash video (FLV) format. NOTE The backslash at the end of each line is used to break up commands in the shell:
[user@localhost ~]$ mencoder testvid.avi \ -ofps 15 -o testvid.flv -of lavf \ -oac mp3lame -lameopts abr:br=64 -srate 22050 -ovc lavc \ -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames -lavcopts \ vcodec=flv:keyint=50:vbitrate=300:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -vf scale 320:240
This produces a Flash video that is the same resolution as our source video. One thing you should look out for is matching the frame-rate of your source video. The section in the second line of the command,
-ofps 15, tells MEncoder to make the new video have 15 frames per second. You can find your video's frame-rate easily with the
[user@localhost ~]$ file testvid.avi testvid.avi: RIFF (little-endian) data, AVI, 480 x 360, ~15 fps, video: DivX 4, audio: MPEG-1 Layer 3 (stereo, 44100 Hz)
We are also changing the output video's resolution, when we convert it, from 480 x 360 pixels to 320 x 240 pixels. You can omit the last line,
-vf scale 320:240, if you do not wish to alter the resolution.
We are finished. You just need to upload your new FLV file to your server and integrate it into your site. I will not cover that process because it will be different for each user dependent upon your particular hosting service and/or CMS. We have managed to reduce the filesize of our video from 2.4MB down to 933.2KB. We have also managed to standardize our video so that it does not depend on the vast array of browser video plugins that our site visitors could be using – just Flash. Here's the video we have produced: