Skip to content

fix: show 'Title - Language' in subtitle/audio track selector (matches Jellyfin style) - #236

Merged
dragonflylee merged 3 commits into
dragonflylee:devfrom
mr-brune:fix/subtitle-track-title-language
Jul 23, 2026
Merged

fix: show 'Title - Language' in subtitle/audio track selector (matches Jellyfin style)#236
dragonflylee merged 3 commits into
dragonflylee:devfrom
mr-brune:fix/subtitle-track-title-language

Conversation

@mr-brune

@mr-brune mr-brune commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Problem

When multiple subtitle (or audio) tracks share the same title field in an MKV file — a common occurrence with Crunchyroll/Erai-raws releases where all tracks are titled CR — the track selector shows identical, indistinguishable entries.

Root Cause

In app/src/view/player_setting.cpp, the track label was built as:

std::string title = mpv.getString(fmt::format("track-list/{}/title", n));
if (title.empty()) title = mpv.getString(fmt::format("track-list/{}/lang", n));
if (title.empty()) title = fmt::format("{} track {}", type, n);

The lang field was only used as a fallback when title was empty. When title was non-empty but identical across all tracks (e.g. CR), the language was never shown.

Fix

Added a langCodeToName() helper that maps ISO 639-1 (2-letter) and ISO 639-2 (3-letter) codes to full English language names, then builds the label as "Title - Language" — mirroring exactly how Jellyfin displays track selection:

std::string langName = langCodeToName(lang);
if (!title.empty() && !langName.empty())
    title = fmt::format("{} - {}", title, langName);  // "CR - English"

Result

With a real-world MKV file (Saga of Tanya the Evil S02E03, Erai-raws/Crunchyroll):

Before After
CR CR - English
Brazilian_CR Brazilian_CR - Portuguese
Latin_America_CR Latin_America_CR - Spanish
CR CR - Spanish
CR CR - Arabic
CR CR - French
CR CR - German
CR CR - Italian
CR CR - Russian

This applies to both subtitle and audio tracks.

mr-brune added 2 commits July 22, 2026 19:01
When multiple subtitle tracks share the same title (e.g. 'CR' from
Crunchyroll releases), the track selector showed identical entries with
no way to distinguish them.

Fix by appending the language code in parentheses when both title and
lang fields are present: e.g. 'CR (en)', 'CR (it)', 'CR (de)'.

Fixes display issue reported with MKV files containing multiple
subtitle tracks from the same source (Erai-raws / Crunchyroll).
Previously the track label used only the mpv 'title' field, falling back
to 'lang' only when title was absent. This caused tracks like Crunchyroll
releases where all subtitles share the title 'CR' to appear identical.

Now the label is built as 'Title - Language name' (e.g. 'CR - English',
'CR - Italian') mirroring how Jellyfin displays subtitle tracks.

A langCodeToName() helper maps ISO 639-1/2 codes to full English language
names so the output is human-readable rather than raw 'eng'/'ita' codes.
@mr-brune mr-brune changed the title fix: show language alongside title in subtitle/audio track selector fix: show 'Title - Language' in subtitle/audio track selector (matches Jellyfin style) Jul 22, 2026
Simple one-liner fix: show 'Title - lang' (e.g. 'CR - eng') so that
tracks sharing the same title are distinguishable in the selector.
@dragonflylee
dragonflylee merged commit 75e03c7 into dragonflylee:dev Jul 23, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants