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
[FEATURE] Support track language for Blu-ray disc from the MPLS STN table #527
For Blu-ray disc sources (ISO / BDMV), the engine should
read the disc's own per-stream language metadata — the ISO 639-2 codes stored in
the MPLS STNTable — and backfill TrackInfo.language by PID for tracks whose language is und. This is the libbluray/VLC approach: those tools always show correct
languages for such discs because they read the BDMV metadata, not the PMT.
Motivating media or use case
Some Blu-ray ISO served over HTTP never support language-based auto-selection because these files typically have empty or undefined track languages. As a result, the engine’s languageMatches function does not consider them a match, regardless of the engine’s preferredSubtitleLanguages or the host-side preference settings.
Implemented and merged to main (6aa2716c), so this lands in the next release.
The diagnosis here was exactly right, and worth restating because it is the whole reason the old behaviour could never be fixed downstream of the demuxer: a Blu-ray clip's PMT carries no ISO 639 language descriptor, so FFmpeg's mpegts demuxer sets no language metadata at all and every track arrives undetermined. languageMatches then correctly refuses to match, because there is genuinely nothing to match against. The languages only exist in the MPLS STN_table, which is where libbluray and VLC read them.
What shipped:
Blu-ray: every PlayItem's STN_table is walked (past the 32 byte PlayItem header and any multi-angle block), collecting the ISO 639-2 code beside each stream's PID for audio, PG and IG entries. First declaration wins, since the demuxer opens on the first clip's PIDs. The walk stops after the IG group, because the secondary audio and video entries that follow carry extra attribute blocks, and a wrong guess there could only corrupt what came before.
DVD-Video, since the same hole is there and worse (VOBs carry no language anywhere in the bitstream): the VTS IFO audio and subpicture attribute tables, with the title's main program chain naming the substream number each attribute is actually carried as. That last part matters, audio_control / subp_control is not always the identity mapping, so a disc that authors its second audio attribute as substream 5 would otherwise have had its language attached to 0x81. A stream the chain marks absent is dropped, and without a readable chain the attribute's position is used, which is how the great majority of discs are authored.
The table rides on the selected disc title, keyed by the AVStream.id FFmpeg reports for the container the title demuxes as (MPEG-TS PID on Blu-ray, MPEG-PS stream or substream start code on DVD), and it is applied in a single place in Demuxer. So it reaches the published audioTracks / subtitleTracks, preferredAudioLanguages / preferredSubtitleLanguages resolution, the native rendition table and the subtitle side demuxers together. Only an undetermined track is filled in: a language a container really declares stays authoritative.
aetherctl disc-inspect <image> now prints what a disc declares per title, for example on the Blender Sintel Blu-ray:
which makes it possible to tell a disc whose tracks stay undetermined apart from a disc that declares nothing at all.
One honest caveat on verification. The byte layouts are checked against libbluray's mpls_parse.c, libdvdread's ifo_types.h and VLC's dvdread_video.c rather than against my own fixtures, and the unit tests fail under mutation. On real media, that Sintel image resolves 11 languages out of its actual MPLS, matching what FFmpeg reports from the PMT stream for stream, which is a strong cross-check of the parse. But that disc does declare ISO 639 descriptors in its PMT, so for it the change is correctly a no-op. I have no image here that lacks them, which is precisely the shape described in this report, so a confirmation once the release is out would be very welcome. Leaving this open until then.
Thanks for the report, and for pointing straight at the STN table rather than at the symptom.
Released in 6.81.0 (6aa2716c, merged as 78bc9029). Both consumers are pinned to it.
@bitxeno, an ISO's audio and subtitle tracks should now arrive with the languages the disc declares, so preferredAudioLanguages and preferredSubtitleLanguages can match one. aetherctl disc-inspect prints what a disc states per title, which separates a disc whose tracks stay undetermined from one that declares nothing.
Thanks for confirming. That was the one case the change could not be verified here: the test image on hand declares its languages in the PMT as well, so on that disc the STN walk is correctly a no-op and only good as a cross-check. A disc that states them nowhere but the navigation data is what the parse was written for, and that is the case just covered.
Closing on that. Thanks again for pointing straight at the STN table rather than at the symptom.
Activity
Merge feat/ae527-disc-track-languages: a disc's tracks carry the lang…
superuser404notfound commentedon Sep 11, 2026
Implemented and merged to
main(6aa2716c), so this lands in the next release.The diagnosis here was exactly right, and worth restating because it is the whole reason the old behaviour could never be fixed downstream of the demuxer: a Blu-ray clip's PMT carries no ISO 639 language descriptor, so FFmpeg's
mpegtsdemuxer sets nolanguagemetadata at all and every track arrives undetermined.languageMatchesthen correctly refuses to match, because there is genuinely nothing to match against. The languages only exist in the MPLSSTN_table, which is where libbluray and VLC read them.What shipped:
STN_tableis walked (past the 32 byte PlayItem header and any multi-angle block), collecting the ISO 639-2 code beside each stream's PID for audio, PG and IG entries. First declaration wins, since the demuxer opens on the first clip's PIDs. The walk stops after the IG group, because the secondary audio and video entries that follow carry extra attribute blocks, and a wrong guess there could only corrupt what came before.audio_control/subp_controlis not always the identity mapping, so a disc that authors its second audio attribute as substream 5 would otherwise have had its language attached to0x81. A stream the chain marks absent is dropped, and without a readable chain the attribute's position is used, which is how the great majority of discs are authored.The table rides on the selected disc title, keyed by the
AVStream.idFFmpeg reports for the container the title demuxes as (MPEG-TS PID on Blu-ray, MPEG-PS stream or substream start code on DVD), and it is applied in a single place inDemuxer. So it reaches the publishedaudioTracks/subtitleTracks,preferredAudioLanguages/preferredSubtitleLanguagesresolution, the native rendition table and the subtitle side demuxers together. Only an undetermined track is filled in: a language a container really declares stays authoritative.aetherctl disc-inspect <image>now prints what a disc declares per title, for example on the Blender Sintel Blu-ray:which makes it possible to tell a disc whose tracks stay undetermined apart from a disc that declares nothing at all.
One honest caveat on verification. The byte layouts are checked against libbluray's
mpls_parse.c, libdvdread'sifo_types.hand VLC'sdvdread_video.crather than against my own fixtures, and the unit tests fail under mutation. On real media, that Sintel image resolves 11 languages out of its actual MPLS, matching what FFmpeg reports from the PMT stream for stream, which is a strong cross-check of the parse. But that disc does declare ISO 639 descriptors in its PMT, so for it the change is correctly a no-op. I have no image here that lacks them, which is precisely the shape described in this report, so a confirmation once the release is out would be very welcome. Leaving this open until then.Thanks for the report, and for pointing straight at the STN table rather than at the symptom.
Merge feat/dolby-vision-base-layer: the base layer of a Dolby Vision …
superuser404notfound commentedon Sep 11, 2026
Released in 6.81.0 (
6aa2716c, merged as78bc9029). Both consumers are pinned to it.@bitxeno, an ISO's audio and subtitle tracks should now arrive with the languages the disc declares, so
preferredAudioLanguagesandpreferredSubtitleLanguagescan match one.aetherctl disc-inspectprints what a disc states per title, which separates a disc whose tracks stay undetermined from one that declares nothing.feat(disc): a disc's tracks carry the languages the disc declares (su…
bitxeno commentedon Sep 12, 2026
I tried it, and the tracks have language now. Thanks!
superuser404notfound commentedon Sep 12, 2026
Thanks for confirming. That was the one case the change could not be verified here: the test image on hand declares its languages in the PMT as well, so on that disc the STN walk is correctly a no-op and only good as a cross-check. A disc that states them nowhere but the navigation data is what the parse was written for, and that is the case just covered.
Closing on that. Thanks again for pointing straight at the STN table rather than at the symptom.