Our Dreambox 7025+ satellite receiver is not able to play many video formats because of its slow MIPS processor. Watching non-mpeg2 videos on our TV is thus only possible via its VLC plugin enigma2-plugin-extensions-vlcplayer, which requires a VLC media player process with HTTP interface running on another machine.
Since it is lame to always start VLC on the laptop just to watch videos on TV, I chose to run a VLC daemon on our home server. I replaced the old VIA Epia 500 machine with a Thinkpad last year, so it is fast enough to do the transcoding.
Using VLC as daemon on a headless machine means it should always be running, be easy to start/stop and automatically restart in case of a crash.
After setting up tinydns some weeks ago, I knew that daemontools are the right solution to turn the vlc client into a proper daemon.
Install daemontools to get svc and svscan.
$ apt-get install daemontools daemontools-run
Create a user vlcd that VLC should run as:
$ useradd -M -d /nohome -s /bin/false -u 521 -g nogroup vlcd
Setup the daemon configuration:
$ mkdir /var/log/vlcd $ chown vlcd /var/log/vlcd $ mkdir /etc/service/vlcd /etc/service/vlcd/log
Create the daemon script in /etc/service/vlcd/run:
#!/bin/sh # vlcd service start file echo starting vlc as daemon exec 2>&1 exec setuidgid vlcd vlc -I http --http-port 8081
Create the logger in /etc/service/vlcd/log/run:
#!/bin/sh # vlcd logging exec setuidgid vlcd multilog t /var/log/vlcd
Make both scripts executable:
$ chmod +x /etc/service/vlcd/run /etc/service/vlcd/log/run
The daemon will be started now, but VLC is not yet installed. So better stop it for now, or daemontools will try to run it again and again:
$ svc -d /etc/service/vlcd
Setting up vlc-nox on Debian squeeze (6.0.5) turned out to be a real problem, because it did not decode MPEG4 videos.
Note that packages from deb-multimedia.org are not needed!
Enable the Debian backports repository:
$ echo "deb http://backports.debian.org/debian-backports squeeze-backports main"\ > /etc/apt/sources.list.d/backports.list $ apt-get update
The backports line for Wheezy (Debian 7) is
deb http://ftp.debian.org/debian/ wheezy-backports main
Install vlc-nox (since we're on a headless server) from backports:
$ apt-get -t squeeze-backports install vlc-nox
It should be version 2.0.3 or higher.
Start the daemon:
$ svc -u /etc/service/vlcd $ svstat /etc/service/vlcd /etc/service/vlcd: up (pid 24912) 2 seconds
The log is /var/log/vlcd/current
In case of problems, add -vvv to the VLC parameters in /etc/service/vlcd/run and restart the service (-d, then -u).
- You may now setup the Dreambox VLC plugin to connect to the server on port 8081.
MP4 transcoding problems
When trying to view MPEG4 videos, I got the following debug output:
stream_out_transcode stream out debug: creating video transcoding from fcc=`mp4v' to fcc=`mp2v' main generic debug: no decoder module matching "any" could be loaded stream_out_transcode stream out error: cannot find video decoder stream_out_transcode stream out error: cannot create video chain main decoder error: cannot create packetizer output (mp4v)
You need ffmpeg for it, also from backports. I got version 0.8.5-1:
$ apt-get -t squeeze-backports install ffmpeg
Unfortunately, this does not help at all - VLC does not use the ffmpeg library, libavcodec, because of a bug in Debian: vlc-nox does not include /usr/lib/vlc/plugins/codec/libavcodec_plugin.so .
I noticed that by comparing the output of a working VLC client with the "broken" one on the server:
(working) $ LC_ALL=C vlc --list|grep avcodec avcodec FFmpeg audio/video decoder avcodec FFmpeg audio/video encoder avcodec FFmpeg deinterlace video filter $
(not working) $ setuidgid vlcd vlc --list|grep avcodec $
Reason for avcodec not being listed is the missing plugin libavcodec_plugin.so, which is available in the normal vlc package. Since I wanted to keep the headless VLC version, I only downloaded and extracted it:
$ mkdir /tmp/deb $ cd /tmp/deb $ aptitude -t squeeze-backports download vlc $ dpkg-deb -x vlc_2.0.3-1~bpo60+1_amd64.deb . $ cp usr/lib/vlc/plugins/codec/libavcodec_plugin.so /usr/lib/vlc/plugins/codec/ $ svc -d /etc/service/vlcd $ svc -u /etc/service/vlcd
vlc --list contains avcodec now! When playing mp4 videos, you'll get no errors anymore:
stream_out_transcode stream out debug: creating video transcoding from fcc=`mp4v' to fcc=`mp2v' main generic debug: looking for decoder module: 27 candidates avcodec generic debug: libavcodec initialized (interface 0x352300) avcodec generic debug: trying to use direct rendering avcodec generic debug: allowing 3 thread(s) for decoding avcodec generic debug: ffmpeg codec (MPEG-4 Video) started avcodec generic debug: using frame thread mode with 3 threads
Other error messages
main libvlc warning: cannot load module `/usr/lib/vlc/plugins/codec/libavcodec_plugin.so' (libva-x11.so.1: cannot open shared object file: No such file or directory)
You have to install libva-x11-1.