Skip to content
mathieuletyrantPublic

About

πŸ’‘ Philips Hue ambilight for Jellyfin: films analyzed once, lights follow the screen. No Sync Box. Rust + React, Umbrel app.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

lueur

lueur

Philips Hue ambilight for Jellyfin, from your home server. No Sync Box, no PC, no Hue Sync app: each film is analyzed once, then your lights follow the screen.

Image Rust React Umbrel

Now playing: the film, the sync offset, and each light of the entertainment area with its live color

✨ Features

Sync

  • 🎬 Any Jellyfin client: Apple TV, TV, phone, browser. lueur follows playback, seeks and pauses
  • 🌈 Per-light colors: each light of the Hue entertainment area takes the color of its side of the screen, 50 times per second
  • 🎞️ Black bars ignored: letterbox and pillarbox are cropped before the colors are computed
  • ⏱️ Locked clock: playback reports are pushed by Jellyfin's WebSocket and timed by lueur itself, the lights don't stutter between reports
  • 🎚️ Sync offset on the Now page, to cancel a TV's or an app's delay
  • πŸ’€ Lights come back: when playback stops, the lights return to their previous state

Analyze

  • ⚑ Once per film: ffmpeg decodes on the GPU (VA-API on Intel, VideoToolbox on macOS) and only keeps a tiny image per frame, many times faster than real time
  • πŸ“¦ Small tracks: a 16Γ—9 color grid and finer Edges for a Strip, 24 times per second, about 40 MB per film (zstd)
  • πŸ”„ Auto scan: new films and episodes are found every 5 min to 6 h, tracks of deleted or replaced files are cleaned up
  • πŸ” On demand: analyze everything missing, or a single film or episode from the list, stop at any time
  • 🌑️ Gentle on the server: a speed preference from Gentle (5Γ—) to Hurt my GPU, analysis hours, lowest CPU priority
  • πŸ†• On first playback: a film played without a track is analyzed first, and the lights join in as soon as it is done

App

  • 🧭 Guided setup: bridge discovery and pairing, entertainment area, Jellyfin, libraries
  • 🎚️ Live look: intensity presets from Subtle to Intense, then brightness, saturation, smoothing, spread and warm greys, applied during the film
  • πŸ’‘ Find a light: click one in the area view and it blinks
  • 🐳 One container: a single Rust binary serves the player, the API and the UI
Library: analyzed films and episodes with their barcodes, and the queue Now playing on a phone

πŸš€ Run it

β˜‚οΈ Umbrel

Add the community app store https://github.com/mathieuletyrant/umbrel-community-app-store, install lueur and allow GPU access. Umbrel's Jellyfin and lueur both see your files under /downloads.

🐳 Docker

docker run -d --name lueur -p 8080:8080 \
  -v lueur-data:/data \
  -v /path/to/media:/media:ro \
  --device /dev/dri:/dev/dri \
  ghcr.io/mathieuletyrant/lueur:latest

Open http://localhost:8080 and follow Setup, then Library β†’ Scan now.

Env Default
LUEUR_CONFIG /data/lueur.json Config written by the UI; the tracks go to tracks/ next to it
LUEUR_PORT 8080
RUST_LOG lueur=info See Debugging the lights; lueur=debug adds every playback report

The image is amd64, tagged latest, x.y and x.y.z. --device /dev/dri is optional: without a GPU, the analysis runs on the CPU.

Tip

Bridge discovery uses the Hue cloud, which works from inside Docker, and mDNS, which needs --network host. You can always type the bridge's IP.

πŸͺΌ Jellyfin

  1. Create an API key (Dashboard β†’ API keys). It must be an admin key, to read file paths.
  2. In lueur β†’ Setup β†’ Jellyfin, paste the server URL and the key. On Umbrel: http://jellyfin_server_1:8096.
  3. Optionally, follow one device only, e.g. the living room Apple TV.

Tip

When Jellyfin and lueur see the files under different paths (different containers or machines), pick lueur's folder for each library in Setup β†’ Libraries.

πŸ’‘ Hue

  1. In the Hue app, create an entertainment area around your TV (Settings β†’ Entertainment areas) and place the lights where they are.
  2. In lueur β†’ Setup, pick your bridge and press its link button.
  3. Lights late or early on cuts? Use Sync offset on the Now page (Β±0.1 s buttons).

🎞️ WLED strip

A WLED strip behind the TV gets one color per LED, sent straight to the controller (DDP), in place of the Hue area. In Settings β†’ Lights β†’ WLED strip, pick the controller (found on the network, or typed), then say where LED 0 is, which way the strip runs, and how many LEDs are behind each side of the TV. The drawing shows the result; click a LED to make it blink on the strip, or play the rainbow. Switch back to Philips Hue to go back to the Hue area.

The same settings live in lueur.json:

"wled": { "host": "192.168.1.80", "start": "bottom-right", "clockwise": false, "right": 35, "top": 65, "left": 35, "bottom": 0 }

Look: test on a frame of a film, intensity presets and the sliders

πŸ”Ž Debugging the lights

While a film plays, the logs (docker logs lueur) tell what the lights did:

Line Means
look: Look { … }, measured exposure Γ—1.40 The Look in use, at each film's start and whenever it changes
clock started at 12:34 from Apple TV's report Playback picked up: a new film, a pause or a resume
clock jumped +0.92 s to 12:34 The app's report was off by more than 0.75 s: the lights moved in the film at once
clock off by +0.31 s at 12:34, corrected gently Off by 0.1 to 0.75 s: a fifth of it is corrected
lights step 0.82 β†’ 0.10 in 0.30 s at 12:34.5; picture 0.61 β†’ 0.05; no clock jump The brightest light changed by 0.3 or more within 0.3 s (0 is black, 1 full; perceptual), next to the picture's own change. A step with a calm picture or right after a clock jump is a sync problem; with the picture changing as much, it is a cut
frame loop stalled 0.40 s The lights froze, then caught up
minute 12:00–13:00: … Every minute: the lights' average and range, steps, how often the app's position moved, clock jumps and nudges, stalls

πŸ› οΈ Develop

You need Rust, ffmpeg, OpenSSL, Node 22 and pnpm. On macOS:

brew install rust ffmpeg openssl@3 pnpm
pnpm install
OPENSSL_DIR="$(brew --prefix openssl@3)" cargo run -- serve   # API + UI on :8080
pnpm dev             # UI with hot reload on :5173, proxies /api to :8080
pnpm check           # typecheck + cargo test
pnpm build           # UI, then the release binary with the UI inside
apps/server      Rust Β· tokio Β· axum Β· OpenSSL (DTLS) Β· ffmpeg
  src/analyze    ffmpeg decoding, black bars, color grid
  src/track      .lueur track format (zstd)
  src/hue        bridge REST API, discovery, Entertainment stream (DTLS 1.2 PSK)
  src/jellyfin   now playing, playback clock, libraries, devices
  src/player     Jellyfin β†’ track β†’ lights at 50 Hz, live status
  src/queue      background analysis queue
  src/server     `lueur serve`: HTTP API + embedded UI
apps/web         React 19 Β· Vite Β· Tailwind 4 Β· TypeScript
  src/views      one folder per screen (now, library, look, settings), one file per card or step
  src/components area view, barcode, folder picker, layout (top bar, status pill, bottom tabs)
  src/ui         building blocks: buttons, cards, form controls, feedback
  src/lib        pure helpers: the Look preview maths, analysis hours

The CLI stays for scripts and debugging: lueur analyze <dirs> -j 2, lueur pair <ip>, lueur areas, lueur test, lueur run (player only), lueur inspect track.lueur --at 754.

πŸ“¦ Releases

Fully automatic, driven by Conventional Commits (feat: β†’ minor, fix: β†’ patch):

  1. Every push to main opens or updates a release PR with the next version and the CHANGELOG.
  2. Merging it creates the tag and GitHub release, then builds and publishes the Docker image.

πŸ“– Vocabulary: GLOSSARY.md Β· 🧭 Decisions: docs/adr

About

πŸ’‘ Philips Hue ambilight for Jellyfin: films analyzed once, lights follow the screen. No Sync Box. Rust + React, Umbrel app.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages