Skip to content

Show Blu-ray, DVD and DVB subtitles on 3D and 180°/360° video - #107

Merged
seaweeduk merged 1 commit into
masterfrom
feature/image-subtitles
Nov 22, 2026
Merged

seaweeduk merged 1 commit into
masterfrom
feature/image-subtitles

Conversation

@seaweeduk

@seaweeduk seaweeduk commented Nov 22, 2026 •

Copy link
Copy Markdown
Owner

Blu-ray (PGS), DVD (VobSub) and DVB subtitles now show on 3D and 180°/360° video. Before, mpv could only draw them into the video, so a 3D picture got half a subtitle and 180°/360° video showed none.

  • Flat screen, 2D and 3D: the app draws them on the screen where the disc puts them, in each eye's picture, like a Blu-ray player. They don't float, whatever Floating for 2D says. The tooltip says so.
  • 180° and 360°: the disc's layout goes on a picture ahead of you, at the subtitle distance, turning with you like text subtitles.
  • Steam Frame: while they show, decoded frames still go straight to the eye shaders, and frame reuse keeps working on a flat screen. Before, a selected subtitle track made mpv convert every frame.
  • Subtitle size and raise still apply. Text subtitles, and videos without picture subtitles, work as before.

How it works

flowchart LR
  mpv["mpv: osd_render() of the subtitles<br/>on one eye's canvas"] -->|"BGRA parts, change id<br/>(render parameter)"| copy["SubtitleExport<br/>copies them when they change"]
  copy --> tex["PictureSubtitles<br/>one texture, parts stacked"]
  tex -->|flat screen| on["FrameScene::onPicture<br/>(reused with the picture)"]
  tex -->|"180° / 360°"| over["overlays, ahead of you"]
Loading
  • packaging/mpv/mpv-subtitle-export.patch adds a render parameter (src/subtitle_export.h, shared C). With it, mpv leaves picture subtitles out of the video and hands them out as bitmaps laid out on the app's canvas, which is one eye's picture. They stay valid until the next render call. An mpv without the patch ignores the parameter, and the app keeps the old behaviour.
  • VideoPlayer passes the parameter only while a picture subtitle track is selected, plus once more afterwards so that mpv draws subtitles itself again. Otherwise nothing changes.
  • PictureSubtitles uploads a cue once, when it changes. Parts are clipped to the picture and fade with the video. On a curved screen they follow the bend.
  • FrameReuse treats the flat screen's subtitles as part of the picture: a new cue counts as a new picture.

Steam Frame

1080p H.264 at 24 fps with a Blu-ray subtitle track, 20 s with five cues and the gaps between them. 3780 px eyes, 120 Hz, foveation High, frame reuse on.

Before, subtitles on This PR, subtitles on Before, off This PR, off
Frames straight to the eyes 0 433 433 433
Frames drawn per second (of 120) 47.9 46.1 44.8 45.6
App CPU (% of a core) 12.0 9.4 9.9 10.0
Battery rail (W) 8.01 7.90 7.96 7.99

On the headset, 2D and 3D Blu-ray cues look as the disc draws them.

Known and left as is

  • A cue can appear one headset frame ahead of its pipelined video frame during normal playback, as text subtitles can.
  • Picture subtitles use the same blending as other Cairo panels. Partly transparent edges and fades can look different over video than when mpv draws them into the picture.
  • Export doesn't support mpv screenshots, vf=sub or secondary subtitle tracks. Normal playback controls don't use them.
  • Re-selecting a picture track while paused shows its cue once playback moves, as in mpv itself.
  • Export uses a parameter ID outside mpv's public enum, the same cast already used by VIDEO_EXPORT_PARAM.
  • mpv rebuilds the export on each video render with a picture track selected. The app uploads it only when it changes.
  • If staging space cannot be reserved, CairoCanvas can skip an upload. The shared canvas behavior is unchanged.
  • The floating-subtitles hint names Blu-ray and DVD, not DVB, but all three follow the same picture-subtitle placement rules.
  • On 180° and 360° video, picture subtitles stay at full opacity when the video is see-through or hidden by Peek at the room, as text subtitles there do.
  • On a see-through flat screen, a cue is drawn at the video's opacity over the picture, so its pixels let a little less of the room through than the picture around them (75 % opaque at 50 % opacity). Matching exactly would need a blend mode of its own.

Important

AI disclosure

Model Variant Role
anthropic/claude-opus-5-5 high Implementation
openai/gpt-6.2-astra high Independent review

Agent harness OpenCode 2.3.2

@seaweeduk seaweeduk added the feature New feature (release notes: New) label Nov 22, 2026
@opencode-agent

Copy link
Copy Markdown
  1. Low — Surround picture subtitles stay visible when the video is hidden. In src/main.cpp:2485–2491, only the flat-screen branch passes opacity. The surround overload creates a PanelItem with its default opacity of 1. During a cue on 180° or 360° video, holding Peek at the room therefore hides the video but leaves the subtitle fully visible over the room. Pass opacity to the surround overload, apply it to each panel, and skip the draw at zero.

  2. Low — Flat-screen subtitles make the room less visible underneath them. In src/picture_subtitles.cpp:113–115, the subtitle is drawn as a second translucent panel over a screen that already has the requested video opacity. At 50% video opacity, even a fully opaque subtitle pixel produces a final alpha of 0.5 + 0.5 × (1 − 0.5) = 0.75 with the panel’s source-over blend. The room contributes only 25% behind that glyph instead of the 50% it contributes to the rest of the picture. For onPicture draws, preserve the screen’s destination alpha and blend the unscaled premultiplied cue with RGB factors DST_ALPHA and ONE_MINUS_SRC_ALPHA. This keeps the subtitle part of the same translucent screen.

github run

@seaweeduk

Copy link
Copy Markdown
Owner Author

Both declined, and both listed under "Known and left as is":

  1. Surround cues while the video is hidden or see-through. On 180°/360° video, picture subtitles follow text subtitles there, which are also drawn at full opacity and stay during Peek at the room (subtitles / addText in buildScene). Changing only picture subtitles would make the two kinds differ.
  2. Blending on a see-through flat screen. Matching exactly needs a separate blend pipeline (DST_ALPHA factors) for onPicture parts. The cues have been checked on the headset and look right. A cue being somewhat more solid than the picture under it doesn't hurt readability.

@seaweeduk
seaweeduk force-pushed the feature/image-subtitles branch from 20cfc06 to 58d7ba3 Compare November 22, 2026 21:00
@seaweeduk
seaweeduk changed the base branch from refactor/wave-5 to master November 22, 2026 21:00
@seaweeduk
seaweeduk merged commit 0655b7c into master Nov 22, 2026
@seaweeduk
seaweeduk deleted the feature/image-subtitles branch November 22, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature (release notes: New)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant