Plays folders of videos on a loop from boot, with a controller menu, per-video on/off, play settings, a logo boot splash and a nightly YouTube sync. Tested on a Raspberry Pi 4; x86 paths are untested. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5.7 KiB
Recreating this setup
How to build the enrichment player on a new machine, what is different on x86, and
what was learned on the original Raspberry Pi. README.md covers daily use.
Status: built and tested on a Raspberry Pi 4. The x86 paths in the code and installers have not been run on x86 yet. Expect to tune them there.
What the repo does not contain
- Videos. Copy them to
~/enrichment_videos/<folder>/. Files directly inside a folder are played; sub-folders are not searched. The Pi'sKyafolder came fromthebears@tree:/home/thebears/Downloads/enrichment-videos/Kya. Runscpfrom~/enrichment_videos, not from inside the folder, or it nests asKya/Kya. - State. Recreated automatically in
~/.local/state/enrichment_player/:last_folder,last_video,display,settings.json,disabled.json,youtube_archive.txt. Copydisabled.jsonandsettings.jsonto keep those choices. ~/enrichment_videos/youtube.txt. Optional. Lines ofFolder name | link. A link already inyoutube_archive.txtis skipped, even if its file was deleted.
Install
git clone ssh://gitea@winslowthehedgehog.com/thebears/enrichment-shower.git
cd enrichment-shower
./install.sh # as the user that will own the player, with sudo rights
sudo reboot
install.sh installs packages, adds the user to video render audio input, allows
that user to run plymouth and plymouthd through sudo without a password, installs
yt-dlp and deno to ~/.local/bin for this CPU, sets up the boot splash, fits the
unit files to this user and folder, and enables the player and the nightly sync.
Log files: sudo journalctl -u enrichment-player -f. Each button press is logged as
control: ..., and each time limit as max time reached.
What is different on x86
| Area | Raspberry Pi 4 | x86 |
|---|---|---|
| Detection | /proc/device-tree/model |
Anything else counts as x86 |
| Video | --hwdec=v4l2m2m,drm, frames sent to a display plane |
--hwdec=auto-safe, through the GPU |
| Boot options | /boot/firmware/cmdline.txt, config.txt |
/etc/default/grub, then update-grub |
| Forced display | Both HDMI ports, always | Only with FORCE_DISPLAY=<name> |
| Audio | HDMI card matching the picture port | mpv's automatic choice |
| Display driver at boot | vc4 added to the initramfs |
Whatever Debian includes |
To set up on x86:
- Force the display. List ports with
ls /sys/class/drm, then runFORCE_DISPLAY=HDMI-A-1 boot/install_boot.shwith the right name. - Video decoding. Install the driver:
intel-media-va-driverori965-va-driverfor Intel,mesa-va-driversfor AMD. mpv needs a working DRM driver; NVIDIA's proprietary driver is the likeliest to need extra work. - Audio. If sound goes to the wrong output, list devices with
mpv --audio-device=help, then havehdmi_audio_device()return that device. - BIOS. Set "restore on AC power loss" to Power On, or it won't start when plugged in. Secure Boot and fast-boot settings may also matter.
- Check smoothness. With the player running, read
frame-drop-countfrom mpv's socket in/tmp/enrichment-player-*/mpv.sock. Watch the speed too: dropped frames can look like zero if playback is running slow.
Boot settings on the Pi
Added to /boot/firmware/cmdline.txt, which must stay a single line:
quiet splash loglevel=3 logo.nologo vt.global_cursor_default=0
plymouth.ignore-serial-consoles
video=HDMI-A-1:1920x1080@60D video=HDMI-A-2:1920x1080@60D
Added to config.txt: disable_splash=1. Added to
/etc/initramfs-tools/modules: vc4. Added to
/etc/initramfs-tools/conf.d/splash: FRAMEBUFFER=y.
Versions in use: Debian 13 (trixie), kernel 6.18.50+rpt-rpi-v8, mpv 0.40.0, ffmpeg 7.1.5, plymouth 24.004.60, python3-evdev 1.9.1, yt-dlp 2026.10.26, deno 2.9.8.
Why it is built this way
Each of these came from a measurement on the Pi, and is easy to undo by accident.
- Display planes, not GPU compositing. At 1080p60, H.264 through the GPU dropped 10 or more frames a second. Direct to a plane: no drops at about 40% of one core. Software decoding used about 200% and dropped frames, especially alongside a download.
- The OSD plane must be above the video.
--drm-draw-plane=overlaywith--drm-drmprime-video-plane=primary. The other way round hides the menu. - Forcing both ports means both report connected. A real screen is the one with
EDID data, so
choose_connector()trusts that and remembers the last answer. - Card numbers change between boots (
card0orcard1), so never hard-code them. - Splash hand-over.
plymouth quit --retain-splashbrought the text console back for over a second.plymouth deactivatekeeps the image on screen; quit only after the first video frame. time-posappears about 2 seconds before any picture. Wait until it moves.- Cold starts are slow because nothing is in memory, so mpv runs once behind the logo.
- The splash needs root, hence the sudo rule. It needs
plymouth-labelfor text, andsplashon the kernel command line or it falls back to plain text. - Limit-aware start. A video longer than the time limit starts where the whole limit can play: 1 hour of a 9 hour video starts 0 to 8 hours in.
Unfinished
- A real power pull, and power-on with the HDMI cable unplugged, are untested.
- Sound has never been confirmed by ear.
- The real F310 buttons need checking, X in particular.
- Max time failed once on the real player for an unknown reason, then passed twice.
- The Pi looks for an SD card before USB.
BOOT_ORDER=0xf14should shorten the black screen before Linux starts; not done. - The Pi boots from a USB flash drive, which is the weakest part for power cuts.