Problem: I have a Gentoo server always on and I want to record real audio streams daily, encoding them in mp3 to listen later in my ipod.
Solution: mplayer, lame, shell script and cron
1) I wrote a script called record.sh that get an output filename and an url representing the stream to record
#!/bin/sh # Usage: # record.sh <file> <url_to_record> mplayer -quiet -cache 32 -vc dummy -vo null -ao pcm:file=$1.wav $2 > /dev/null lame --quiet --preset radio $1.wav $1.mp3 rm $1.wav > /dev/null
2) I wrote a script that grabs my favourite program. Call it for example grab_xyz.sh
#!/bin/sh RECORD=/home/pc/bin/record.sh filename=/data/shared/P2PDownload/toListen/$(date +%y%m%d)_xyz $RECORD $filename rtsp://url/xyz.rm
3) Finally I edited a cron job (cfr: crontab -e)
# Record 'XYZ from Live Stream' (from 13.30 to 14.30) 30 13 * * * $HOME/bin/grab_xyz.sh 30 14 * * * /bin/killall mplayer
4) At end I’ll find (in toListen directory)
060118_xyz.mp3 060117_xyz.mp3 060116_xyz.mp3 ..................
Ok it’s a small and simple hack but it works and it avoids to buy dedicated shareware.


Profile
this is acceptable. http://www.clarksville.bmaryland.com
Comment by schrull — July 2, 2006 @ 2:13 pm