]> pere.pagekite.me Git - homepage.git/blob - blog/archive/2009/04/index.html
Generated.
[homepage.git] / blog / archive / 2009 / 04 / index.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html>
4 <head>
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">
8 </head>
9 <body>
10 <!-- XML FEED -->
11
12 <div class="title">
13 <h1>
14 <a href="../../../">Petter Reinholdtsen</a>
15
16 </h1>
17
18 </div>
19
20 <p>Entries from April 2009.</p>
21
22
23 <div class="entry">
24 <div class="title">
25 <a href="../../../Recording_video_from_cron_using_VLC.html">Recording video from cron using VLC</a>
26 </div>
27 <div class="date">
28 2009-04-05 10:00
29 </div>
30
31 <div class="body">
32
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>
41
42 <blockquote><pre>URL=http://www.ping.uio.no/video/rms-oslo_2009.ogg
43 SAVEFILE=rms.ogg
44 DISPLAY= vlc -q $URL \
45 --sout="#duplicate{dst=std{access=file,url='$SAVEFILE'},dst=nodisplay}" \
46 --intf=dummy</pre></blockquote>
47
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>
52
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>
57
58 <blockquote><pre>#!/bin/sh
59 set -e
60 URL="$1"
61 SAVEFILE="$2"
62 DURATION="$3"
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 &
66 pid=$!
67 sleep $DURATION
68 kill $pid
69 wait $pid</pre></blockquote>
70
71 </div>
72 <div class="tags">
73
74
75
76 Tags: <a href="../../../tags/english">english</a>, <a href="../../../tags/nuug">nuug</a>, <a href="../../../tags/video">video</a>.
77
78 </div>
79 </div>
80 <div class="padding"></div>
81
82 <p style="text-align: right;"><a href="04.rss"><img src="../../../xml.gif" alt="RSS Feed" width="36" height="14"></a></p>
83
84
85
86 <div id="sidebar">
87
88 <h2>Archive</h2>
89 <ul>
90
91 <li>2009
92 <ul>
93
94 <li><a href="../../../archive/2009/01/">January (8)</a></li>
95
96 <li><a href="../../../archive/2009/02/">February (8)</a></li>
97
98 <li><a href="../../../archive/2009/03/">March (12)</a></li>
99
100 <li><a href="../../../archive/2009/04/">April (1)</a></li>
101
102 </ul></li>
103
104 <li>2008
105 <ul>
106
107 <li><a href="../../../archive/2008/11/">November (5)</a></li>
108
109 <li><a href="../../../archive/2008/12/">December (7)</a></li>
110
111 </ul></li>
112
113 </ul>
114
115
116
117 <h2>Tags</h2>
118 <ul>
119
120 <li><a href="../../../tags/3d-printer">3d-printer (9)</a></li>
121
122 <li><a href="../../../tags/amiga">amiga (1)</a></li>
123
124 <li><a href="../../../tags/aros">aros (1)</a></li>
125
126 <li><a href="../../../tags/debian">debian (6)</a></li>
127
128 <li><a href="../../../tags/debian edu">debian edu (6)</a></li>
129
130 <li><a href="../../../tags/english">english (10)</a></li>
131
132 <li><a href="../../../tags/fiksgatami">fiksgatami (1)</a></li>
133
134 <li><a href="../../../tags/ltsp">ltsp (1)</a></li>
135
136 <li><a href="../../../tags/multimedia">multimedia (2)</a></li>
137
138 <li><a href="../../../tags/norsk">norsk (31)</a></li>
139
140 <li><a href="../../../tags/nuug">nuug (31)</a></li>
141
142 <li><a href="../../../tags/personvern">personvern (3)</a></li>
143
144 <li><a href="../../../tags/reprap">reprap (9)</a></li>
145
146 <li><a href="../../../tags/rss">rss (1)</a></li>
147
148 <li><a href="../../../tags/standard">standard (2)</a></li>
149
150 <li><a href="../../../tags/stavekontroll">stavekontroll (1)</a></li>
151
152 <li><a href="../../../tags/video">video (6)</a></li>
153
154 <li><a href="../../../tags/vitenskap">vitenskap (1)</a></li>
155
156 <li><a href="../../../tags/web">web (2)</a></li>
157
158 </ul>
159
160 </div>
161 </body>
162 </html>