1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5 <title>Petter Reinholdtsen: entries from April
2009</title>
6 <link rel=
"stylesheet" type=
"text/css" media=
"screen" href=
"../../../style.css">
7 <link rel=
"alternate" title=
"RSS Feed" href=
"04.rss" type=
"application/rss+xml">
14 <a href=
"../../../">Petter Reinholdtsen
</a>
20 <p>Entries from April
2009.
</p>
25 <a href=
"../../../Recording_video_from_cron_using_VLC.html">Recording video from cron using VLC
</a>
33 <p>One think I have wanted to figure out for a along time is how to
34 run vlc from cron to do recording of video streams on the net. The
35 task is trivial with mplayer, but I do not really trust the security
36 of mplayer (it crashes too often on strange input), and thus prefer
37 vlc. I finally found a way to do it today. I spent an hour or so
38 searching the web for recipes and reading the documentation. The
39 hardest part was to get rid of the GUI window, but after finding the
40 dummy interface, the command line finally presented itself:
</p>
42 <blockquote><pre>URL=http://www.ping.uio.no/video/rms-oslo_2009.ogg
44 DISPLAY= vlc -q $URL \
45 --sout="#duplicate{dst=std{access=file,url='$SAVEFILE'},dst=nodisplay}" \
46 --intf=dummy
</pre></blockquote>
48 <p>The command stream the URL and store it in the SAVEFILE by
49 duplicating the output stream to "nodisplay" and the file, using the
50 dummy interface. The dummy interface and the nodisplay output make
51 sure no X interface is needed.
</p>
53 <p>The cron job then need to start this job with the appropriate URL
54 and file name to save, sleep for the duration wanted, and then kill
55 the vlc process with SIGTERM. Here is a complete script
56 <tt>vlc-record
</tt> to use from
<tt>at
</tt> or
<tt>cron
</tt>:
</p>
58 <blockquote><pre>#!/bin/sh
63 DISPLAY= vlc -q "$URL" \
64 --sout="#duplicate{dst=std{access=file,url='$SAVEFILE'},dst=nodisplay}" \
65 --intf=dummy < /dev/null
> /dev/null
2>&
1 &
69 wait $pid
</pre></blockquote>
76 Tags:
<a href=
"../../../tags/english">english
</a>,
<a href=
"../../../tags/nuug">nuug
</a>,
<a href=
"../../../tags/video">video
</a>.
80 <div class=
"padding"></div>
82 <p style=
"text-align: right;"><a href=
"04.rss"><img src=
"../../../xml.gif" alt=
"RSS Feed" width=
"36" height=
"14"></a></p>
94 <li><a href=
"../../../archive/2009/01/">January (
8)
</a></li>
96 <li><a href=
"../../../archive/2009/02/">February (
8)
</a></li>
98 <li><a href=
"../../../archive/2009/03/">March (
12)
</a></li>
100 <li><a href=
"../../../archive/2009/04/">April (
1)
</a></li>
107 <li><a href=
"../../../archive/2008/11/">November (
5)
</a></li>
109 <li><a href=
"../../../archive/2008/12/">December (
7)
</a></li>
120 <li><a href=
"../../../tags/3d-printer">3d-printer (
9)
</a></li>
122 <li><a href=
"../../../tags/amiga">amiga (
1)
</a></li>
124 <li><a href=
"../../../tags/aros">aros (
1)
</a></li>
126 <li><a href=
"../../../tags/debian">debian (
6)
</a></li>
128 <li><a href=
"../../../tags/debian edu">debian edu (
6)
</a></li>
130 <li><a href=
"../../../tags/english">english (
10)
</a></li>
132 <li><a href=
"../../../tags/fiksgatami">fiksgatami (
1)
</a></li>
134 <li><a href=
"../../../tags/ltsp">ltsp (
1)
</a></li>
136 <li><a href=
"../../../tags/multimedia">multimedia (
2)
</a></li>
138 <li><a href=
"../../../tags/norsk">norsk (
31)
</a></li>
140 <li><a href=
"../../../tags/nuug">nuug (
31)
</a></li>
142 <li><a href=
"../../../tags/personvern">personvern (
3)
</a></li>
144 <li><a href=
"../../../tags/reprap">reprap (
9)
</a></li>
146 <li><a href=
"../../../tags/rss">rss (
1)
</a></li>
148 <li><a href=
"../../../tags/standard">standard (
2)
</a></li>
150 <li><a href=
"../../../tags/stavekontroll">stavekontroll (
1)
</a></li>
152 <li><a href=
"../../../tags/video">video (
6)
</a></li>
154 <li><a href=
"../../../tags/vitenskap">vitenskap (
1)
</a></li>
156 <li><a href=
"../../../tags/web">web (
2)
</a></li>