Dump streams using mplayer and at

| No Comments | No TrackBacks

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).

No TrackBacks

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

Leave a comment

About this Entry

This page contains a single entry by Dobrica Pavlinušić published on December 28, 2009 6:39 PM.

LDAP server application integration with virtual LDAP was the previous entry in this blog.

Dell's RAC support under Linux == drek is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Pages

  • pics
OpenID accepted here Learn more about OpenID
Powered by Movable Type 5.04