Subtitle default mkv flag handling

Everything related to MakeMKV
Grauhaar
Posts: 566
Joined: Thu Sep 15, 2016 3:46 pm

Re: Subtitle default mkv flag handling

Post by Grauhaar »

For me it makes no sense to set a subtitle track as "default", because this can be correct nor not. If a subtitle track is set to default, the player should show the subtitles, but it makes in most cases no sense. VLC is also a bad example, because if a subtitle language is set in the settings, it always selects the first matching subtitlle track regardles of the MKV settings (default/forced). With VLC is works only, if not subtitle lanugage is set and the subtitle track is set to forced. But due to setting with no language, it can be the wrong forced subtitle track if more than one track with different language exists.

In MakeMKV it makes only sense if this is the favorite language forced subtitle track or the main audio language is different from the set favorite language and the the subtitle (regardless if it is forced ot not) are in favorite language. But I cannot see any way how MakeMKV can check this in detail, so the best is to set the default to off and set the flag later to default and/or forced with MKVToolNIX Header editor.
Good Luck :)
_____________________________________________________________
Useful MakeMKV links: FAQs - Debug Log - Buy - Expiration of beta key
Two Blu-ray (UHD) Drives LG LG BH16NS55 with Libredrive Firmware 1.04
Chetwood
Posts: 976
Joined: Mon Aug 30, 2010 9:16 am

Re: Subtitle default mkv flag handling

Post by Chetwood »

Grauhaar wrote:
Fri Mar 06, 2020 8:01 am
VLC is also a bad example, because if a subtitle language is set in the settings, it always selects the first matching subtitlle track regardles of the MKV settings (default/forced). With VLC is works only, if not subtitle lanugage is set and the subtitle track is set to forced.
I've always used VLC with the default settings so I did not realize it would display a sub regardless of 'default no/forced no' flags when a favorite language is set. I've set Kodi to display no subs by default so when a sub is flagged like this, it does not get displayed. It will however, when flagged to default or forced so when I mux forced subs I always set both to on. On German BDs this is often necessary cause we get forced subs not only when Elvish language is being spoken but to translate signs and whatnot so there's many discs with forced subs that native English speakers do not get.
Grauhaar wrote:
Fri Mar 06, 2020 8:01 am
In MakeMKV it makes only sense if this is the favorite language forced subtitle track or the main audio language is different from the set favorite language and the the subtitle (regardless if it is forced ot not) are in favorite language. But I cannot see any way how MakeMKV can check this in detail, so the best is to set the default to off and set the flag later to default and/or forced with MKVToolNIX Header editor.
I'm positive Mike could implement this but maybe it's not necessary when you use a proper default selection string like this (which does not cover all possible variations):

setFirstSubtitleTrackAsDefault="false"
setFirstForcedSubtitleTrackAsDefault="true"
"-sel:all,+sel:(deu|eng|nolang),-sel:(core),-10:(forced*(eng)),-15:(deu),-20:(forced*(deu))"

which will result in this order

de forced
de
en forced
en

that I prefer. Of course it still fails due to the fact that forced subs aren't flagged properly by the people who author BDs.

So maybe it's best to have them all default to off as you suggest (or set the flags manually in the GUI so you can skip MKVToolnixs header editor) and implement a routine that can identify forced subs by size (like BD2AVCHD did).
MultiMakeMKV: MakeMKV batch processing (Win)
MultiShrink: DVD Shrink batch processing
Offizieller Uebersetzer von DVD Shrink deutsch
Grauhaar
Posts: 566
Joined: Thu Sep 15, 2016 3:46 pm

Re: Subtitle default mkv flag handling

Post by Grauhaar »

Chetwood wrote:
Sat Mar 07, 2020 6:58 am
So maybe it's best to have them all default to off as you suggest (or set the flags manually in the GUI so you can skip MKVToolnixs header editor) and implement a routine that can identify forced subs by size (like BD2AVCHD did).
Wrote some logic to identify most (but not all) forced subtitle tracks by the "Element Count" which can be listed with MediaInfo. But, some discs are very special and have a huge number of forced subtitles (f.e. Narcos). Fom the title length I calucate a number of possible subtitles (0,25 per minute) which is very relaistic for most Blu-rays and DVDs and this threshold number is compared against the "Element Count" (for Blu-ray I divide the Element Count by two). But as told, f.e. Narcos have hundreds of subtitles and if the subtitles are not flagged as forced (separate track) there is no way to detect them with any logic, even any "by size" logic cannot detect them :)
Good Luck :)
_____________________________________________________________
Useful MakeMKV links: FAQs - Debug Log - Buy - Expiration of beta key
Two Blu-ray (UHD) Drives LG LG BH16NS55 with Libredrive Firmware 1.04
Woodstock
Posts: 9912
Joined: Sun Jul 24, 2011 11:21 pm

Re: Subtitle default mkv flag handling

Post by Woodstock »

For what it is worth, the handbrake "foreign audio search" works by counting subtitle elements, and choosing tracks that have 10% or few of the longest subtitle track in a particular language. It works "most of the time", but might fail on a track where "karaoke" subtitles are used for the opening/closing segments.

I work around the mess by having MakeMKV rip everything, then rearrange track order post-rip, so the tracks I want to be the default are the first one of that type in the file. This covers every device I have that understands subtitles.
MakeMKV Frequently Asked Questions
How to aid in finding the answer to your problem: Activating Debug Logging
Chetwood
Posts: 976
Joined: Mon Aug 30, 2010 9:16 am

Re: Subtitle default mkv flag handling

Post by Chetwood »

Grauhaar wrote:
Sat Mar 07, 2020 9:44 am
But, some discs are very special and have a huge number of forced subtitles (f.e. Narcos).
Right, but wouldn't the language in that case help as the second identifier? You'd ignore all the other small subtitle streams but of your preferred languages.
Woodstock wrote:
Sat Mar 07, 2020 3:32 pm
I work around the mess by having MakeMKV rip everything, then rearrange track order post-rip, so the tracks I want to be the default are the first one of that type in the file. This covers every device I have that understands subtitles.
Currently I rip all de/en subtitle tracks and flag them later accordingly so I don't even have to remux. Still, in case I were to play back an mkv on a player that does not adhere to the flags, having the proper track order would be nice.
MultiMakeMKV: MakeMKV batch processing (Win)
MultiShrink: DVD Shrink batch processing
Offizieller Uebersetzer von DVD Shrink deutsch
Woodstock
Posts: 9912
Joined: Sun Jul 24, 2011 11:21 pm

Re: Subtitle default mkv flag handling

Post by Woodstock »

Since I run everything through handbrake, setting up the track order really isn't a separate step. I just have to identify the track numbers when I pre-view the MKV files with VLC.
MakeMKV Frequently Asked Questions
How to aid in finding the answer to your problem: Activating Debug Logging
morbius
Posts: 149
Joined: Mon Aug 13, 2018 7:17 am

Re: Subtitle default mkv flag handling

Post by morbius »

mike admin wrote:
Thu Mar 05, 2020 1:03 pm
solidus28 wrote:
Thu Mar 05, 2020 12:20 pm
Just checking in on this again. Looks like the behavior still exists in 1.15. Any updates?
Sigh. Believe it or not, this was actually a bugfix -- "if the subtitle track is flagged by default, and then it turns out to be empty, and the track is derived - then flag his parent/base track as default instead". I believe matroska spec requires each track of type to have a default flag. And it turns that VLC et al interpret the "default" flag differently. This will be fixed somehow...

Now, for a workaround. The "thing" that that actually creates an MKV file is a MKV multiplexer library, which is based on libmatroska and is therefore opensource. The muxer library is fairly separated from the makemkcon app, and is being open source is easily changeable. In theory one could even write a library that muxes to mp4 (with dolby vision and transcoding blu-ray PGS subtitles into DVD vobsub, dts to ac3 and such) and transform MakeMKV into MakeMP4 :)

So, for your particular case, if you go to install location of 1.15 and replace libmakemkv.dll (libmakemkv64.dll, libbmakemkv.dylib etc) with a version from 1.14.5, then you will get a latest and greatest MakeMKV GUI/decryption/processing but with MKV muxer from 1.14.5 that handles the default flag the old way. Don't tell anyone :)
First impressions are that this is fixed in 1.15.2 ? If so, thanks!
solidus28
Posts: 18
Joined: Fri Feb 16, 2018 6:23 pm

Re: Subtitle default mkv flag handling

Post by solidus28 »

Awesome, I'll have to check, too! I was going to come in and ask if the same workaround would still work in 15.2 :) Great news if I don't have to overwrite those files any more.
solidus28
Posts: 18
Joined: Fri Feb 16, 2018 6:23 pm

Re: Subtitle default mkv flag handling

Post by solidus28 »

Hmmm...I re-ripped my Spectre disc and it did not flag the non-english subtitles as default. I'll try copying the old libmakemkv.dll files and try the rip again.
morbius
Posts: 149
Joined: Mon Aug 13, 2018 7:17 am

Re: Subtitle default mkv flag handling

Post by morbius »

My tests were with episodes 1 and 2 of Game of Thrones Series 1 bluray, which no version of makemkv has handled correctly since 1.14.5.

Episode 1, with no forced subs in the main track, output had one sub track, not marked as default, Kodi and VLC play without the subs unless user requests (versions of makemkv between 1.14.5 and 1.15.2 were incorrectly adding a default flag which automatically set the subs to ON in Kodi and VLC without user request, unless you used the mkvtoolnix header editor to fix it, which was not necessary up to v1.14.5)

Episode 2, first of many episodes that do have forced subs in the main track, two tracks are created, the forced subs this time marked as default, Kodi/VLC automatically show them, same experience as playing the actual disc.

Also noticed that 1.15.2 also pulled the forced subs in the main sub track for Spiderman Homecoming UHD, so thus far, no forced subtitle issues that I can see.

I don't have acces to the disc for Spectre, but happy to check other titles should we have those in common.

Of course most titles with "forced" subs actually implement those via a separate dedicated track. Not sure if Spectre is one of these. Examples above are for titles where the forced subs are in the main track (I have come across a few more of these recently, e.g. Mission Impossible Fallout, but they are much less common).
solidus28
Posts: 18
Joined: Fri Feb 16, 2018 6:23 pm

Re: Subtitle default mkv flag handling

Post by solidus28 »

Maybe Spectre UHD is bad test. MakeMKV actually doesn't seem to like me replacing the dll files anymore. When I replace those two files, I get an error upon launching MakeMKV "Application failed to initialize". If I put the ones that came with the latest version back, it launches fine. I'll see what happens with my next disc that has subtitles for other languages.
solidus28
Posts: 18
Joined: Fri Feb 16, 2018 6:23 pm

Re: Subtitle default mkv flag handling

Post by solidus28 »

I will say it's no longer marking the main subs as default, but, at least for Spectre, didn't auto mark the subtitles for non english parts as default like it used to several versions ago. I modified the header in MKVToolNix to mark the appropriate subtitle track as default in the case of this disc.
Post Reply