Creating a hacky linux digital signage system



In my workplace there was a digital signage system set up by a commercial operator.  It displayed videos, slides and webpages, and had a rather attractive content management system.  Weirdly, rather than sitting atop a stable OS, it used an old version of Fedora – bleeding edge wobbliness no longer supported by security updates – nice.

One day, a portable appliance tester switched it off, and upon his departure it failed to reboot.  After reading the logs and contacting the company, they suggested sending it back for £180.  Being from Yorkshire, I found this unacceptable so I started looking for alternatives.

First up was Xibo which looked pretty promising, but after a few false starts and actually reading the documentation, this had to be run on Ubuntu 10.04 which is again, quite an old base, plus it seemed quite a ball-ache getting the dependencies for a Debian base (my preferred option for stability).  After getting it installed on my hardware, the video was choppy – too choppy to be of use.

I checked out a couple more options like Concerto and some others (didn’t quite meet my specifications) I had a thought: What do I actually want this system to do?  Well, I want it to show a webpage for about 30 seconds, and then play a folder of media and I want to be able to run on pretty low spec hardware.  The first thing I did was work out my ‘player’ – a shell script that does the stuff I want:

while true; do
timeout -k 31 30 midori -e Fullscreen -a http://website/
cvlc --play-and-exit --fullscreen --no-osd --playlist-tree /home/user/player/*

The first line specifies the display in case I want to start it from SSH, followed by a While loop to… loop the script.  ‘Timeout’ is a handy application to run processes for a set period of time.  Here, it’s for 30 seconds, with the -k (kill) option killing the process after 31 seconds in case it doesn’t stop for whatever reason.  I initially used Chromium as the browser in kiosk (fullscreen, no decorations) mode, but then found that the lighter Midori browser was snappier.

VLC kicks ass – that’s a given, and here I’m using the command line version CVLC.  By default, it plays videos and importantly, slides/images for 10 seconds when in a playlist, so it didn’t need any configuration from me (you can however change the image display time in the GUI version).  The flags I have in there are pretty straightforward: --play-and-exit errm… plays and exits, --fullscreen shows the media in fullscreen mode, --no-osd hides the filenames from showing and --playlist-tree enables a playlist mode (which I didn’t end up using).

This script worked, although there was a brief showing of the desktop between VLC stopping and Midori starting, so I turned this into a feature.  As my base system was Linux Mint 17 XFCE I set the panel to hide and set the desktop background to some corporate branding.  Huzzah!  Now I get a graphical branding sting and everything looks intentional!

As the box itself would be stuffed into a roofspace area, I set up an autologin to the X session and made sure I had openssh-server installed for access purposes.  I also stuck Vino VNC server on there so that I could have a check what was playing remotely.

VGA and Plasma Screens – Annoying Resolution Issue

My testing of everything with a regular monitor was fine, however when plugged into the plasma screen, the correct resolution1 (1366×768) was not detected.  I could correct this by creating a mode in xrandr but this would revert back on each reboot – time for another script.

Another issue was that the mouse pointer was showing on the screen during the Midori bit, so I installed a ‘hide the cursor’  programme called Unclutter and threw that in the script as well:

xset -dpms off &&
xset s noblank &&
xset s off &&
unclutter -idle 0 &
xrandr --newmode "1366x768_60.00" 85.25 1368 1440 1576 1784 768 771 781 798 -hsync +vsync &&
xrandr --addmode VGA1 "1366x768_60.00" &&
xrandr --output DVI1 --off --output VIRTUAL1 --off --output LVDS1 --off --output VGA1 --mode 1366x768_60.00 --pos 0x0 --rotate normal &&
sleep 8s &&

So, in order, we hide the cursor, create and add a new display mode, switch to that display mode, wait 8 seconds and start my player script.

Users and Adding Media

At first, I figured our regular users could use something like Filezilla to connect and copy their images and videos to the playlist folder, so I wrote a guide for them to do that.  And then I thought a better solution would be to mount a network folder via an entry in /etc/fstab.  This now means that our users can just dump their stuff in a specific folder, and sure enough, it then appears on the screen.

//SERVER/Path/To/Shared/Folder404/Plasma_Playlist/ /home/user/player cifs username=Blahh,password=obvious,sec=ntlm,noserverino,rw,file_mode=0777,dir_mode=0777 0 0

This didn’t work at first because of a space in the network path (“Folder 4”).  As the fstab file uses spaces you have to replace them with a 40.  It took me a while to work out what was wrong, so I figured this could be useful for someone else with the same issue.

Extra Bits

I wanted a nice splash screen on reboot so I chose the lovely Numix Plymouth theme (I love Numix!) which is a pleasing red background and a swooshing line.

Edit 2: One of the screens kept blanking every so often so I had to add the ‘xset’ bits to the boot up script.

1. Although the screen could do ‘Full HD’ with HDMI, the max setting for VGA was this. I’m not sure why but never mind.