Transcoding RealMedia to MP3
| View CommentsThis article is about transcoding a real media audio file to a ordinary mp3 file using mplayer and lame.
This procedure will work basically with every input audio file that is playable with mplayer. Be it OGG/M4A/RMA/WAV/… no matter what. With a little effort is is also possible to rip audio streams and convert them after recording or if supported on the fly.
This very example works the following way. Get binaries from the aforementioned programs for your favorite OS. Install them or make them somehow ready to execute. You need a terminal or every other command line interface. We have a generic input audio file called input.rm and will use a temporary intermediate file in PCM/Waveform format called temp.wav and the target file target.mp3. After transcoding, the input file and the temporary file can be removed.
Step 1
We will dump the audio information from the file in PCM format.
mplayer -vo null -vc dummy -af volume=0,resample=44100:0:1 -ao pcm:waveheader:file=temp.wav input.rm
This will result in a big .wav file with the uncompressed audio information wich can now be fed to your desired encoder, lame in this example.
Step 2
You can tweak the output of lame as you see fit by presets for example. For more information see the lame documentation.
lame --abr 96 "$f".wav
Let lame do the magic and after some little time you have a .mp3 file. Total transcoding time depends on your hard disk performance and CPU power.
In the end I want to give a little example of how to create a automated script.
for f in "$@"
do
mplayer -vo null -vc dummy -af volume=0,resample=44100:0:1 -ao pcm:waveheader:file="$f".wav "$f"
lame --abr 96 "$f".wav
rm "$f".wav "$f"
done
Please post comments below.

-
AlienMind
