User Tools

Site Tools


raspberry_pi_as_dedicated_looping_video_player

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
raspberry_pi_as_dedicated_looping_video_player [2025/04/22 19:45] – created tkbletscraspberry_pi_as_dedicated_looping_video_player [2025/04/22 19:55] (current) tkbletsc
Line 1: Line 1:
-====== Raspberry Pi Video Player Setup ====== ===== Basic Setup ===== * Install latest Raspberry Pi OS Lite. * At first boot, set up account: * Username: **user** * Set a password. * Run `raspi-config`: * Set up **Wi-Fi** and **SSH** (temporary, for setup only). * Set hostname (e.g. **videopi**). * Update system: * `sudo apt update`sudo apt dist-upgrade* Install VLC: * `sudo apt install vlc===== Add Video ===== * Obtain video via `wgetor `scp(e.g. with WinSCP). * Assume filename is `test.mp4`. ===== Test Playback ===== * Run: * `cvlc --loop --no-video-title-show --fullscreen test.mp4* Press `Ctrl+Cto exit. * Note: You can trigger video playback via SSH; video will display on the connected screen. ===== Enable Auto-login on tty1 ===== * Edit file: * `sudo nano /etc/systemd/system/getty.target.wants/getty@tty1.service* Change this line: * `#ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear - $TERM* To: * `ExecStart=-/sbin/agetty -o '-p -f -- \\u' --autologin user --noclear - $TERM* **Note:** This allows full system access to anyone with physical keyboard access. ===== 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 ```+====== 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 ===== 
 +  * Install latest Raspberry Pi OS Lite. 
 +  * At first boot, set up account: 
 +    * Username: **user** 
 +    * Set a password. 
 +  * Run ''raspi-config'': 
 +    * Set up **Wi-Fi** and **SSH** (temporary, for setup only). 
 +    * Set hostname (e.g. **videopi**). 
 +  * Update system: 
 +    ''sudo apt update'' 
 +    ''sudo apt dist-upgrade'' 
 +  * Install VLC: 
 +    ''sudo apt install vlc'' 
 + 
 +===== Add Video ===== 
 +  * Obtain video via ''wget'' or ''scp'' (e.g. with WinSCP). 
 +  We'll assume filename is ''test.mp4''. 
 + 
 +===== Test Playback ===== 
 +  * Run: 
 +    ''cvlc --loop --no-video-title-show --fullscreen test.mp4'' 
 +    * Press Ctrl+C to exit. 
 +  * Note: You can trigger video playback via SSH; video will display on the connected screen. 
 + 
 +===== Enable Auto-login on tty1 ===== 
 +  * Edit file: 
 +    ''sudo nano /etc/systemd/system/getty.target.wants/getty@tty1.service'' 
 +  * Change this line: 
 +    ''#ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear - $TERM'' 
 +  * To: 
 +    ''ExecStart=-/sbin/agetty -o '-p -f -- \\u' --autologin user --noclear - $TERM'' 
 +  * **Note:** This allows full system access to anyone with physical keyboard access. 
 + 
 +===== Auto-Playback Script ===== 
 + 
 +Create ''~/autoplay-on-tty-login'': 
 +<file>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 
 + 
 +</file> 
 + 
 +Create ''~/playvideo'': 
 +<file> 
 +#!/bin/bash 
 + 
 +# Loop video playback forever until Ctrl+C 
 +/usr/bin/cvlc --loop --no-video-title-show --fullscreen ~/test.mp4 
 +</file> 
 + 
 +Append this to ''~/.bashrc'': 
 +<file> 
 +# Launch video if on tty1 
 +bash ~/autoplay-on-tty-login 
 +</file> 
 +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'': 
 +<file> 
 +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 
 +</file> 
 + 
 +To actually make card read-only: 
 +  * Install overlay root: ''sudo apt install overlayroot'' 
 +  * Edit /etc/overlayroot.conf, set: ''overlayroot=tmpfs'' 
 +  * Edit /boot/cmdline.txt, append (no line break): ''fastboot noswap ro'' 
 +  * Reboot.
  
  
raspberry_pi_as_dedicated_looping_video_player.1745376325.txt.gz · Last modified: 2025/04/22 19:45 by tkbletsc

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki