« LDAP server application integration with virtual LDAP | Main | Dell's RAC support under Linux == drek »

Dump streams using mplayer and at

As you probably know, this part of the year is mostly about Chaos Communication Congress with a lot of great lectures, but you might want to record a stream or two.

When I want to schedule something at specific time, I usually use at but mplayer is picky, so at the end I used following script:

#!/bin/sh -x

mplayer http://streaming-26c3-wmv.fem-net.de/saal$1 -noconsolecontrols \
   -dumpstream -dumpfile saal$1-`date +%Y%m%dT%H%M%S`.wmv &
This will allow mplayer to detach from console, so it will work in backup. Happy hacking!

Update: stopping streams manually is not fun, so here is improved script which has three arguments: room number, from time and to time

#!/bin/sh -x

# usage: record.sh 1 13:45 15:15

room=$1
from=$2
to=$3

url=http://streaming-26c3-wmv.fem-net.de/saal$room
file=`date +%Y%m%d`-$from-$to-saal$room

echo "Record $from - $to $url -> $file"

echo "mplayer $url -noconsolecontrols -dumpstream -dumpfile $file.wmv" | at $from
echo "kill \`ps ax | grep $file\`" | at $to

If you need to see all jobs scheduled, use atq. However, there is no easy way to correlate which task will execute in which time slot in atq output, so I wrote small atq.pl script which displays commands which will be executed (you will need to run it with root privileges).

TrackBack

TrackBack URL for this entry:
http://blog.rot13.org/mt/mt-tb.cgi/671

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About

This page contains a single entry from the blog posted on December 28, 2009 6:39 PM.

The previous post in this blog was LDAP server application integration with virtual LDAP.

The next post in this blog is Dell's RAC support under Linux == drek.

Many more can be found on the main index page or by looking through the archives.

Creative Commons License
This weblog is licensed under a Creative Commons License.