Repository navigation
Description
What happened
QSV tone-mapped transcodes that burn in bitmap subtitles (PGS, VOBSUB, DVB) produce corrupted frames: blocks shifted against their neighbours, and at shot cuts whole frames showing the next frame's picture. It is the same fault as #2446, on the graph that #2446's fix does not change.
On a 4K HDR10 title with English PGS subtitles, the burn-in graph Silo builds today produced 21 frames in 8 seconds that differ from a software tone map of the same frames (SSIM below 0.95). They include a frame with a block of the picture displaced under the subtitle line, and two shot cuts where the next shot appears one frame early. With the change proposed below, no frame differed.
Steps to reproduce
- Set
playback.hw_accel=qsvon an Intel Arrow Lake host (Arc 130T/140T iGPU) with tone mapping enabled. - Play a 4K HDR title with a PGS track, burn the subtitles in, at a quality that transcodes to 1080p.
- Watch a scene with motion, or run the graph below and compare its frames against a software tone map.
The graph appendToneMappedBitmapSubtitleArgs builds for QSV (built from main at 6144c45cd):
[0:v:0]setparams=...,scale_vaapi=format=p010,hwmap=derive_device=opencl:mode=read,tonemap_opencl=format=nv12:p=bt709:t=bt709:m=bt709:tonemap=bt2390:peak=100:desat=0,hwmap=derive_device=vaapi:mode=write:reverse=1:extra_hw_frames=16,format=vaapi[vmain];[0:s:0]format=bgra,hwupload[sub];[vmain][sub]overlay_vaapi=eof_action=pass,scale_vaapi=w=-2:h=1080:format=nv12,hwmap=derive_device=qsv:mode=read+write,format=qsv,sidedata=...[vout]
Expected behavior
The transcode shows the source picture with the subtitle composited on it, like the software executor.
Silo version / commit
build-1382 · fee3df3 (ghcr.io/silo-server/silo-server:latest)
Deployment
Docker Compose
Area
Playback and transcoding
Clients affected
- Web UI
- Android
- iOS/tvOS/macOS
- Jellyfin-compat client (Infuse, Findroid, ...)
- Other/not client-specific
Media and playback details
Test title: 4K HEVC Main 10 HDR10 with 1920×1080 PGS tracks. Host: Intel Arrow Lake iGPU, i915 kernel driver, iHD 26.3.5, the image's Intel OpenCL runtime, jellyfin-ffmpeg 8.1.3. Encoded with h264_qsv at 1080p.
Relevant logs
No Silo session logs. The runs used the graph above, built from Silo's code, inside the Silo container on the host. ffmpeg logged no errors or warnings.
Technical notes
In this graph overlay_vaapi reads the tonemap_opencl output, the same unsynchronised VAAPI read of an OpenCL surface that #2446 describes for scale_vaapi. Measured on the same host against a software tone map of the same frames:
| Graph | Span | Frames below SSIM 0.95 |
|---|---|---|
| Current graph, real PGS track | 8 s, 192 frames | 21 |
| Proposed graph, real PGS track | 8 s, 192 frames | 0 |
| Current graph, transparent 640×120 overlay (3 runs) | 6 s, 148 frames | 3, 2, 2 |
| Proposed graph, transparent 640×120 overlay (3 runs) | 6 s, 148 frames | 0, 0, 0 |
The PGS rows count subtitle frames too, since the reference has no subtitles; the subtitles alone did not push any frame of the proposed graph below the threshold.
Proposed graph: keep the composite and the resize on the OpenCL device, so nothing on VAAPI reads the tone-mapped surface before the encoder.
[0:v:0]setparams=...,scale_vaapi=format=p010,hwmap=derive_device=opencl:mode=read,tonemap_opencl=...[vmain];[0:s:0]scale=out_color_matrix=bt709:out_range=tv,format=yuva420p,hwupload=derive_device=opencl[sub];[vmain][sub]overlay_opencl=eof_action=pass,scale_opencl=w=-2:h=1080,hwmap=derive_device=vaapi:mode=write:reverse=1:extra_hw_frames=16,format=vaapi,scale_vaapi=format=nv12,hwmap=derive_device=qsv:mode=read+write,format=qsv,sidedata=...[vout]
It composites at the source resolution and then scales, as today, so subtitle placement does not change. Subtitles appeared and cleared on the same frames as with the current graph. Moving the composite to the CPU was rejected in #465 for throughput.
Separately, the same title shows a placement problem that both graphs share: its 1920×1080 PGS bitmap is composited unscaled onto the 3840×2160 frame, so the subtitle lands in the upper-left quarter of the picture instead of near the bottom. That is not part of this issue.
AI harness
Claude Code in T3 Code
AI tool(s)
Claude Code, GitHub CLI, jellyfin-ffmpeg 8.1.3, PoCL
AI model(s)
claude-opus-5-5
AI involvement
Fully AI-generated at the reporter's direction. The agent ran the measurements on the reporter's server with their permission, and the reporter has not repeated them.
Independent or adversarial review
n/a
Confirmations
- I searched open and recently closed issues and pull requests, and this is not already reported
- I reproduced this myself on a real deployment
- Any logs provided are raw apart from marked redactions and are not AI-summarized; if none were available, I said so above
Activity
fix(playback): composite QSV HDR bitmap subtitles on OpenCL (#2449)