February 16, 2010

Converting MP3 to AAC using Mediacoder

Music buffs tend to have huge music collections, ranging in 10's of gigabytes(I've a 25 GB collection myself... :D). I know people who have collections ranging from 50-100 GB as well. There arises a need for more space to store even more music... You can always increase your storage space, but it can be expensive.

This is where Mediacoder comes into picture. If you've read one of my earlier posts(Feb 2010) , You'll know that AAC has been designed to be a successor to MP3. It's more efficient, offers a much larger bandwidth to store a higher range of frequencies and can store many more channels than MP3 in a single file.

AAC is a far better format than MP3 for storing music since it can store the same quality as an MP3 file in a file which is around 75% as large. It may not seem like much, but my 25 GB music collection in MP3 would take up around 31.25 GB.. That's a helluva lot of difference!

AAC is slowly catching on as a music format. The Apple iTunes Store sells their music only in AAC, The iPods have been supporting AAC since 2003, the new portable media players from Sony, Samsung and all the other well known brands support it as well... and most importantly, all Nokia NSeries and ExpressMusic  phones, as well as the Sony Cybershot and Walkman phones support it as well...all their upcoming phones will also support it. Let's face it....who wouldn't say no to be being able to store more music on their cell's memory card?

You don't have to worry about being able to play it on your PC either. Microsoft's new OS, Windows 7, comes packaged with native AAC support. Xp and Vista users need not worry either. There's a large group of players which come with support for AAC. VLC Media Player,Winamp and iTunes are some of the more popular ones. Installation of codec packs should allow Windows Media Player to play back these files as well.

In order to begin, download and unzip Mediacoder from HERE. I'm too lazy to make new screenshots just for the audio conversion, so you can refer the pics from my earlier post(Find it HERE). Load up the MP3 files in Mediacoder. Adding your music folder recursively should load all your files from all subdirectories, else only the files in that particular folder will be added.

If you've loaded up multiple folders, and you don't want to lose your organisation, checking the "Preserve Folders" option under the Generic tab will ensure that all your converted files are arranged in the same manner as the original files were.

Under the Video tab, uncheck the "Enable Video" option. This is because you'll only be encoding audio streams. Under the Audio tab, check the "Enable Audio" option. In the Source option, choose either ffmpeg or mencoder, it doesn't matter. I prefer to use ffmpeg, even though it's slightly slower. Mencoder has a tendency to crash after processing 30-35 tracks. Works perfectly fine for a few tracks, though.

Choose your encoder as "Nero AAC Encoder". This is an encoder developed by the same guys who gave us Nero Burning ROM(Seriously, if "Nero" didn't ring a bell, go and bang your head against a wall or something...), the almighty tool for burning CDs,DVDs and now Blu-Ray Discs as well...!

On the right, select the "Nero Encoder" tab(if it's not already opened up), select the profile as "LC-AAC"(I'll explain about the different types of AAC in a minute), the rate mode as "Target Bitrate". Select a target bitrate corressponding to the bitrate of your source MP3 file(s). Here are some of the most common bitrates for MP3 and their corressponding bitrates that you should use in AAC.

MP3 Bitrate        -             AAC Bitrate
128                                              96
192                                            144
256                                            192
320                                            256

As a general rule, to get an equivalent bitrate, multiply the bitrate of your MP3 file by 0.75.

If you want to find out the bitrate of your source file, right-click on it in Mediacoder, and click on "Details of selected file" or press F8.

Different types of AAC:
  • LC-AAC:-The simplest and most widely accepted
  • HE-AAC:-Slightly higher quality than LC-AAC, but only at low bitrates. Mainly used for streaming data over radio signals.
  • HE-AACv2:-Improvement over the HE-AAC format.

You can use HE-AAC if you wish, but I prefer LC-AAC.

Under the Container tab, select default. For the multiplexer, click on Auto Select.

Under the Text tab,check Transfer Tags. This is to ensure that most(if not all) metadata from your MP3 files gets transferred to your AAC files. I'll explain about metadata and how you can use it to organise your music collection very easily in a day or two.

Once you're done with all the settings, click on Start. And wait for Mediacoder to finish. Once it's done, and you've ensured that all the converted files are playing back fine, you can either delete all your MP3s(Sacrilege!) or burn them onto discs or move them to an external drive for backup... Enjoy your freed up space!

That's it for today... I'll be back in a day or two...

Have a nice day
Vinay

Conversion of .avi to .mkv with Mediacoder

To all the video and audio enthusiasts out there, who need a good software to convert different video and audio files to different formats, give Mediacoder a spin...

It's an excellent software. I've been using it for about a year. It's completely free, comes with both x86 and x64 based installers and can handle almost every format there is.. It also has features usually found only in commercial video transcoders.

I've downloaded Mediacoder(x86 edition) along with all the useful plugins, zipped it into a file and uploaded it on mediafire. Download it HERE. Please keep in mind that Mediacoder also needs Mozilla Firefox to run. It can downloaded and installed HERE.


Please read my earlier post on audio and video formats and containers if you haven't already. Today's tutorial is meant to teach you how to use Mediacoder to convert your .avi files to .mkv files in order to save storage space.

Download Mediacoder either from my earlier link or from HERE. The software you download from the newer link will be the latest edition, but you'll have to install a good no. of plugins separately, while my earlier link has all the plugins built in. Download and unzip the file to C:\program files\Mediacoder. Click on the screens below to display them fully.

Navigate to the folder, right-click on mediacoder.exe and click on Send To->Desktop.



Open Mediacoder, and click on the leftmost button on the top, click on "Add File" and open the file(s) you want to convert.



Select the output folder on the top right-hand corner. This is where the new file after conversion will be stored. Something pretty neat about Mediacoder... look on the bottom left on the Generic tab. If you've got a dual core processor, you can set Mediacoder to use only one of your cores. This will slow down Mediacoder, but you'll be able to use your PC much more freely with one of your cores being free..



Click on the Video tab. Make sure the "Enable Video" checkbox is ticked. Otherwise, the output file will have no video... Select the format as H.264 and the mode as 2-pass. 2-pass encoding is much better than the standard single pass encoding.



In order to understand why, knowing what bitrate is is crucial..bitrate is the no. of bits allocated to each frame of the video. Higher the bitrate, higher the quality...this of course depends on the fact that the source must be of good quality as well. Just giving high bitrates when the original video is bad quality will not improve video quality.

On the first pass, it runs through the entire file once, and decides which parts of the video require a higher bitrate(Ex:Action sequences)and which ones don't. On the second pass, it allocates the required bitrate to the right frames. Else, it would've given all the parts of the video the same bitrate which results in waste of storage space.

In the box below the Mode option, type in the max. bitrate allowed. This will be the max. bitrate that will be allocated to any frame that requires it. Set it between 750 to 900 for standard video. If you're encoding an HD source, set it to around 1200.

In the source tab, set it as either ffmpeg or mencoder. This is what is used to decode the source video. If ffmpeg doesn't work, try again with mencoder or vice versa. Set the encoder as x264. Uncheck the "Auto Select" option before doing so. Click on the "Advanced" option under the x264 tab on the right. Some advanced options should be set here in order to get the best out of your video conversion. In the window that opens up, ensure that you set the highlighted options to the same values that is shown in the screenshots. DON'T touch the others!






I'm not going to explain everything about these options because I myself haven't managed to understand yet how all the components work. I will however, tell you what options to set to improve efficiency and get the best quality out your video. Just follow the order of options in the pictures and set the values.

Points to remember:
  • Tune the settings for whatever is required based on the video you are encoding.
  • Set the p-frame quantizer as 22. This gives a good tradeoff between quality and file zise. And for the mathematicians, the scale is a logarithmic scale, so a small change in the value here can give a considerable difference in quality.
  • Set the no. of predictors in B and P frames as 5. Set the no. to 10 or so if you're encoding animated videos.
  • Make sure that CABAC is enabled.
  • Ensure that motion search algorithm is of the type Uneven Multi Hexagon and set motion search radius around 16-24 for normal videos and 25-35 for action videos.
  • Set the subpel refinement quality to 7 or 8. 7 offers slightly higher encoding speed,while 8 offers slightly better quality.
Once you've set all the options, close the window and click on the audio tab.



Again, ensure that the "Enable Audio" checkbox is ticked. Select the source as either mencoder or ffmpeg. Set the encoder as FAAC. On the right, under the FAAC tab, select "Average Bitrate" and set it to around 128 for normal speech, and around 144 if the source contains music. You can set it to max of 256 if the source has high quality music and you wish to preserve it. Set the Container as MP4.

You're almost done(Yay!). Click on the container tab.


Select the container as Matroska, click on "Enabled" and select MKVMerge as the multiplexer. This will create an .mkv file as the container and MKVMerge is the multiplexer which merges the two audio and video streams together.

Note:If you want to convert the video for using on an Apple iPod, It can be done easily here. Select the container as MP4, and the multiplexer as MP4Box.




Now, onto the Picture tab...


Here, you can resize the video if you require. just uncheck it if you want to keep the same file size. Resize to 320x240 for iPods. Clicking on the "Effects" option will bring something really great...




Here, you can apply certain effects to the video if you want, increase the brightness, contrast, etc. Leaving them at the default will not change the video. Noisy or grainy videos can be cleaned under the "Denoiser" option. Select either the Temporal 3D or Normal 3D options.

I've used paint to blur whatever video I was editing. Nothing special about the video. just wanna remain safe.


You can also use the "Mark In" and "Mark Out" options to transcode only certain parts of the video(I can now extract certain parts from movies....Yeah!!). Click on "OK" when you're done.

Moving on....
 

 The options in the Sound tab can allow you to apply effects to Sound....duh! Leave the settings as they are if you don't want to change the audio. The Gain option will allow you to increase or decrease the volume of the audio. The scale is in decibels, so watch out!


You're done! Click on Start, and you'll begin transcoding. It takes quite a while to transcode video, so be prepared to wait a while. Converting .avi to .mkv can take upto 2 hrs of your time or even more, depending on your processor speed and no. of cores..


That's all for now... thanks for reading.. hope you found it useful.. Music buffs will find my next post especially useful... Wait for it.. it'll be coming later tonight..

Have a great day..
Vinay

February 13, 2010

Video and audio codecs

Most of us have seen and used avi files to store our videos. These files consist of a separate video stream and audio stream(both of different formats) and stored in a container which is capable of holding both the audio and video streams. Here, avi is the name of the container used. These audio and video streams are compressed or encoded with different codecs.

Why the need for compression or encoding? You see, storing multimedia in its uncompressed or raw forms eats up storage space. A 90-minute uncompressed movie will easily fill our entire hard drive. Over the years, various codecs(coder-decoders) were developed, which implemented algorithms to allow us to encode multimedia and reduce their file size considerably, with as high quality as possible.

Some of the more common video codecs are Xvid and DivX. They are used to encode the video streams for .avi files. The audio streams are usually encoded in good old mp3 using the LAME encoder. While these codecs are extremely good in their own rights, they are relatively outdated. With the introduction of HD video and HD surround sound, something new was needed which could compress these high quality audio and video streams efficiently. Enter H.264 and AAC....

H.264 and AAC are the new codecs used for encoding HD video and multichannel audio streams. H.264 is capable of encoding a full HD movie to fit in a single 25-GB disc. H.264 has been designed to be highly efficient, while preserving high video quality.

AAC, on the other hand, has been designed to be the successor to mp3. Mp3 has been the king of the audio formats for around 10 years, but it has various shortcomings, which led to the creation of AAC. AAC has the ability to store many more audio channels than mp3 in a single file and is more efficient.

While AVI can still be used for holding H.264 streams, it can't hold AAC streams without a lot of problems. Matroska is a relatively new container which has been developed to hold a large number of different audio and video streams. You might have come across these files, they end in .mkv extension. Matroska is one of the containers capable of holding H.264 and AAC streams. 

While HD technology is a far cry from becoming mainstream, the codecs are definitely not! Implementations of these codecs are easily available for free download. Since these codecs are much more efficient than the earlier codecs, you can use them to convert your video and audio files to a format which occupies less space while preserving the same quality, or maintain the same file size with a higher quality file. The popular multimedia players like VLC Media Player, Windows Media Player 12 and Winamp come preinstalled with all the codecs required to play back these files. Installation of codec packs like KLite Codec Pack and Shark007 Codecs should also enable older versions of these players to play back such files.

So what would you need in order to do this conversion? You'd need a program that serves as a mediator between you and the codecs, which allows you to set the conversion settings for your files and which can manage the efficient use of these codecs. One such program is Mediacoder, which is available for free download off the net. Give it a try!

That's all for today... I'll be back soon with a tutorial on how you can use Mediacoder to convert your videos to .mkv files.. Wait for it!

Have a great day,
Vinay