Lumen

The playback engine behind Laterna.

Lumen reads the file exactly as it sits on disk, repackages it in the browser tab and hands it to the device's video chip. 4K, HDR10, Dolby Vision and multichannel sound included.

Also available as a Jellyfin plugin

0pixels re-encoded on the native path. The file's picture reaches the screen bit for bit.
15-56msto repackage a group of pictures, against about 2,500 to download it.
6audio decoders compiled to WebAssembly, loaded only when a film needs them.
8,700+automated tests, plus benches that put real files through their paces.
01Architecture

Seven parts carry the file to the screen.

From the server's disk to the video chip, every stage has its own part. Bytes travel, pixels stay untouched.

PlaybackCoreorchestration: opening, seeking, pausing, resuming, rebuilding
server File

The original file

  • MKV · MP4 · MOV
  • untouched on disk
  • served by HTTP ranges
tab StreamCore

Byte reading

  • 1 MiB chunks, six ahead
  • start and end of the file in parallel
  • in-memory reserve, up to 5 min
tab MuxCore

Remuxing

  • Matroska and MP4, one description
  • decode times reconstructed
  • random access points verified
  • fragmented MP4, fragments ≤ 1.2 MB
tab BufferCore

Buffers

  • MediaSource and ManagedMediaSource
  • budget counted in bytes
  • sized for each engine
device <video>

Native player

  • hardware decoding
  • native HDR
  • system audio clock
CodecBridge

Codec compatibility

Before every film, Lumen asks the browser: this format, this encoder, this Dolby Vision profile. Its answer picks the path.

AudioCore

Audio decoding

Track accepted: copied bit for bit
Otherwise: decoded in WebAssembly, then re-encoded to AAC or Opus by the browser, every channel in its place
PlaybackBridge

Playback fallback

A format out of reach or a connection too slow: Jellyfin takes over in HLS, at the same second, with the same track.

02Formats

Everything Lumen plays.

Lumen recognises the format from the file's own bytes. Depending on the device, each track is copied as is or decoded in the tab, and Jellyfin's player takes the rest.

Video

HEVCH.265 · 8 and 10 bit · up to 4K
AV18 and 10 bit
H.264AVC · everywhere

HDR

Dolby Visionprofiles 5 and 8 · native where the device accepts it
HDR10native on an HDR screen
HDR10+played as HDR10, metadata passed on

Audio

Dolby Atmosin Dolby Digital Plus, passed through intact on Safari
Dolby TrueHDdecoded · 7.1WASM
DTS-HDMaster Audio · HRWASM
DTSthe DTS coreWASM
DTS ExpressDTS-HD LBRWASM
Dolby Digital PlusE-AC-3copied or WASM
Dolby DigitalAC-3copied or WASM
FLAC16 and 24 bitcopied or WASM
AACup to 7.1copied
Opusmono to multichannelcopied
MLPlosslessWASM
5.1 · 7.1every channel in its place, in the order the device expects
10 audio familiescopied as is or decoded on the device, without going through the server

Containers and subtitles

MKVMatroska
MP4 · MOVthrough the same pipeline
SRTadjustable size and position
MP4 textan MP4's own subtitles
ASS · SSAthe text
Externalfiles next to the film
Two at oncea second subtitle above the main one, each with its own offset
Generatedtranslated while the film plays, from a complete subtitleoptional
Forcedrecognised automatically
PGS · VobSubburned in by the server when casting to Chromecastserver

Played by Jellyfin

Everything elseJellyfin's server player takes over, at the same second and with the same track
VP9videoserver
VP8videoserver
MPEG-2videoserver
MPEG-4 ASPold .avi filesserver
AVIcontainerserver
Fragmented MP4containerserver
MP3audioserver
MP2audioserver
Vorbisaudioserver
PCMuncompressed audioserver

copied handed to the browser as isWASM decoded in the tab, then re-encoded to AAC or Opusserver played by Jellyfin's server player

03Engineering

The details that make the difference.

Lumen rebuilds the decode times

Matroska stores only presentation times; MP4 needs decode times too. Lumen sorts each group's presentation times and deals them out in decode order: the exact timeline, whatever the reorder depth.

Every access point is checked

Before starting or seeking, Lumen reads the frame's first NAL unit: only IDR, CRA and BLA open a segment. When the point it finds lands too far, it steps back through the index, 12 seconds at a time.

The network sets the pace

The computing is nearly free, so Lumen shapes its requests: six-chunk readahead, chunks of one read requested together, the file's header and index read in parallel at open, stale reads dropped on every seek.

Every channel in its place

Each system orders its channels differently. Lumen hands the device's encoder the order it expects: dialogue in the centre, effects at the back, an order checked system by system.

Memory sized for each engine

Safari caps each video buffer in bytes, about thirty seconds of 4K on an iPad. Lumen counts its fill in bytes actually appended and frees memory behind the playhead itself.

Decoders measured against FFmpeg

The embedded decoders were compared with FFmpeg channel by channel, on real files. The largest gap measured for TrueHD is a hundredth of a decibel.

A safety net

For a file the browser can't carry, Lumen hands over to Jellyfin, which chooses between direct play and transcoding. A panel shows the path taken and why. This fallback can be switched off in one setting.

Playback keeps going on a slow connection

Lumen compares the bitrate it receives with the film's. When the link can't keep up, a lighter version is prepared in the background and the player switches to it at the same second, same language, same subtitles.

The black bars disappear

The server measures the real picture on the scrubbing thumbnails, without decoding any video, then the player enlarges the film to the edge of the screen. Only black is cropped.

Exact resume Instant resume from the device Chapters Scrubbing previews Skip intro Next episode preloaded Language switch at the same position Two subtitles at once Dialogue enhancement Playback speed
Jellyfin plugin

Lumen for Jellyfin

The same engine, as a plugin for the Jellyfin web client.

Keep your interface: MKV and MP4 files play as they are, the browser repackages them and decodes the audio itself, and the server no longer starts ffmpeg for these files. Measured against the regular player: playback starts 2 to 4 times sooner, seeks are 3 to 4 times faster, and changing the audio track is about 8 times faster.

In Jellyfin, Dashboard > Plugins > Repositories, add this repository, then install Lumen from the catalog and restart Jellyfin.

Plugin repository
https://raw.githubusercontent.com/LK59/lumen/main/manifest.json