Skip to content

Mirror jellyfin-web's Subtitle Appearance panel into mpv - #584

Open
ankitpasayat wants to merge 6 commits into
andrewrabert:mainfrom
ankitpasayat:subtitle-size-setting
Open

Mirror jellyfin-web's Subtitle Appearance panel into mpv#584
ankitpasayat wants to merge 6 commits into
andrewrabert:mainfrom
ankitpasayat:subtitle-size-setting

Conversation

@ankitpasayat

@ankitpasayat ankitpasayat commented Jul 7, 2026

Copy link
Copy Markdown

Why

In the desktop app, mpv renders subtitles, bypassing jellyfin-web's HTML/CSS subtitle renderer. As a result:

  • jellyfin-web's Subtitle Appearance settings (size, color, weight, font, drop shadow, vertical position) have no effect, and
  • jellyfin-web hides that panel in the desktop app — it's gated on appHost.supports(SubtitleAppearance) ("subtitleappearancesettings"), which the native shell didn't advertise.

So there's currently no way to adjust subtitle appearance in the desktop client. Closes #583; relates to #182 (size) and #47.

What I'm suggesting (this PR)

Reuse jellyfin-web's own Subtitle Appearance panel instead of adding bespoke UI:

  1. Unlock the panel — advertise the subtitleappearancesettings capability from the native shell, so jellyfin-web shows its existing Settings → Subtitles → Subtitle Appearance panel in the desktop app.
  2. Mirror it into mpv — on each playback, read the panel and apply the equivalent mpv sub-* properties:
Panel field mpv property
Text size sub-scale
Text color sub-color
Text weight sub-bold
Font sub-font (token → real family)
Vertical position sub-pos
Drop shadow sub-border-size / sub-shadow-offset
Text background sub-back-color

New mpv setters live in jfn_mpv::api; a non-persisted apply_setting_value dispatch pushes each field, since the web panel's localStorage is the source of truth.

What I got

The full jellyfin-web Subtitle Appearance panel now drives mpv subtitles live in the desktop app — size, color, weight, font, vertical position, and drop shadow.

Relationship to #535

#535 (open, by @Sheeplet1) adds subtitle size + bold via a custom Client Settings dropdown and resolves #182/#47. This PR overlaps on those two fields but sources every appearance field from jellyfin-web's own panel instead of adding new UI.

This PR is reviewable as-is. If you'd prefer to land #535 first, I'll rebase on top of it and drop the overlapping size/weight handling here — no decision needed before review.

Testing

  • Windows: built with the MSVC toolchain, deployed, and verified end-to-end in the running app (each field changes live).
  • After rebasing onto current main: cargo fmt --check, cargo check on the touched crates, workspace cargo clippy --all-targets with the repo's -D flags, and the jfn-config unit tests pass on Linux. The Windows end-to-end run predates the rebase and the follow-up hardening commit (per-user localStorage read + unset-field resets, JS-only).
  • Not yet run end-to-end on Linux/macOS — the changed lines are platform-agnostic (mpv property sets + JS), but an other-platform check would be appreciated.

Caveats / open questions

  • Couples to jellyfin-web internals — reads the logged-in user's <userId>-localplayersubtitleappearance… localStorage key and the panel's value vocabulary; a future jellyfin-web change could shift these. Guarded with a regex key match + fallbacks, but I'd value a maintainer's view on whether this coupling is acceptable vs. a self-contained settings set.
  • Font / shadow / position are mapped close, not pixel-identical (mpv vs. browser rendering). Drop shadow currently maps to an outline for legibility.
  • ASS/SSA subtitles with embedded styles are intentionally left to their own styling (matching the web panel's own note).

ankitpasayat and others added 5 commits July 28, 2026 19:23
mpv renders subtitles, so Jellyfin-web's built-in subtitle text-size
control has no effect in the desktop app. Add a "Subtitle Size" dropdown
(Small/Normal/Large/Larger/Huge) under Playback settings that drives
mpv's sub-scale property.

- Persist subtitleScale like the other app settings (config round-trip
  through overlay_json/to_json/cli_json).
- Apply live on change (re-renders the current video) and restore the
  saved value once at startup.
- Set sub-ass-override=scale at boot so the size also reaches ASS/SSA
  subtitles while preserving the rest of each script's styling.
mpv's sub-scale=1.0 (Normal) renders larger than jellyfin-web's own Normal, so re-center the Subtitle Size ladder (Small 0.35 / Normal 0.5 / Large 0.75 / Larger 1 / Huge 1.5) and lower the app default to 0.5, applied at startup even when the value is unset.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Set mpv sub-pos=95 so subtitle vertical placement matches the jellyfin-web client's fullscreen position.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
New mpv sub-* setters (sub-pos, sub-bold, sub-color, sub-back-color, sub-font, sub-border-size, sub-shadow-offset) plus non-persisted apply_setting_value keys that drive them, so subtitle appearance can be pushed from the web layer straight to mpv.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Advertise the subtitleappearancesettings capability so jellyfin-web shows its Subtitle Appearance panel in the desktop app (mpv, not HTML, renders subs so it is normally hidden). Read that panel from localStorage and map every field - size, text color, weight, font, vertical position, drop shadow, background - to mpv sub-* properties on each playback. Font tokens map to real Windows families. Removes the now-redundant Client Settings Subtitle Size dropdown; the web panel is the single source of truth.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ankitpasayat
ankitpasayat force-pushed the subtitle-size-setting branch from 1ba7c48 to 69ee2de Compare July 28, 2026 14:03
@ankitpasayat

Copy link
Copy Markdown
Author

Rebased onto current main (f3ba9cd). The conflict with the relocated windowDecorations handling in apply_setting_value is resolved — the branch is conflict-free again. Re-verified after the rebase: cargo fmt --check, cargo check on the touched crates, workspace clippy with the repo's -D flags, and the jfn-config unit tests all pass. Ready for review.

Read the logged-in user's localplayersubtitleappearance entry instead of
the first match (a shared device holds one per user), push explicit mpv
defaults for color/position/font when a panel field is unset so resetting
a field or switching users takes effect without a restart, and drop the
now-unread subtitleScale entry from jmpInfo settings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Subtitle appearance (color, font, position, shadow, size) cannot be adjusted in the desktop app Add option for subtitle size

2 participants