Laterna's analysis engine · optional

X-Ray

Laterna knows who is on screen, and who is speaking.

X-Ray watches your films and episodes once, on your server: it splits the picture into shots and scenes, recognises the credited cast, listens to the soundtrack and ties each voice to a face. During playback, Laterna knows who is there.

Runs entirely at home No online AI Optional Intel iGPU Open source
16.8×real time: a 31-minute 4K episode analysed in 114 s, picture and voices, on the iGPU of a Core i7-8700.
96-97%of named voices are named correctly, on three titles labelled by hand, line by line.
0calls to an online AI service: faces, voices and lips are analysed on your machine.
1.7MBper episode in the database, face and voice fingerprints included.
01Overview

The service follows four rules.

Laterna sends an order: this file, with this cast. X-Ray returns the scenes, the voices and a report that explains every decision.

01

It names only when it is sure.

A face is compared with the episode's credited cast alone, and named when it clearly resembles one of them. A voice is named when the faces agree on it at three thresholds. Doubt leaves the spot empty.

02

What is being watched comes first.

Started at minute 25, the episode is analysed from there to the end, then from the beginning. The first chunk is ready in under a minute, and scenes arrive as the analysis goes.

03

The service yields to everything else.

X-Ray runs one analysis at a time, at low priority and with a bounded thread count. When Jellyfin transcodes on the iGPU, X-Ray steps aside and moves to the processor.

04

The file is read once.

Shots and face and voice fingerprints are kept: a changed naming rule, a growing series or a reset memory are all redone from the database.

What Laterna shows with it.

For viewers, it all happens in the player: one tap tells you who plays whom.

Local

The "On screen" row

The player shows one pill per person in the scene, with their photo, the actor's name and the character's. Those on screen longest come first, and the row changes with the scene.

Local

A person's panel

Tap a pill to see the actor's age, birthplace, a short biography and two or three of their other titles in your library.

Online AI

"So far"

Lost the thread? One or two sentences remind you who this character is, based on what you have already watched and never beyond the start of the current scene.

Online AI

Questions

Ask how two characters in the scene are connected from a person's panel, or ask anything about the title with the round button at the end of the row. Answers draw on what you have watched.

AdminLocal

Library analysis

X-Ray analyses the whole library in the background, tier by tier: your priority list, then what is being watched, arrivals from the last fourteen days and finally the rest. The page shows the speed, the time remaining and the naming quality of each series.

AdminLocal

Subtitle sync

Subtitles early or late? "Scan" compares them with the detected speech and tells whether they are offset, drifting or follow a different cut. "Realign" corrects them on display, and the file stays untouched.

Lab betaLocal

Back to the start of the scene

After a break of four hours or more, a button offers to resume at the start of the current scene, only towards a boundary the service judges safe. Shipped switched off.

Local

Signed lines

Laterna aligns subtitles, in any language, with the voices: a line gets the speaker's name when a confident voice covers at least 60% of it. The AI features then know who says what.

Setting

Opened step by step

Start with administrators, then open it to everyone. A share link sees the row and the panel, without the library's other titles and without any AI feature.

02How it works

The file is read once, then picture and sound each follow their own path.

A single ffmpeg per two-minute chunk outputs picture and sound at once. The picture gives the people and the scenes, the sound gives the voices, and the two meet to name who is speaking.

library File

Read in place

  • read-only
  • same path as Jellyfin
  • credits and recaps skipped
one pass ffmpeg

Decoding

  • 2-minute chunks
  • VA-API on the Intel iGPU
  • HDR mapped to SDR
  • picture and sound, two outputs
Picture · 640 px · 4 fps
Shotscuts by colour
FacesSCRFD INT8, tracks, ArcFace
Peoplehierarchical clustering
NamesTMDB photos, memory, Hungarian
Scenesshots joined, screen time
Sound · 16 kHz · centre channel
SpeechSilero VAD
VoicesWeSpeaker, 3 thresholds
Who speakscontrast with the faces, consensus
LipsLight-ASD, undecided voices
/items/{id}/scenes/items/{id}/voices/items/{id}/report
00

What is left out

X-Ray skips the credits, recaps and previews Jellyfin has marked: credits often roll over faces that have nothing to do with the scenes.

66 to 101 s less per episode
01

Decoding

The picture is scaled to 640 px and sampled at four frames per second, skipping non-reference frames. HDR (PQ, HLG, Dolby Vision with an HDR10 layer) is mapped to SDR after scaling: four small frames per second cost almost nothing.

4K HEVC chunk: 3.9 s instead of 9.4CPU fallback chunk by chunk
02

Shots

From one frame to the next, colour histograms change at once at a cut and stay steady during a camera move. A contrast-normalised thumbnail catches shot-reverse-shots in dark sets.

32 × 16 × 16 binscut ≥ 0.30static shots detected
03

Face tracks

X-Ray analyses two or three frames per shot. Each face is detected with five landmarks, aligned, scored, then tracked from frame to frame. Only the two best faces of a track get a 512-number fingerprint.

36 px minimum to identifyIoU ≥ 0.25batches of 32 faces
04

People

All tracks are grouped by hierarchical clustering, without knowing how many people there are. Clustering is redone at each chunk, incrementally, byte-identical to the full computation.

similarity 0.423 to 6 times less compute
05

Names

Each group is compared with the photos of every credited actor: the score is the mean of its three best similarities. The Hungarian algorithm assigns at most one group per actor, maximising the total score.

three bandsone actor per groupsecond pass
06

Series memory

Faces and voices named with confidence in other episodes serve as references: they look more like the series than a posed portrait does. One contribution per episode, bounded, auditable and resettable.

300 s of face per person60 voice segments
07

Scenes

A shot joins the scene when it resembles one of the last four shots, or shows someone just seen there. Scenes that are too short are merged, those that are too long are split at their weakest boundary.

10 s minimum180 s maximumbursts kept
08

Who is speaking

On the original-language track, Silero finds speech and WeSpeaker takes a fingerprint every 0.5 s. Segments are grouped into voices at three thresholds, named by contrast with the faces present, and keep a name when two thresholds out of three agree.

1.5 s windows2 s segments0.65 · 0.70 · 0.75
09

Lips settle the undecided

For voices still undecided, X-Ray looks at who moves their lips: ten moments at most, decoded at 25 frames per second with their sound, scored by Light-ASD. Three votes and 70% agreement give a name.

600 s compute capnever against the memory
10

Rename without rereading

Steps 4 to 9 are redone from the database, without decoding: the same result as a fresh analysis, in batches of 20 s, never ahead of a viewer. A whole series is renamed once its plan is done.

shots · tracks · voices · votes kept
11

Scene starts

Each boundary is judged: an authored chapter, or colours and people changing together. A sentence begun just before moves the entry point back to it. The "Back to the start of the scene" button shows up at 3% of positions, each time in the right place.

two signalschapters read by ffprobe
03Models

Every model was chosen after measuring.

The weights live outside the repository and the image: the container downloads them on first start, from their official release, and checks each one against its SHA-256 fingerprint.

Faces

XRAY_MODEL
SCRFD-10Gnon-commercial
The buffalo_l detector (InsightFace) finds faces and their landmarks. Quantised to INT8 on your machine, it detects in 40% less time.
ArcFace R50non-commercial
It sums up each face in 512 numbers. Trained on WebFace600K, it is the default model and the more accurate of the two.
YuNet + AuraFace v1MIT · Apache-2.0
The open pair, usable in every case: just set XRAY_MODEL: auraface.

Voices

XRAY_VOICE_MODEL
Silero VAD v6.2MIT
Finds speech on the centre channel, where the dialogue lives.
WeSpeaker ResNet34-LMCC BY 4.0
The default voice fingerprint: on the bench, 97.5% of the names it gives are correct.
CAM++Apache-2.0
The 3D-Speaker model computes 40% faster and names as many lines, slightly less accurately.

Lips

XRAY_ASD
Light-ASDMIT
It spots who is speaking on screen (CVPR 2023). With about one million parameters, it reaches 94.1% mAP on AVA and takes 2.5 ms per frame and per face.
Read without PyTorchsecurity
The weights file goes through a restricted reader that accepts tensors only. The network, rebuilt in OpenVINO, matches the original score to within 2.4·10-6.
OpenVINO

Intel's engine, shipped in the image, computes on the processor or on the iGPU. ONNX Runtime takes over if it fails to load, with the same fingerprints to a cosine of 0.99999.

jellyfin-ffmpeg

The image ships Jellyfin's ffmpeg and its Intel iHD driver: there is nothing to install on the host. The iGPU decodes H.264, HEVC Main 10, VP9 and VC-1.

Home-made INT8

The detector is quantised on first start from 224 frames of your library, and kept if it finds at least 95% of the original network's faces while inventing no more than 5%.

A report for every decision

For each item, the report gives the models and devices used, and the reason behind every missing name. Laterna's "Naming quality" page links to it, series by series.

A frame detected in 22 ms

INT8 quantisation finds 72 faces out of 72, 136 out of 137 and 73 out of 74 on the bench: the only misses are under 36 pixels. The fingerprint stays at full precision, measured unusable in INT8.

Compute can move to the iGPU

With XRAY_OV_DEVICE=GPU, the networks run in half precision on the Intel iGPU, and processor time drops from 200 to 8 ms per frame. Detections and fingerprints stay identical to within 0.9994.

A second lane opens when the machine allows

While the iGPU analyses one item, a second lane takes another on the processor, 1080p at most. Measured: 21.9 times real time instead of 20.8 on three 1080p episodes. The gain grows with the core count.

04Sources

A name crosses seven sources.

A name on screen is a decision made by crossing the file, the official cast, the actors' photos, the series memory and what Jellyfin knows. Each source has its role, and none decides alone.

The filethe original-language picture and sound, centre channel, and its chapters
The TMDB castthe episode's own: credited roles then guests, in credits order, forty at most
The actors' photosup to eight per person, the main one then the best rated, fingerprints kept
The series memoryconfident faces and voices from other episodes, one contribution per episode
Jellyfinfile path and version, credits and recaps, transcodes in progress
The original languageto pick the original-language track, never a commentary or audio description
The subtitlesaligned with the voices by their timing, to sign each line

How a name is decided

Each pair of a face group and a credited actor gets a score: the mean of its three best similarities with the actor's photos. The threshold T is 0.30 with the default model.

≥ T + 0.10Certain. The group takes the actor's name.
T + 0.045 to 0.10To confirm. Named when the runner-up is 0.15 behind and the group was seen for 2 s or on two tracks.
< T + 0.045Anonymous. The group stays unnamed and is never returned.

The Hungarian algorithm then assigns one group per actor, looking for the highest total score. The confidence returned is 0.5 at the threshold and approaches 1 above it.

Every voice is judged three times.

Speech segments are grouped into voices at three thresholds. At each threshold, a voice takes the name of the person most present on screen while it speaks, and least present during the other voices of the same scenes. A segment keeps its name when two thresholds out of three give it.

Each person keeps a single voice. A second large voice, on the phone for instance, does not get the name of the only face on screen.
Memory fills in for the faces. It names a voice the faces leave empty, and stays silent when it contradicts the episode's faces.
GET /items/{id}/scenes · /voices · /report
# scenes: people sorted by screen time
720.0 - 765.3 s  Actor A   18.8 s (0.99)
                 Actress B 15.0 s (0.98)
                 Actor C    7.5 s (0.99)
765.3 - 840.0 s  Actor A   22.3 s (0.99)
                 Actress D 12.0 s (0.99)

# voices: every speech segment
731.2 - 733.9 s  voice 7 → Actor A   (1.00)
734.4 - 735.1 s  voice 9 → no name
                 conflict_memory: faces and memory
                 disagree
736.0 - 739.8 s  voice 4 → Actress B (0.67)
                 via: lip reading

# report: models and SHA-256, devices,
# thresholds, and why each name is missing

Three thresholds beat one

Moving the threshold by 0.05, a single threshold loses correct names. The consensus holds.

single threshold, 0.65 · correct93.9%
consensus centred on 0.65 · correct97.3%
phone voices wrongly named11 → 2

The series memory names more

An episode is named with help from the next episode, already analysed.

lines named, without memory69.5%
with the series memory77.6%
correct names, with memory96.3%

Lips settle the undecided

On a film, it named voices the faces had left undecided.

lines named, before67.9%
with lip reading75.5%
added names correct10 of 10
05On your machine

X-Ray is fast, and always lets Jellyfin go first.

These measurements were made on 9 and 10 November 2026 on a Core i7-8700 (6 cores, 12 threads, UHD 630 iGPU), with the default model, on files from a real library.

Analysis speed

At 16.8 times real time, a 31-minute episode takes under two minutes of compute.

two lanes · 3 HEVC 1080p episodes21.9×
4K HEVC, 31 min, picture and voices, iGPU16.8×
three 4K episodes in a row15.9×
HEVC 1080p, 42 min, inference on the iGPU14.7×
the same, on the processor13.7×
4K during a forced Jellyfin transcode9.8×
version 3, before the optimisations6.9×

Jellyfin keeps the upper hand

Four safeguards give it priority, from the scheduler to the iGPU.

  1. The scheduler orders at low priority; a viewer's order goes first, and the queue never holds more than three items.
  2. The processor: a weight of 256 against 1,024 for Jellyfin, plus nice and ionice. A transcode goes first.
  3. Decoding: Jellyfin sessions are checked every 30 s; when it transcodes on the iGPU, X-Ray decodes on the processor.
  4. Inference: it leaves the iGPU during a transcode. Measured, the transcode's slowdown falls from 39% to 8%.
500-550h

of compute estimated for a library of about ten thousand films and episodes, 7,600 h of video, in the background without rushing anyone.

< 1min

for the first chunk, the one at the playback position: the "On screen" row fills in while you watch.

180MB

of weights for faces, plus voices and lips. About 4.3 MB of database per analysed hour, and a log capped at 30 MB.

06Privacy

Fingerprints stay on your server.

Laterna receives TMDB identifiers, times and confidences. Fingerprints and images stay in the service's volume.

Everything stays at home

Face and voice fingerprints, reference photos and lip votes live in the service's volume. The only downloads are the model weights and the cast photos, from image.tmdb.org.

Only the credited cast is named

A face is compared with the cast Laterna provides for that title. An anonymous face stays in the database: the service names the actors of a title, and nobody else.

Only Laterna talks to it

The service lives on Laterna's Docker network, with no published port, and every request carries the shared key.

Your files stay untouched

The library is mounted read-only, under an unprivileged user. Subtitle sync corrects on display.

The rest goes without saying: model weights checked by SHA-256, no telemetry, secrets masked in the log, and a title hidden by parental controls stays hidden.

07Quick deploy

It installs right next to Jellyfin.

All it takes is a compose file, a key and a docker compose up -d. The service gets itself ready on first start, then Laterna sends it the work.

The compose file

In a separate folder, save this file as docker-compose.yml, then adjust three lines: the library path, the user and the render group number.

docker-compose.yml
# laterna-xray - next to Jellyfin and Laterna
services:
  laterna-xray:
    image: ghcr.io/lk59/laterna-xray:latest
    container_name: laterna-xray
    restart: unless-stopped
    # The library's owner (like Jellyfin, Sonarr, Radarr).
    user: "1000:1000"
    env_file: .env
    environment:
      # buffalo_l (default, non-commercial weights) or auraface (Apache-2.0)
      XRAY_MODEL: buffalo_l
      XRAY_THREADS: "4"
      XRAY_VOICE_THREADS: "2"
      # XRAY_OV_DEVICE: GPU      # inference on the iGPU, and mem_limit: 8g
      HOME: /data
    # No published port: only Laterna, on the same network, talks to it.
    networks: [media_net]
    volumes:
      # Read-only, at the SAME path as in the Jellyfin container.
      - /path/to/your/library:/media:ro
      # Database, model weights, reference photos, log.
      - xray_data:/data
    # Intel VA-API decoding. Without an iGPU, remove these two blocks.
    devices:
      - /dev/dri:/dev/dri
    group_add:
      - "993"   # getent group render
    cpus: 6          # 4 for the picture, 2 for the voices
    mem_limit: 4g     # 8g with XRAY_OV_DEVICE=GPU
    cpu_shares: 256  # below Jellyfin's 1024

volumes:
  xray_data:

networks:
  media_net:
    external: true

If Jellyfin sees /media/tv/…, X-Ray must see /media/tv/…: Laterna passes paths on exactly as Jellyfin knows them.

Settings, troubleshooting and the API contract: xray/README.md, PIPELINE.md, ARCHITECTURE.md and API.md (in French).

Good to know

What X-Ray sees, and what escapes it.

Faces

  • A face is recognised when seen from the front, sharp, and at least 36 pixels on the 640-wide frame. From behind, in profile or in shadow, it counts as a presence.
  • An extra missing from the TMDB cast stays anonymous.
  • Few or old TMDB photos, heavy make-up, or a role played at another age make recognition harder.

Scenes

  • Scenes follow colours and people, and approximate the story. Two threads cut in alternation can form a single scene.
  • HDR is mapped by Jellyfin's ffmpeg, built into the image.
  • Animation is left out of the analysis.

Voices

  • A voice is named when the person is on screen while speaking. A narrator or a voice on the phone often stays unnamed, by design.
  • Voices under three segments stay unnamed; from three to five, a confidence of 0.75 is required.
  • About two lines in three get a name, and the rest is left empty.

Licences and files

  • The buffalo_l weights are for non-commercial use only: your call, or switch to auraface.
  • A result is tied to the file's version. A re-encode of the same length, to within a second, is re-attached without analysis.
  • Without X-Ray, Laterna works exactly the same: everything built on it is off by default.

Put a name to every face.

Add a container next to Jellyfin and a key in Laterna: your library will know who is on screen.