Table of Contents

Raspberry Pi Video Player Setup

This will rig a Raspberry Pi to boot into looping the same video (or videos) over and over forever, e.g. for an art installation. The card is configured to be read-only, so this setup should be fairly reliable in the long-term.

Basic Setup

Add Video

Test Playback

Enable Auto-login on tty1

Auto-Playback Script

Create ~/autoplay-on-tty-login:

bash
#!/bin/bash

# This script auto-plays the video on tty1
if [ $(tty) == "/dev/tty1" ]; then
    echo "Running $0..."
    echo -e '\e[93;41m                                                                                       \e[m'
    echo -e '\e[93;41m  Auto-starting video playback in 5 seconds. Hit Ctrl+C to drop back to the terminal.  \e[m'
    echo -e '\e[93;41m                                                                                       \e[m'
    echo
    sleep 5
    bash ~/playvideo
    echo
    echo -e '\e[93;45m                                                                                       \e[m'
    echo -e '\e[93;45m  Video playback aborted. Exiting this shell will restart video playback.              \e[m'
    echo -e '\e[93;45m                                                                                       \e[m'
    echo
else
    echo "$0: This script only runs on tty1."
fi

Create ~/playvideo:

#!/bin/bash

# Loop video playback forever until Ctrl+C
/usr/bin/cvlc --loop --no-video-title-show --fullscreen ~/test.mp4

Append this to ~/.bashrc:

# Launch video if on tty1
bash ~/autoplay-on-tty-login

Reboot and test. You should be able to press Ctrl+C to drop to a terminal.

Optional: Enable TV Out

Use raspi-config to enable TV out instead of HDMI (untested).

Make SD Card Read-Only

First, leave a warning for future people – create ~/CARD-IS-READONLY-BY-DEFAULT.txt:

Note: the system is set up so that, by default, the SD card is never written to.
This means that changes you make will go away with every reboot.

If you want your changes to stick, run:

  sudo mount -o remount,rw /media/root-ro

Then make your changes in /media/root-ro -- NOT the regular directory.
So, to change something in the home directory, you'd go to:

  /media/root-ro/home/user/

For reference, here are the steps that were done to make things this way:
- sudo apt install overlayroot
- Edit /etc/overlayroot.conf: set "overlayroot=tmpfs"
- Edit /boot/cmdline.txt: add "fastboot noswap ro"
- Reboot

To actually make card read-only: