Compress Videos and Add Audio Tracks

Sunday, July 15, 2007 Posted by Aman Jain

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 I’ll show you how to do.I 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 ( . You will also be required to install Firefox( ),since Mediacoder uses Firefox in certain windows and interfaces.I have 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 coupe of clocks.You won’t need to use command line command line programs and parameters.And finally ,its free!

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.

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 this case ,I ll use the MP4 container and the x264 codec.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 .
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 MP4.Set a suitable bitrate or quality setting.For most digicam videos,800 Kbps is good enough for the standard 640 x 480 resolution .
I have chosen MP4 because of features like multiple audio streams.You are free to choose other containers but certain containers and codec may not be compatible with each other .Play around a bit to see what works.

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 its compatible with mmost media players.In the panel on the right 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.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 ,rememberthat if the audio was recorded by your camera at 64 Kbps,it isn’t going to make it sound any better if its encoded any better if it’s going to make it sound any better if it’s encoded at 128 Kbps.

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 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.
5. Encoding
Click on the Output tab and set the Output Folder .Finally click ,start .The time taken for encoding is mainly dependent on your system configuration,the quality and size of the video and on the codec you’ve chosen .

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( ,or use a player such as VideoLan( interesting and useful application is Gspot( gives you information on pretty much every format and the codecs being used ,along with the 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 to you.