Converting RealMedia Audio to MP3
I used mplayer and lame. MPlayer decodes the input rm audio stream into a WAVE file; lame encodes that to an mp3.
Just save the following script to a file and run it on your favorite rm file.
#!/bin/bash
FILE="$1"
OUTDIR="mp3"
OUTPUT=$OUTDIR/`basename "$FILE" .rm`.mp3
# We use a fifo file so that encoding the mp3 with lame can start immediately
# after decoding with mplayer starts.
FIFO=rm2mp3.fifo
if ! test -f "$FILE"; then
echo "error: '$FILE' does not exist"
exit 1
fi
if ! test -p "$FIFO"; then
mkfifo "$FIFO"
fi
if ! test -d "$OUTDIR"; then
mkdir mp3
fi
echo "Input: '$FILE'"
echo "Output: '$OUTPUT'"
sleep 2 # Give time for user to kill if the input/output is wrong
# Show commands as they are executed.
set -x
# Send rm audio to fifo
mplayer -ao pcm:fast -ao pcm:file=$FIFO -vc null -vo null "$FILE" >/dev/null 2>&1 &
# Create MP3 from WAV
lame -h -V 6 $FIFO "$OUTPUT"
rm -f "$FIFO"
Please send along any improvements (such as better flags for mplayer/lame).
No comments yet.
Leave a comment
-
Archives
- July 2009 (1)
- March 2009 (2)
- July 2008 (1)
- May 2008 (1)
- April 2008 (1)
- March 2008 (1)
- February 2008 (1)
- October 2007 (1)
- August 2007 (1)
- July 2007 (2)
- April 2007 (4)
- August 2006 (1)
-
Categories
-
RSS
Entries RSS
Comments RSS