+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+ <head>
+ <title>Petter Reinholdtsen: entries from April 2009</title>
+ <link rel="stylesheet" type="text/css" media="screen" href="../../../style.css">
+ <link rel="alternate" title="RSS Feed" href="04.rss" type="application/rss+xml">
+ </head>
+ <body>
+<!-- XML FEED -->
+
+ <div class="title">
+ <h1>
+ <a href="../../../">Petter Reinholdtsen</a>
+
+ </h1>
+
+ </div>
+
+ <p>Entries from April 2009.</p>
+
+
+<div class="entry">
+ <div class="title">
+ <a href="../../../Recording_video_from_cron_using_VLC.html">Recording video from cron using VLC</a>
+ </div>
+ <div class="date">
+ 2009-04-05 10:00
+ </div>
+
+ <div class="body">
+
+<p>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:</p>
+
+<blockquote><pre>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</pre></blockquote>
+
+<p>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.</p>
+
+<p>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
+<tt>vlc-record</tt> to use from <tt>at</tt> or <tt>cron</tt>:</p>
+
+<blockquote><pre>#!/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</pre></blockquote>
+
+ </div>
+ <div class="tags">
+
+
+
+ Tags: <a href="../../../tags/english">english</a>, <a href="../../../tags/nuug">nuug</a>, <a href="../../../tags/video">video</a>.
+
+ </div>
+</div>
+ <div class="padding"></div>
+
+ <p style="text-align: right;"><a href="04.rss"><img src="../../../xml.gif" alt="RSS Feed" width="36" height="14"></a></p>
+
+
+
+<div id="sidebar">
+
+<h2>Archive</h2>
+<ul>
+
+<li>2009
+<ul>
+
+<li><a href="../../../archive/2009/01/">January (8)</a></li>
+
+<li><a href="../../../archive/2009/02/">February (8)</a></li>
+
+<li><a href="../../../archive/2009/03/">March (12)</a></li>
+
+<li><a href="../../../archive/2009/04/">April (1)</a></li>
+
+</ul></li>
+
+<li>2008
+<ul>
+
+<li><a href="../../../archive/2008/11/">November (5)</a></li>
+
+<li><a href="../../../archive/2008/12/">December (7)</a></li>
+
+</ul></li>
+
+</ul>
+
+
+
+<h2>Tags</h2>
+<ul>
+
+ <li><a href="../../../tags/3d-printer">3d-printer (9)</a></li>
+
+ <li><a href="../../../tags/amiga">amiga (1)</a></li>
+
+ <li><a href="../../../tags/aros">aros (1)</a></li>
+
+ <li><a href="../../../tags/debian">debian (6)</a></li>
+
+ <li><a href="../../../tags/debian edu">debian edu (6)</a></li>
+
+ <li><a href="../../../tags/english">english (10)</a></li>
+
+ <li><a href="../../../tags/fiksgatami">fiksgatami (1)</a></li>
+
+ <li><a href="../../../tags/ltsp">ltsp (1)</a></li>
+
+ <li><a href="../../../tags/multimedia">multimedia (2)</a></li>
+
+ <li><a href="../../../tags/norsk">norsk (31)</a></li>
+
+ <li><a href="../../../tags/nuug">nuug (31)</a></li>
+
+ <li><a href="../../../tags/personvern">personvern (3)</a></li>
+
+ <li><a href="../../../tags/reprap">reprap (9)</a></li>
+
+ <li><a href="../../../tags/rss">rss (1)</a></li>
+
+ <li><a href="../../../tags/standard">standard (2)</a></li>
+
+ <li><a href="../../../tags/stavekontroll">stavekontroll (1)</a></li>
+
+ <li><a href="../../../tags/video">video (6)</a></li>
+
+ <li><a href="../../../tags/vitenskap">vitenskap (1)</a></li>
+
+ <li><a href="../../../tags/web">web (2)</a></li>
+
+</ul>
+
+</div>
+</body>
+</html>