I was getting tired of connecting a laptop to the TV with a long-ass HDMI cable so I could play movies on there, or running the movies through an arcane combo of apps so the Chromecast would deign to play from Jellyfin…

,when I thought, hey, the server is near the TV, can’t that fucker somehow play to the TV directly?

The server is a barebones Debian with just the basic packages installed and everything running in Docker containers, no graphics stack. But it has an Intel CPU+iGPU and it does have a HDMI out.

That’s when I remember the framebuffer. Long story short, here’s the Dockerfile for a container that installs mpv and all that’s needed to play on the framebuffer:

FROM debian:trixie-slim
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get -y install ca-certificates openssl
COPY <<"EOT" /etc/apt/sources.list.d/debian.sources
Types: deb
URIs: https://deb.debian.org/debian
Suites: trixie trixie-updates trixie-backports
Components: main non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

Types: deb
URIs: https://security.debian.org/debian-security
Suites: trixie-security
Components: main non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
EOT

RUN apt-get update
RUN apt-get -y dist-upgrade
RUN apt-get -y install \
  mpv vainfo libdrm-tests \
  mesa-va-drivers libva-drm2 libdrm2 alsa-utils \
  nnn
RUN rm -rf /var/lib/apt/lists/*

Can probably simplify it further. And here’s a compose.yaml for it:

services:
  fbplayer:
    image: local/fbplayer:1
    container_name: fbplayer
    hostname: fbplayer
    volumes:
      - "./playmovie:/usr/local/bin/playmovie:ro"
      - "./nnn:/usr/local/bin/nnn:ro"
      - "/mnt/nas/multimedia:/media:ro"
    devices:
      - "/dev/dri:/dev/dri"
      - "/dev/snd:/dev/snd"
    group_add:
      - 44 # getent group video
      - 105 # getent group render
      - 29 # getent group audio
    environment:
      - TZ=Continent/Capital
      - NNN_OPENER=/usr/local/bin/playmovie
    entrypoint: ["tail", "-f", "/dev/null"]
    restart: 'always'

The playmovie and nnn scripts are helper scripts so I don’t have to re-type all the mpv parameters or refer the file by hand.

Here’s playmovie. Find out your audio card name and device number with aplay -l). The DejaVu fonts are installed by default on Trixie.

#!/bin/sh
case "$1" in
  *.[Mm][Kk][Vv]|*.[Mm][Pp]4|*.[Aa][Vv][Ii])
	exec mpv --vo=drm --drm-device=/dev/dri/card0 --hwdec=vaapi \
	--ao=alsa --audio-device=alsa/hw:CARD=PCH,DEV=3 --volume=50 \
	--sub-font="DejaVu Sans Mono" --sub-font-size=40 --sub-bold=yes --sub-ass-override=force \
	--sub-color="#FFFF00" --sub-border-size=5 --sub-border-color="#000000" \
	"$1"
	;;
  *)
    exit 1 ;;
esac

And here’s the nnn script (make sure to place it in a dir that’s before /usr/bin in PATH):

#!/bin/sh
exec /usr/bin/nnn -coQ /media

It’s still pretty arcane and I have to grab a shell in that container from the PC or a laptop, and remember mpv keyboard shortcuts… but at least I don’t have to run cables or fuck around with phone apps.

If anybody knows some sort of media/DLNA browser that can run in framebuffer please leave a comment. It would be nice to have some sort of UI that runs standalone on the TV all the time, and I can probably figure out how to add a bluetooth airmouse/remote or something to control it. I’ve seen some cute BT gadgets that even have a mini keyboard so you can do a quick search.

  • fightforlife@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    ·
    9 hours ago

    I have standalone Kodi running on an arch docker image with GLES/GBM which supports full HDR without a desktop environment. I can post my compose later.