Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forced subtitles not working when audio and subtitle language is different #15672

Open
1 of 7 tasks
The-Choo-Choo-Shoe opened this issue Mar 5, 2019 · 33 comments
Open
1 of 7 tasks
Labels
Triage: Confirmed issue has been reproduced by a team member

Comments

@The-Choo-Choo-Shoe
Copy link

The-Choo-Choo-Shoe commented Mar 5, 2019

Bug report

Describe the bug

Here is a clear and concise description of what the problem is:

When playing a video with forced subtitles it doesn't automatically turn on if the subtitle language is different from the audio language.

For example I have an anime episode with JPN video, JPN audio and ENG forced subtitles, this doesn't work as subtitles are not enabled by default even with "Forced only" enabled in settings.

If I take the same file and change it in MKVToolNix to ENG video, ENG audio and ENG forced sub without actually changing the files it works and forced subtitles are enabled by default like they should.

Expected Behavior

Here is a clear and concise description of what was expected to happen:

Matching language for audio and subtitles should be irrelevant as forced should mean forced no matter what language is set on the file as long as the subtitle is flagged as forced.

Actual Behavior

Only enables forced subtitles by default if audio and subtitle language matches.

Possible Fix

To Reproduce

Steps to reproduce the behavior:

  1. Take a file and change audio and subtitles language to different languages in MKVToolNix as well as flagging it as forced.
  2. Take the same file but this time make another one with audio and subtitle language set to the same language.
  3. Play both files in Kodi and the first file will have subtitles disabled even with "Forced only" enabled while the 2nd file will play just fine.

Debuglog

The debuglog can be found here:
kodi.log

Screenshots

Here are some links or screenshots to help explain the problem:

Additional context or screenshots (if appropriate)

Here is some additional context or explanation that might help:

Your Environment

Used Operating system:

  • Android

  • iOS

  • Linux

  • OSX

  • Raspberry-Pi

  • Windows

  • Windows UWP

  • Operating system version/name: Android TV 8.0.0

  • Kodi version: Kodi 18.1 20190228

note: Once the issue is made we require you to update it with new information or Kodi versions should that be required.
Team Kodi will consider your problem report however, we will not make any promises the problem will be solved.

@The-Choo-Choo-Shoe
Copy link
Author

Still broken in 20190410

@The-Choo-Choo-Shoe
Copy link
Author

Not fixed in 18.2 either.

@jjd-uk
Copy link
Member

jjd-uk commented Apr 25, 2019

This is how it's meant to be I believe see #3396 (comment)

If I understood right then if the Force subtitles you wish to automatically started do not match the audio language then they should be flagged as Forced & Default.

@ace20022 If you are around can you comment to confirm what correct behavior should be?

@jjd-uk
Copy link
Member

jjd-uk commented Apr 25, 2019

This also seems to back up that behaviour is as designed and not a bug #9111 (comment)

[edit] Just noticed the code comments at https://github.com/xbmc/xbmc/blob/master/xbmc/cores/VideoPlayer/VideoPlayer.cpp#L222-L234

So indeed working as designed.

@jjd-uk jjd-uk added the Resolution: By design behavior reported in the issue is actually correct label Apr 25, 2019
@jjd-uk jjd-uk closed this as completed Apr 29, 2019
@sammy2142
Copy link

@jjd-uk
Hi I have just run into the same issue.
Changing the subtitle flag to forced and default doesn't automatically enable the subtitle either :(
(if audio language is set to English, Original Language or Media Default and sub language is set to "forced only" it does not enable them - Any other subtitle option enables subs for all movies.)

I am a little confused about the correct procedure to have:
English Forced subtitles playback for non-English parts in an English Audio movie and
English subtitles playback on non-English audio movies.

Thanks

@The-Choo-Choo-Shoe
Copy link
Author

The-Choo-Choo-Shoe commented May 14, 2019

@jjd-uk
Hi I have just run into the same issue.
Changing the subtitle flag to forced and default doesn't automatically enable the subtitle either :(
(if audio language is set to English, Original Language or Media Default and sub language is set to "forced only" it does not enable them - Any other subtitle option enables subs for all movies.)

I am a little confused about the correct procedure to have:
English Forced subtitles playback for non-English parts in an English Audio movie and
English subtitles playback on non-English audio movies.

Thanks

I can't believe how this is the intended way it's supposed to work because if it is then the option should not be named "forced".

@jjd-uk jjd-uk reopened this May 15, 2019
@jjd-uk
Copy link
Member

jjd-uk commented May 15, 2019

Ok I've reopened issue as after some internal discussion I am now not 100% sure what is meant be to the correct behaviour.

@jjd-uk
Copy link
Member

jjd-uk commented May 15, 2019

@ace20022 if you have any available time could you explain what should be correct operation.

@jjd-uk jjd-uk added Triage: Confirmed issue has been reproduced by a team member and removed Resolution: By design behavior reported in the issue is actually correct labels May 15, 2019
@sammy2142
Copy link

Thanks @jjd-uk - Have a good holiday.

I think a good solution to this issue while maintaining the current rules is to add a new subtitle option "show with foreign audio":

  1. Uses the existing logic to playback forced subtitles if the audio language matches the forced subtitle language.
  2. If the preferred audio stream language is not present in the video file, enable preferred language subtitles if available.

You will also have an issue if the audio language is not flagged in the media file - should subs be enabled or disabled in this case etc

@jjd-uk
Copy link
Member

jjd-uk commented May 15, 2019

I believe default and forced was supposed to work due to comments left in the code, however from speaking to someone internally earlier it seems the way it's currently coded if never gets to the relevant check.

As for improvements, that would have to be a request on the forum. Perhaps there should be 2 language selectors, one for forced and one for full subs.

@ghost
Copy link

ghost commented Jul 20, 2019

MKV files can have multiple subtitle tracks marked as forced.

For example the following

audio tracks:
    German, default YES
    English, default NO 
subtitle tracks:
    German, default NO, forced NO
    German, default YES, forced YES
    English, default NO, forced NO
    English, default NO, forced YES 

German audio track and German forced subtitle track are automatically chosen because both marked as default. When toggling audio track to English, the forced English subtitle track is automatically chosen. Kodi behaves correct IMHO.

@The-Choo-Choo-Shoe
Copy link
Author

The-Choo-Choo-Shoe commented Jul 20, 2019

MKV files can have multiple subtitle tracks marked as forced.

For example the following

audio tracks:
    German, default YES
    English, default NO 
subtitle tracks:
    German, default NO, forced NO
    German, default YES, forced YES
    English, default NO, forced NO
    English, default NO, forced YES 

German audio track and German forced subtitle track are automatically chosen because both marked as default. When toggling audio track to English, the forced English subtitle track is automatically chosen. Kodi behaves correct IMHO.

Using your template, do you believe this to be correct as well? Because it works really backwards to me and I've never seen any media player do it like this, ever.

For example:

Audio Tracks:
Japanese, default YES, forced YES

Subtitle Tracks:
English (Dialogue), default YES, forced YES
Swedish (Dialogue), default NO, forced NO

On this file, it will play using the Japanese audio and NOT enable the forced ENGLISH subtitle because the forced subtitle is not the same language as the audio track, if I change the tag from JPN to ENG using something like MKVToolNix it will enable the forced subtitle because now it matches the audio language.

Audio and subtitle language should not need to match to use the forced tag, it ruins the functionally of anything foreign.

EDIT: It can still function the same way for you, just have it enable the first forced subtitle in the list anyway even if no AUDIO + SUBTITLE language match is found.

It would make it enable GER forced if you're on GER audio, like now for you, or ENG for ENG. But if no match is found just enable the first forced subtitle in the list, makes it possible to use with foreign media.

@ghost
Copy link

ghost commented Jul 20, 2019

Audio and subtitle language should not need to match to use the forced tag, it ruins the functionally of anything foreign.

Nope, I disagree. The FORCED-tag should not lead to a subtitle track being enabled automatically, but the DEFAULT-tag should. So in your example: Yes, the English subtitle track should be enabled automatically, because it is marked as DEFAULT subtitle track, independently of the language.

@The-Choo-Choo-Shoe
Copy link
Author

The-Choo-Choo-Shoe commented Jul 20, 2019

Audio and subtitle language should not need to match to use the forced tag, it ruins the functionally of anything foreign.

Nope, I disagree. The FORCED-tag should not lead to a subtitle track being enabled automatically, but the DEFAULT-tag should. So in your example: Yes, the English subtitle track should be enabled automatically, because it is marked as DEFAULT subtitle track, independently of the language.

If we went by Default tag in "Forced only" mode then we'd run into other issues, like I'm watching an English movie that has English subtitles but I don't want them enabled because I can watch without, It would enable that subtitle even when I've set "Forced only" in Settings.

Forced should automatically enable subtitle otherwise it wouldn't be called forced.

@ghost
Copy link

ghost commented Jul 20, 2019

No. I disagree again. There may me multiple subtitle tracks marked as FORCED but there must only be up to one subtitle track marked as DEFAULT. It is also possible that there is no subtitle track marked as DEFAULT.

In your example given last, the English subtitle track should be tagged as DEFAULT=no and FORCED=no, because it is probably the subtitle track required for non-English viewers only. Therefore it would not be enabled by default and has to be enabled manually when required.

@The-Choo-Choo-Shoe
Copy link
Author

No. I disagree again. There may me multiple subtitle tracks marked as FORCED but there must only be up to one subtitle track marked as DEFAULT. It is also possible that there is no subtitle track marked as DEFAULT.

In your example given last, the English subtitle track should be tagged as DEFAULT=no and FORCED=no, because it is probably the subtitle track required for non-English viewers only. Therefore it would not be enabled by default and has to be enabled manually when required.

There is no way to only enabled Default tagged subtitles. Using Forced is the only way you can tell Kodi when you want a subtitle and when you don't want it.

@Ashyni
Copy link

Ashyni commented Aug 5, 2019

Hi, i don't know if i open my own issue to discuss subtitles auto-behavior (almost the same subject here), so i gonna start here.

I think the behavior for FORCED subtitles is normal, they should be use for foreign language translation only and be based on the current Audio language and never be use for full translation.

For your Anime you should have :

Audio Tracks:
  Japanese, default YES, forced YES
Subtitle Tracks:
  English (Dialogue), default YES, forced NO
  Swedish (Dialogue), default NO, forced NO

and if you want the correct subtitles to be use for all your video, you should setup :
Settings > Player > Language > Preferred subtitle language :
English / User Interface Language / Original Language, if you're sure the DEFAULT is the good one but i prefer the first 2 option.

But this first 2 option (English or any other lang. / User interface language) don't ignore FORCED and DEFAULT subtitles so the full translation is never selected, and this is my issue.

Audio Tracks:
  German, default YES
  English, default NO 
Subtitle Tracks:
  German (Full), default NO, forced NO
  German (Foreign), default YES, forced YES
  English (Full), default NO, forced NO <-- selection wanted
  English (Foreign), default NO, forced YES <-- selected

The solution would be to change this behavior for this 2 option or add a new option apart to ignore FORCED and DEFAULT subtitles if one of the 2 option is selected, to allow the full translation to be use automatically.
My workaround for now is to keep only the subtitles language wanted and undetermined the language of the FORCED one like this :

Audio Tracks:
 German, default YES
 English, default NO 
Subtitle Tracks:
 English (Full), default NO, forced NO
 Undermined (Foreign), default YES, forced YES

Forced Only / Original language / Specific language (or UI) work correctly with this workaround but it's not working if you want more subtitles language and it's annoying to edit every subtitles movie/tv show/anime.

@peak3d
Copy link
Contributor

peak3d commented Oct 30, 2019

If we went by Default tag in "Forced only" mode then we'd run into other issues, like I'm watching an English movie that has English subtitles but I don't want them enabled because I can watch without, It would enable that subtitle even when I've set "Forced only" in Settings.

Forced subtitles is for spoken / written stuff, which differs from the original audio stream. For example if you have russian language in your above mentioned english audio track.

IMO it does not make any sense by concept to provide a japanese audio track only and an english forced sub track.

@sammy2142
Copy link

Kodi can be a lot smarter at selecting subtitles automatically.
Kodi knows your interface/preferred language.
Kodi can read the audio language of a video file (assuming its correctly tagged).

Kodi could see if the video audio language differs from your preferred language and enable subtitles in your preferred language if they exist.

At the moment you have to manually enable subs if your watching a foreign language movie. No current options exist for this use case to automatically have subtitles displayed (not counting always on).

Plex currently does this - while with other apps you could just use the forced flag as a work around instead.

@peak3d
Copy link
Contributor

peak3d commented Oct 30, 2019

@sammy2142 I agree that there is a missing option for "always enable subtitles".

Kodi can read the audio language of a video file (assuming its correctly tagged).

In general its wrong tagged / not tagged (UNK)

Implementing solutions to repair wrongly tagged tracks will lead to a big mess sooner or later.
But we are currently discussing internally, if the default tag in your english Forced track should be interpreted that it is displayed for all audio languages. This should then solve at least the issue of the original post.

@ghost
Copy link

ghost commented Oct 30, 2019

But we are currently discussing internally, if the default tag in your english Forced track should be interpreted that it is displayed for all audio languages.

This would IMHO not make sense. A forced sub track should only be enabled for the corresponding language, see example above.

@arnova
Copy link
Member

arnova commented Oct 30, 2019

@sammy2142 I agree that there is a missing option for "always enable subtitles".

Kodi can read the audio language of a video file (assuming its correctly tagged).

In general its wrong tagged / not tagged (UNK)

Implementing solutions to repair wrongly tagged tracks will lead to a big mess sooner or later.
But we are currently discussing internally, if the default tag in your english Forced track should be interpreted that it is displayed for all audio languages. This should then solve at least the issue of the original post.

Maybe I misunderstand it but will this also fix the issue that starting with v18, English subtitles embedded in eg. mkv are no longer automatically shown if you've set your preferred subtitle language, in my case, to Dutch? Currently there's no way to force any "alternative" subtitles which may be available.

@sammy2142
Copy link

sammy2142 commented Oct 30, 2019

@sammy2142 I agree that there is a missing option for "always enable subtitles".

Kodi can read the audio language of a video file (assuming its correctly tagged).

In general its wrong tagged / not tagged (UNK)

Implementing solutions to repair wrongly tagged tracks will lead to a big mess sooner or later.
But we are currently discussing internally, if the default tag in your english Forced track should be interpreted that it is displayed for all audio languages. This should then solve at least the issue of the original post.

In this case almost always the user would have to mark the subtitle track as forced anyway. They may as well correctly tag/flag the audio track language if it is not tagged (unknown etc) at the same time.

This will leave you with just the one option to decide whether you should enable the subtitles if the audio track is an unknown language or disable.

At the end of the day I think it should be down to the user to correctly tag/flag audio/subtitle tracks if they want them displayed correctly all the time.

@Dnkhatri
Copy link

This add on solves some of the problems though not all of them
https://forum.kodi.tv/showthread.php?tid=153783&page=14&highlight=language

@peak3d
Copy link
Contributor

peak3d commented Nov 2, 2019

But we are currently discussing internally, if the default tag in your english Forced track should be interpreted that it is displayed for all audio languages.

This would IMHO not make sense. A forced sub track should only be enabled for the corresponding language, see example above.

@peak3d peak3d closed this as completed Nov 2, 2019
@peak3d peak3d reopened this Nov 2, 2019
@TheMontezuma
Copy link

For example:

Audio Tracks:
Japanese, default YES, forced YES

Subtitle Tracks:
English (Dialogue), default YES, forced YES
Swedish (Dialogue), default NO, forced NO

On this file, it will play using the Japanese audio and NOT enable the forced ENGLISH subtitle because the forced subtitle is not the same language as the audio track, if I change the tag from JPN to ENG using something like MKVToolNix it will enable the forced subtitle because now it matches the audio language.

Audio and subtitle language should not need to match to use the forced tag, it ruins the functionally of anything foreign.

No. You want to missuse the 'forced' flag.

'Forced' subtitles shall be displayed only in 2 cases:

  1. Spoken language does not temporarily match the audio language (for example: in a Japanese movie, there is a scene when people speak German for 2 minutes)
  2. Some (important to understanding the movie) text appears on the screen (for example: in a Japanese movie, there is a scene when you see a German Newspaper Headline)

In my opinion only this makes sense:

Audio Tracks:
Japanese, default YES, forced YES

Subtitle Tracks:
Japanese, default YES, forced YES
English (Dialogue), default NO, forced NO
Swedish (Dialogue), default NO, forced NO

When you want to display English subtitles for Japanese movies, just enable English subtitles in the menu for a particular movie.

@bigOconstant
Copy link

I really want the subtitles to display in this situation. Surely we can add a checkbox to force forced subtitles?

@adam-aph
Copy link

adam-aph commented May 18, 2023

In my case currently implemented logic is not working either. You can be a purist and say that this is encoding issue, but here is the reality - this is what I typically see in MKVs (original audio track is English / French / German / Spanish etc):

Audio #1  Title: Polish,           Language: Polish,   Default: Yes,  Forced: No    (audio track with added Polish voice-over)
Audio #2  Title: English,          Language: English,  Default: Yes,  Forced: No    (original audio track)
Text  #1  Title: Polish [Forced],  Language: Polish,   Default: No,   Forced: Yes   (very limited subtitles track, it contains nearly nothing)
Text  #2  Title: Polish,           Language: Polish,   Default: No,   Forced: No    (full subtitles track)

With my typical setup:

Preferred audio Language: English
Prefer default audio streams: off
Preferred Subtitle Language: Polish

I'm landing with forced subtitles stream, which is completely not usable.

I think all these automatic rules to handle forced subtitles (VideoPlayer.cpp#L220-L229) are fine but should be triggered only by choosen audio language, when preferred subtitle language is not set:

Preferred Subtitle Language: None

As soon as user will explicitly choose subtitle language, the automatic logic should be disabled and an option for handling forced subtitles should be presented:

Preferred Subtitle Language: Polish
    Prefer forced subtitles: off

Wouldn't that handle all these concerns with subtitles?

@rockrider69
Copy link

First I agree that it look strange to ask for Forced subtitles in a language different from the audio one (would not consider it a KODI bug really...).

But anyway if the OP or some else needs to achieve this or more complex situations, you can have a look at "Language Preference Manager" add-on, already mentionned earlier, which should do the tricks.

https://forum.kodi.tv/showthread.php?tid=153783&page=24

Hope it can help ;)

@The-Choo-Choo-Shoe
Copy link
Author

First I agree that it look strange to ask for Forced subtitles in a language different from the audio one (would not consider it a KODI bug really...).

But anyway if the OP or some else needs to achieve this or more complex situations, you can have a look at "Language Preference Manager" add-on, already mentionned earlier, which should do the tricks.

https://forum.kodi.tv/showthread.php?tid=153783&page=24

Hope it can help ;)

I used this for a while but I personally just went back to Plex instead, subtitles load the way I want there out of the box.

For Kodi I think implementing something like LAV Filters is the way forward to please everyone, there I can just used this for loading subtitles in custom options: eng:eng|f,eng:off,:eng|!f,:eng

@adam-aph
Copy link

adam-aph commented Nov 3, 2023

First I agree that it look strange to ask for Forced subtitles in a language different from the audio one (would not consider it a KODI bug really...).

I would do... 😃 or maybe just consider it as missing functionality (to opt out forced subtitles). For this particular need I was pushed to write my own plugin for Kodi 😄

service.IgnoreForcedSubtitles

@rockrider69
Copy link

In my case currently implemented logic is not working either. You can be a purist and say that this is encoding issue, but here is the reality - this is what I typically see in MKVs (original audio track is English / French / German / Spanish etc):

Audio #1  Title: Polish,           Language: Polish,   Default: Yes,  Forced: No    (audio track with added Polish voice-over)
Audio #2  Title: English,          Language: English,  Default: Yes,  Forced: No    (original audio track)
Text  #1  Title: Polish [Forced],  Language: Polish,   Default: No,   Forced: Yes   (very limited subtitles track, it contains nearly nothing)
Text  #2  Title: Polish,           Language: Polish,   Default: No,   Forced: No    (full subtitles track)

With my typical setup:

Preferred audio Language: English
Prefer default audio streams: off
Preferred Subtitle Language: Polish

I'm landing with forced subtitles stream, which is completely not usable.

....

@adam-aph
😄 great that Kodi has this flexibility creating our own add-ons 👍

Nevertherless if you would like to give it a try with LPM, I believe 2 basic rules like

  • CustomAudio: Eng>Pol
  • CustomCondSubs: Pol:Non>Eng:Pol
    might give you what you are looking for in this specific case.

Pol:Non will disable all subtitles (even default ones) when Pol audio exists and is chosen, except if it finds a Pol forced subtitle track (which you do have here).
Eng:Pol will activate the non-forced Pol subtitle track always skipping the forced one. BTW using Any:Pol instead would show Pol non-forced subs for any other audio than Pol.

Sorry all, I did not mean to hijack this thread, but hopefully the discussion can help some ;-) ...
(we can of course talk further about LPM on its own forum).

@adam-aph
Copy link

adam-aph commented Nov 3, 2023

Thanks, but I will focus on my own shit, it does exactly what I need in pretty ascetic way 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Triage: Confirmed issue has been reproduced by a team member
Projects
None yet
Development

No branches or pull requests