April 11, 2009

Conversion From One Audio Format To Another Using Mencoder

There are certain problems while playing certain audio file formats. Or, in other words many of us, including me, prefer mp3 file format generally. Otherwise it is ok, as long as the file plays well.

Well, now coming to conversion from one format to another, there is a convertor, so to say, named Mencoder. In Ubuntu, you can install this package using the sudo apt-get command.

After installing, conversion from, for example, .mp3 to .mp4 can be done as:

mencoder input_file.mp3 -ovc frameno -oac mp3lame -of rawaudio -lameopts cbr:br=128 -o output_file.mp4

Replace your input_file and output_file by the name of the file you are going to convert and the name for the new file.

Here, basically I needed to do this conversion for playing a .rm video file, the video of which wasn't supported in any of the players I have- VLC, MPlayer, Movie Player, etc.. (although, even after conversion, the video did not work, and I have to find a solution for it).

I used the same command, replacing the extensions (.mp3 and .mp4 as given above) of the input and output filenames with .rm and mp3 respectively.

varsha@varsha-laptop:~$ mencoder mit-6.002-lec-mit-10250-09sep2003-0000-220k.rm -ovc frameno -oac mp3lame
-of rawaudio -lameopts cbr:br=128 -o mit-6.002-lec-mit-10250-09sep2003-0000-220k.mp3

Now, I have the same file in three different formats, .rm, .mp3 and .mp4.

1 comment:

  1. This may not work with some audio formats. Use ffmpeg. Check the man page for details.