You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Show Blu-ray, DVD and DVB subtitles on 3D and 180°/360° video - #107
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.
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.
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.
Both declined, and both listed under "Known and left as is":
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
How it works
packaging/mpv/mpv-subtitle-export.patchadds 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.VideoPlayerpasses the parameter only while a picture subtitle track is selected, plus once more afterwards so that mpv draws subtitles itself again. Otherwise nothing changes.PictureSubtitlesuploads 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.FrameReusetreats 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.
On the headset, 2D and 3D Blu-ray cues look as the disc draws them.
Known and left as is
vf=subor secondary subtitle tracks. Normal playback controls don't use them.VIDEO_EXPORT_PARAM.CairoCanvascan skip an upload. The shared canvas behavior is unchanged.Important
AI disclosure
anthropic/claude-opus-5-5highopenai/gpt-6.2-astrahighAgent harness OpenCode 2.3.2