Java Program To convert rm to mp3 (Real Audio to Mp3)  

Posted by J.Naveen in

Converting real audio into mp3 format through a Java Program is very easy, for this I am going to perform two step process and two encoder libraries(Mencoder and Lame). I am going to use encoder libraries which they can convert a file data format from rm to mp3 with command line option. To convert rm into mp3 we need to covert rm file into wav file and then, from wav file to mp3 format. So the first step describes how to convert rm to wav.

First Step:
To convert rm to wav file format we need Mencoder codec, it has command line option to convert the rm input format to wav output format. This is the command for that conversion
command: mplayer d:\films\rm1.rm -ao pcm:file=rm1.wav -vc dummy -vo null
Download link for mplayer codecs. At this stage we can get the .wav file as the output, from now we can convert this file into any format.

Second Step:
This is the last step to convert Real media into mp3 format. The lame Encoder is the powerful encoder to do this process.
Command:
lame -h prefix-of-music-file_01.wav  song.mp3 High Quality
To download the Lame
there only we can find some more options like -h(this is for High Quality).
Till now we know how to convert the rm into mp3 format, use this information write a
Java program, by using java's command exec we can run mplayer and lame commands through
a java program.
The Lame and Mplayer provides libraries for windows and Linux so you can run the Java
program on any platform with these libraries. Mplayer is the most powerful tool for media
if you want to use some more options find, can here

the JAVA Program is:
//Give the file name with absolute path
//Executing this program install both the exe files
class converter{
public static void main(String args[])throws IOException{
String command1="mplayer "+args[0]+" -ao pcm:file=rm1.wav -vc dummy -vo null";
String command2= "
lame -hProcess "+rm1.wav+" "+rm1.mp3;
Process child = Runtime.getRuntime().exec(command1);
child = Runtime.getRuntime().exec(command2);
}
}




This entry was posted on Monday, May 5, 2008 at Monday, May 05, 2008 and is filed under . You can follow any responses to this entry through the comments feed .

2 comments

Been looking to find how to do this conversion for sometime. It worked, but I did it by hand. Would think there'd be a decent app here in a drag and drop variety... if it didn't seem that most (but not me) Linux users were already techies.

Thanks much!

June 30, 2008 at 7:03 AM

This is not only for the Linux users, even Linux users also became techies by experience. Actually we can do this conversion by hand but at some situation this program will play big role in a small project.

Thanks for comments

July 2, 2008 at 10:41 AM

Post a Comment