Wikinaut / MyStreamRecorder

MyStreamRecorder - a free and simple LINUX commandline-based stream recorder (PHP) with scheduler and e-mail notification
Other
11 stars 4 forks source link

suggestion: add ogg to mp3 transcoder #2

Open Wikinaut opened 12 years ago

Wikinaut commented 12 years ago

convert ogg to mp3

for streams which come as ogg (for example dradiokultur), a transcoding to mp3 can be done either automatically after recording has finished, or on request.

Implementation:

ogg2mp3.sh (ogg-to-mp3)

#!/bin/sh
echo "Converting ogg to mp3"

if [ $# -eq 2 ] ; then
    # everything before last '.' see http://goo.gl/uSNYf
    ogg123 -d wav $1 -f - | lame -q0 -V2 -ms - $2
    exit 1
fi

if [ $1 ] ; then
    # everything before last '.' see http://goo.gl/uSNYf
    ogg123 -d wav $1 -f - | lame -q0 -V2 -ms - ${1%\.*}.mp3
    exit 1
else
    echo "Usage: ogg2mp3 infilename.ogg [ outfilename.mp3 ]"
fi
Wikinaut commented 12 years ago

mp32wav.sh ( mp3-to-wav ) or wma2wav.sh

convert mp3 or wma files to wav

#!/bin/sh
echo "Decoding mp3 to wav"

if [ $# -eq 2 ] ; then
    # everything before last '.' see http://goo.gl/uSNYf
    mplayer -vc null -vo null -af resample=44100 -ao pcm:first -ao pcm:waveheader -ao pcm:file=$2 $1
    exit 1
fi

if [ $1 ] ; then
    # everything before last '.' see http://goo.gl/uSNYf
    mplayer -vc null -vo null -af resample=44100 -ao pcm:first -ao pcm:waveheader -ao pcm:file=${1%\.*}.wav $1
    exit 1
else
    echo "Usage: mp32wav infilename.mp3 [ outfilename.wav ]"
fi