[MPlayer-users] mplayer - recording streaming media

andrew andrew.david.45 at gmail.com
Thu Jun 5 23:39:59 CEST 2008


On Thu, Jun 05, 2008 at 02:57:31PM +0200, Christian Schramm wrote:

> I've created a script that will record streaming audio as follows:
> ..............
> # Schedule mplayer to rip stream to file
> nohup /usr/bin/mplayer -really-quiet -cache 512 -playlist 
> http://example.net/blabla.asx -vo null -ao pcm:file=$tmp_file_name 
> </dev/null &
> 
> # Get PID of this mplayer process
> mplayer_pid=$!
> 
> # Schedule process to kill mplayer after designated time
> nohup /home/user/stream_record/recorderStop.sh $mplayer_pid $2 $1 &
> .............
> 
> This works as follows.
> The recorderStart-script receives 2 parameters: 1. filename, 2. time to 
> record in seconds.

Just a quick comment from the peanut gallery:

Could you not eliminate your 'recorderStop' script by setting a
duration variable and using sleep? (I personally use this technique).
A quick example:

----------
#!/bin/sh
mplayer blah blah blah &
sleep 2.1h            # mplayer still runs in background
kill $!               # kills the most recently backgrounded process
lame blah blah
-----------

This works well for me with streams where -endpos is not suitable.

     Andrew
-- 
http://www.andrews-corner.org



More information about the MPlayer-users mailing list