Kodi Community Forum

Full Version: Forced subtitles handling in KODI 18.9
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
I have observed an issue with a movie (mkv), which contains 3 audio streams (ENG, GER, POL) and only 2 forced subtitles streams (GER, POL).
It is a musical, so when you change audio to german or to polish, you still hear the songs in english, but the corresponding forced subtitles show the text of the songs.
So far, so good.

Now, when you toggle audio back to english, the last forced subtitles are displayed, which is wrong.
I expect no subtitles to be shown, as there are no forced subtitles for english available.
The same (wrong) result I got when you play the movie the very first time (I renamed the mkv file to test it).
I set default audio language to english, and selected "only forced" subtitles in the KODI settings.

Here are the logs (from RPI3 running LibreELEC 9.2.6 with KODI 18.9):

https://paste.kodi.tv/uliqiworid.kodi
(2021-01-21, 19:35)montezuma Wrote: [ -> ]Now, when you toggle audio back to english, the last forced subtitles are displayed, which is wrong.
I expect no subtitles to be shown, as there are no forced subtitles for english available.

Subtitle streams are not linked to audio streams in Kodi, so a subtitle does not auto-appear/disappear whenever a different audio stream is selected.

Subtitle streams in a video file should have only one 1 default or forced subtitle stream. As I see it, having more than 1 of those is a PEBKAC on behalf of whoever did the video muxing.
(2021-01-21, 21:53)Klojum Wrote: [ -> ]
(2021-01-21, 19:35)montezuma Wrote: [ -> ]Now, when you toggle audio back to english, the last forced subtitles are displayed, which is wrong.
I expect no subtitles to be shown, as there are no forced subtitles for english available.

Subtitle streams are not linked to audio streams in Kodi, so a subtitle does not auto-appear/disappear whenever a different audio stream is selected.

Subtitle streams in a video file should have only one 1 default or forced subtitle stream. As I see it, having more than 1 of those is a PEBKAC on behalf of whoever did the video muxing.
I'm not talking about normal subtitles, but about "forced" subtitles and it is a valid use case (when you select "forced subtitles only" in subtitle language settings of the media player).
Of course there is a dependency between "forced" subtitles to audio streams as you can read below.
And yes, subtitles auto-appear/disappear whenever a different audio stream is selected, as long there are "forced" subtitles available for a given audio language.
That's why as a workaround, I created dummy external forced "srt" subtitle files for languages missing in the original movie.

Here is the source code used in LibreELEC 9.2.6:
https://github.com/popcornmix/xbmc/blob/...Player.cpp

You can find there PredicateSubtitleFilter with the following documentation:
Quote:/** \brief The class' operator() decides if the given (subtitle) SelectionStream is relevant wrt.
* preferred subtitle language and audio language. If the subtitle is relevant <B>false</B> false is returned.
*
* A subtitle is relevant if
* - it was previously selected, or
* - it's an external sub, or
* - it's a forced sub and "original stream's language" was selected and audio stream language matches, or
* - it's a default and a forced sub (could lead to users seeing forced subs in a foreign language!), or
* - its language matches the preferred subtitle's language (unequal to "original stream's language")
*/
and PredicateSubtitlePriority documented as follows:
Quote:/** \brief The class' operator() decides if the given (subtitle) SelectionStream lh is 'better than' the given (subtitle) SelectionStream rh.
* If lh is 'better than' rh the return value is true, false otherwise.
*
* A subtitle lh is 'better than' a subtitle rh (in evaluation order) if
* - lh was previously selected, or
* - lh is an external sub and rh not, or
* - lh is a forced sub and ("original stream's language" was selected or subtitles are off) and audio stream language matches sub language and rh not, or
* - lh is a default sub and ("original stream's language" was selected or subtitles are off) and audio stream language matches sub language and rh not, or
* - lh is a sub where audio stream language matches sub language and (original stream's language" was selected or subtitles are off) and rh not, or
* - lh is a forced sub and a default sub ("original stream's language" was selected or subtitles are off)
* - lh is an external sub and its language matches the preferred subtitle's language (unequal to "original stream's language") and rh not, or
* - lh is language matches the preferred subtitle's language (unequal to "original stream's language") and rh not, or
* - lh is a default sub and rh not
*/