Open jmbreuer opened 5 months ago
As the subtitle handling is being done by InputStream.Adaptive, all the logging is done by it as well. Enable debug logging and you should see what is happening.
Looks to be a Heisenbug - finally found some time to dig into this, and right at this moment all subtitles that I try also work. I'll continue to keep an eye on this.
It seems that on my system I get subtitles for this video and not for that one.
I'm running Kodi Nexus 20.3 on a Raspberry 4b, Debian 12/64bit (Bookworm). I updated the addon via zip file to the recently released 7.0.4.nexus.1. Maybe this helps to predict Heisenbug's current location and evil doings^^
@martinSch81 - that is not related to the issue reported. Original issue is that the available subtitles do not appear to load for some unknown reason, not that there are no available subtitles.
The two videos you linked to both have subtitles, however the first one has both an actual UK English subtitle stream uploaded along with the video, and also the ASR English subtitle that is automatically generated by Youtube, plus all the translated subtitles as well. The second video only has the ASR English subtitle, plus all the translated subtitles.
If you have elected to not use the auto-generated subtitles, then the result is obvious - you won't have any available subtitles for the second video. If that is not the case, open a new issue and post a debug log so the problem can be looked into.
@jmbreuer - is the issue you are seeing occuring on translated subtitles? It may be that the particular base language to translated language pair that is chosen may not actually exist (yet), even if it is identified as being available.
@martinSch81 - that is not related to the issue reported. Original issue is that the available subtitles do not appear to load for some unknown reason, not that there are no available subtitles.
The two videos you linked to both have subtitles, however the first one has both an actual UK English subtitle stream uploaded along with the video, and also the ASR English subtitle that is automatically generated by Youtube, plus all the translated subtitles as well. The second video only has the ASR English subtitle, plus all the translated subtitles.
If you have elected to not use the auto-generated subtitles, then the result is obvious - you won't have any available subtitles for the second video. If that is not the case, open a new issue and post a debug log so the problem can be looked into. ...
Ah, stupid me. Thanks for pointing me in the right direction. I had in Subtitle language "English" selected and thought this will pick anything available in English since the next entry "English (no auto-generated)" sounded like the "higher quality only" subset. Now I use "English with Original/ASR fallback" and it does the job. No idea why I overlooked that.
@martinSch81 - can't test at the moment, but based on your description and looking at the code, I think you are right, something is not working the way it is intended to.
If you selected "English (no auto-generated)" it won't have shown any subtitles in your second video link, but if you selected "English" it should have made the auto-generated subtitles available.
I think the reason it didn't is because of a typo https://github.com/anxdpanic/plugin.video.youtube/blob/6ca0b94ad198ddcfccbc7180eabcb3c747f09574/resources/lib/youtube_plugin/youtube/helper/subtitles.py#L190 Should be
if '-' in lang:
@martinSch81 - can't test at the moment, but based on your description and looking at the code, I think you are right, something is not working the way it is intended to.
If you selected "English (no auto-generated)" it won't have shown any subtitles in your second video link, but if you selected "English" it should have made the auto-generated subtitles available.
I think the reason it didn't is because of a typo
Should be
if '-' in lang:
You are right. I changed that single line and updated the addon with that version. Now I get subtitles for both videos - the provided English subtitles for the first video and the auto-generated English subtitles for the second video.
On a related note, I now have to open the menu while a video is playing and choose enable subtitles. I have to do this for each video. Before the new versions (with the updated .json files), I was able to use the subtitles hotkey to enable and the setting was remembered.
On a related note, I now have to open the menu while a video is playing and choose enable subtitles. I have to do this for each video. Before the new versions (with the updated .json files), I was able to use the subtitles hotkey to enable and the setting was remembered.
I don't think there is anything specifically within this plugin that can effect this core Kodi functionality, but perhaps the use of InputStream.Adaptive means that Kodi doesn't know a video actually has subtitles enabled in time to enable them automatically when the stream starts. It's not related to this issue though, so open a new one and include a log. as I don't even know what settings you are using so can't even speculate as to what the issue may be.
I re-tested with the YouTube Addon 7.0.5 and as much logging as I could turn on (I did not find additional debugging options for the InputStream stuff, but there seems to be enough in the logs).
The upshot is, when selecting "Download subtitles before playback: Yes", subtitles work for me. But, there is no dynamic language selection during playback then, only ever one subtitle stream. When selecting "Download subtitles before playback: No", subtitles don't seem to work for me at all (since 7.0.4 and with all videos I've tested so far).
Here's some logs:
Aah, "all available languages" is a separate setting that does not allow to choose whether to download before playback at all. (I must have set it away from that during my last round of testing, and only remembered the significance late in this round.)
In my so far only test, it also worked, but it took one language switch for subtitles to show up, here's that log. Ah, in that latter one: When I seek around in the video, subtitles are gone again, until I switch their language again. I hope this is reproducible from above log, if not, I can capture more logs on this specific thing later. (I had to boot into Windows for other stuff, and while I do have ssh access to Kodi and everything, the way copy&paste does not work conveniently in Win makes me want to continue that journey later with Linux again.)
I'll further keep an eye on things.
Downloading the subs is only an option when a limited selection of languages is used, otherwise you will end up downloading 125 subtitles which will delay the loading and starting of the video playback.
If you do download the subtitles, then InputStream.Adaptive cannot be used to load them, instead Kodi will look for the subtitle files and load them itself, and it won't show a lot of useful information about the subtitle to select the one you want, which is another reason why downloading is not offered as an option when all languages are enabled
For some reason InputStream.Adaptive is not enabling the subtitle streams when they are loaded, which can be a problem on live streams with multiple periods, but that is not the case here. I can't reproduce the same behaviour. Maybe double check your InputStream.Adaptive settings and see whether you have enabled the loading of all stream types?
I won't have time to look at this in detail just at the moment. Can you upload the logs directly to github so they don't get deleted?
@vwghub
On a related note, I now have to open the menu while a video is playing and choose enable subtitles. I have to do this for each video. Before the new versions (with the updated .json files), I was able to use the subtitles hotkey to enable and the setting was remembered.
It seems that InputStream Adaptative has some kind of trouble enabling the Youtube subtitles with the hotkey. The hotkey activates/deactivates the flag, but the subtitles are not shown.
If you open the subtitles menu and activate them manually, then the hotkey starts working (showing/hiding subtitles) for that video run. Until you open the video again from the start, then the hotkey fails again.
If you deactivate InputStream Adaptative for the Youtube plugin, the subtitles hotkey always works as expected. So it seems the issue is not in the Youtube plugin.
@malversoft - can you provide a debug log showing this, both the use of the hotkey and activating manually?
@malversoft - can you provide a debug log showing this, both the use of the hotkey and activating manually?
I performed a sequence to demonstrate the behaviour I described in my previous message.
This debug test was done with:
Youtube config:
InputStream Adaptive config:
Sequence:
First I start this video (any video, that is irrelevant) with subtitles not enabled. Log: Video starts normally.
Then I try the hotkey and it does not work. 2.1. I press the hotkey to activate subtitles. -> "Subtitles" notification popup is shown, but subtitles OSD does not appear. 2.2 I press the hotkey again to deactivate subtitles. -> "Subtitles - Disabled" notification is shown. Log: Subtitles hotkey does not work.
I use the subtitles menu and it works, 3.1. I activate the subtitles manually. -> The notification is shown and subtitles appear in the OSD. 3.2. I deactivate the subtitles manually. -> The notification is shown and the OSD disappears. Log: Subtitles manual activation works.
After using manual activation, I try the hotkey again and it works. 4.1. I press the hotkey to activate subtitles. -> The notification is shown and subtitles appear in the OSD. 4.2 I press the hotkey again to deactivate subtitles. -> The notification is shown and the OSD disappears. Log: Now the subtitles hotkey works.
From then on, the subtitles hotkey works for that video playback. You can stop and continue playback and the hotkey keeps working. Unless you stop and restart the same video from the beginning, then the hotkey fails again.
If InputStream Adaptive is disabled in the Youtube plugin configuration, the subtitles hotkey always works as intended.
I hope this helps to clarify the issue somehow. It affects activating subtitles not only with a keyboard, but also with a remote control.
@malversoft - Thanks for that. It does seem to be the same issue as @jmbreuer has reported, just manifesting in a slightly different way.
What InputStream.Adaptive is doing is the same - it is checking the subtitle stream, identifying that it is not already enabled, but not trying to enable and open the stream. It does so correctly when the subtitle is selected from the selection dialog.
Will have to look a bit closer at what InputStream.Adaptive is doing here.
Context
Expected Behavior
When selecting and enabling any of the (now many including auto-translations) subtitle streams in Kodi, the subtitles should show up.
Current Behavior
This only works very sporadically for me. Most of the time, the list of available subtitles is there alright, but enabling subtitles simply doesn't show any.
Unfortunately, it's random - not tied to specific videos or anything else I could correlate so far.
Also, I don't see any smoking guns in the log. It's like most of the time, the subtitle stream would simply be delivered 'empty'.
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
Log
The log is super noisy, but does not seem to contain any information about subtitle streams actually loaded / their URLs / HTTP response codes etc.
I'm happy to capture more with more appropriate debugging in place, for example.
Additional Information
I have a slight suspicion that the first video after starting Kodi / resuming from suspend / ... tends to work, whereas all afterwards don't (for all the times I really had an eye on this issue).
There seems to be no difference between 'normal', auto-generated, translated or auto-translated subtitles regarding this.