Compress Videos And Add Audio Tracks

Published Date
01 - Jul - 2007
| Last Updated
01 - Jul - 2007
 
Compress Videos And Add Audio Tracks


Add commentary to your videos, and compress them effectively


The vacations have come to have an end, and there's a large pile of videos from your camera and camcorder lying around, clogging up your drive. Almost no digital cameras-and only some camcorders-use compression for videos. Compressing these large videos using the right formats and codecs can help bring down the size without having to sacrifice on quality, which we'll show you how to do. We will also show you how you can have multiple audio streams in a video.

One of the easiest ways to encode videos is to use MediaCoder (http://mediacoder.sourceforge.net/). You will also be required to install Firefox (http://www.getfirefox.com/), since MediaCoder uses Firefox in certain windows and interfaces. We've chosen MediaCoder for many reasons: it doesn't require you to manually download the codecs and tools required. It lets you queue up multiple files or complete folders in a couple of clicks. You won't need to use command line programs and parameters. And finally, it's free!

STEP 1. Adding Videos
You start by adding the videos you want to encode. With the program open, click Add File or Add Dir on the toolbar. Choose the files or the folder and click Open or OK. Do not attempt to encode already-compressed videos-you'll end up with larger files and extremely high encode times.

STEP 2. Video Encoding Parameters
For encoding the video, you need to decide upon the codec and format. The codec is the software that will encode the video. The format is like a container that will store the data. AVI is one of the more commonly-used containers; XviD and DivX are codecs.

In our case, we'll use the MP4 container and the x264 codec. (x264 is an open source implementation of H.264). x264 has an edge in quality over XviD, which is more commonly used. The disadvantage with using x264 is the encoding time, which can be quite a bit more than with other codecs.


Configuring settings for the video encoder


After adding the videos to the queue, click on the Video tab. Choose the Backend as MEncoder. Set the Source as Default. Then choose the codec as H.264 and the format as MP4. Set a suitable bitrate or quality setting. For most digicam videos, 800 Kbps is good enough for the standard 640 x 480 resolution.

We've chosen MP4 because of features like multiple audio streams. You're free to choose other containers, but certain containers and codecs may not be compatible with each other. Play around a bit to see what works.

STEP 3. Audio Encoding Parameters
Click the Audio tab. Set the source as MPlayer, and the encoder as LAME MP3. LAME is a free encoder that comes with MediaCoder, and MP3 is flexible enough to support a wide range of quality settings-also, it's compatible with most media players. In the panel on the right, click on the LAME tab to set the quality for the audio. Choose the rate as CBR (Constant Bitrate) if the source audio bitrates are low.


Setting up the audio encoder parameters

VBR makes more sense when you have higher bitrates. The bitrate should suit that of your video. A minute of audio at a CBR of 320 Kbps will take around 2.5 MB, whereas 128 Kbps (which isn't too much of a quality drop compared to 320) will take around 1 MB. Also, remember that if the audio was recorded by your camera at 64 kbps, it isn't going to make it sound any better if it's encoded at 128 kbps.

STEP 4. Adding Multiple Audio Streams
To add multiple audio streams-for example, to add a commentary-click on the Muxer tab in the left panel, choose the


Adding multiple audio tracks using Muxer


multiplexer as MP4Box, click Add, and point to the audio files you want to add. Then click Mux, and choose a temporary location for the multiplexed file to be dumped to.

STEP 5. Encoding
Click on the Output tab and set the Output Folder. Finally, click Start. The time taken for encoding is mainly dependant on your system configuration, the quality and size of the video, and on the codec you've chosen.


GSpot gives information on formats and codecs.


You'd probably want to send your encoded video to friends. For formats such as MP4 and codecs like H.264, the viewer would need to install ffdshow (http://ffdshow-tryout.sourceforge.net/), or use a player such as VideoLAN (http://www.videolan.org/).

An interesting and useful application is Gspot (www.headbands.com/gspot/). It gives you information on pretty much every format and the codecs being used, along with information such as the number of streams and their bitrates.

You can even encode videos to compact Flash files with MediaCoder and the steps we've just shown you.  



Rossi FernandesRossi Fernandes