-
As part of the work we do in NUUG
-to publish video recordings of our monthly presentations, we provide a
-page with embedded video for easy access to the recording. Putting a
-good set of HTML tags together to get working embedded video in all
-browsers and across all operating systems is not easy. I hope this
-will become easier when the <video> tag is implemented in all
-browsers, but I am not sure. We provide the recordings in several
-formats, MPEG1, Ogg Theora, H.264 and Quicktime, and want the
-browser/media plugin to pick one it support and use it to play the
-recording, using whatever embed mechanism the browser understand.
-There is at least four different tags to use for this, the new HTML5
-<video> tag, the <object> tag, the <embed> tag and
-the <applet> tag. All of these take a lot of options, and
-finding the best options is a major challenge.
-
-
I just tested the experimental Opera browser available from labs.opera.com, to see how it handled
-a <video> tag with a few video sources and no extra attributes.
-I was not very impressed. The browser start by fetching a picture
-from the video stream. Not sure if it is the first frame, but it is
-definitely very early in the recording. So far, so good. Next,
-instead of streaming the 76 MiB video file, it start to download all
-of it, but do not start to play the video. This mean I have to wait
-for several minutes for the downloading to finish. When the download
-is done, the playing of the video do not start! Waiting for the
-download, but I do not get to see the video? Some testing later, I
-discover that I have to add the controls="true" attribute to be able
-to get a play button to pres to start the video. Adding
-autoplay="true" did not help. I sure hope this is a misfeature of the
-test version of Opera, and that future implementations of the
-<video> tag will stream recordings by default, or at least start
-playing when the download is done.
-
-
The test page I used (since changed to add more attributes) is
-available
-from the nuug site. Will have to test it with the new Firefox
-too.
-
-
In the test process, I discovered a missing feature. I was unable
-to find a way to get the URL of the playing video out of Opera, so I
-am not quite sure it picked the Ogg Theora version of the video. I
-sure hope it was using the announced Ogg Theora support. :)
+
One think I have wanted to figure out for a along time is how to
+run vlc from cron to do recording of video streams on the net. The
+task is trivial with mplayer, but I do not really trust the security
+of mplayer (it crashes too often on strange input), and thus prefer
+vlc. I finally found a way to do it today. I spent an hour or so
+searching the web for recipes and reading the documentation. The
+hardest part was to get rid of the GUI window, but after finding the
+dummy interface, the command line finally presented itself:
+
+
URL=http://www.ping.uio.no/video/rms-oslo_2009.ogg
+SAVEFILE=rms.ogg
+DISPLAY= vlc -q $URL \
+ --sout="#duplicate{dst=std{access=file,url='$SAVEFILE'},dst=nodisplay}" \
+ --intf=dummy
+
+
The command stream the URL and store it in the SAVEFILE by
+duplicating the output stream to "nodisplay" and the file, using the
+dummy interface. The dummy interface and the nodisplay output make
+sure no X interface is needed.
+
+
The cron job then need to start this job with the appropriate URL
+and file name to save, sleep for the duration wanted, and then kill
+the vlc process with SIGTERM. Here is a complete script
+vlc-record to use from at or cron:
+
+
#!/bin/sh
+set -e
+URL="$1"
+SAVEFILE="$2"
+DURATION="$3"
+DISPLAY= vlc -q "$URL" \
+ --sout="#duplicate{dst=std{access=file,url='$SAVEFILE'},dst=nodisplay}" \
+ --intf=dummy < /dev/null > /dev/null 2>&1 &
+pid=$!
+sleep $DURATION
+kill $pid
+wait $pid