A colleague recently asked me if I thought the Raspberry Pi could be used as the basis for a low-cost digital signage solution, and having thought about it for a few minutes it actually seemed like it could be a very good fit.
The Raspberry Pi’s HDMI output allows it to display high-definition video and audio on an ordinary television display, and while it may not easy to render HTML5 or display PDF documents without using X Windows it is relativly simple to get the Raspberry Pi to play video content from the command line using omxplayer.
To create and edit video content I’d suggest using something like kdenlive which is a free open source video editing tool for linux. However, as it requires a something with a bit more horsepower than the Raspberry Pi, you will need a decent PC to run it. I found it relatively easy to use and it has some very useful features, including the ability to import images and them view them by panning around and zooming in.
Starting with a minimal installation there are essentially three things that we need to do. Firstly we need to disable all the console output and any error messages by configuring the Raspberry Pi to use the serial console device instead of the screen, then disable any console login messages and prevent any users logging in from the console, and lastly play the video content automatically whan the system boots.
To start you need to be running as a superuser.
$ sudo -i
Disable the Console
To hide the Raspberry Pi logo and stop the console messages scrolling up the screen as the system boots we need to configure the system to use the serial port as the default console.
# vi /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200
root=/dev/mmcblk0p2 rootfstype=ext4 rootwait logo.nologo
Disable Console Logins
To prevent the console from displaying a login prompt and to stop users logging in we need to modify inittab, commenting out the two lines shown below to disable the normal virtual consoles that would be shown on the screen and enabling the serial console by inserting the line shown in the next section.
# vi /mnt/etc/inittab
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run X.
#1:2345:respawn:/sbin/getty 38400 tty1
#2:23:respawn:/sbin/getty 38400 tty2
#3:23:respawn:/sbin/getty 38400 tty3
#4:23:respawn:/sbin/getty 38400 tty4
#5:23:respawn:/sbin/getty 38400 tty5
#6:23:respawn:/sbin/getty 38400 tty6
# Example how to put a getty on a serial line (for a terminal)
T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
Automatically Start Playback
Since omxplayer isn’t in the official repository you will have to download the package your self from here. Begin by installing the prerequisites for omxplayer first.
# apt-get install dbus fonts-freefont-ttf libcap2 \
> libdbus-1-3 libfreetype6 libsystemd-login0
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
dbus fonts-freefont-ttf libcap2 libdbus-1-3 libfreetype6 libsystemd-login0
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 6,967 kB of archives.
# wget -c 'insert link to download here'
# dpkg -i omxplayer*.deb
To have omxplayer start automatically when the system boots you need to modify inittab. In the example below the video will be played continuously using the HDMI audio output.
# vi /etc/rc.local
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# By default this script does nothing.
while true; do
# For analogue audio output uncomment the following line
#omxplayer -b -o local /home/video.mpeg
# Alternatively to use the HDMI audio output uncomment the following line.
omxplayer -b -o hdmi /home/video.mpeg
Note – Since the script in rc.local never exists you will not be able to login on the console. Use SSH instead if needed or rather than play the video directly use a seperate script.
Raspberry Pi is a trademark of the Raspberry Pi Foundation