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
10 second latency when switching between subtitles #21086
Comments
please provide a log with Kodi 20 (happens also on kodi 20 ?) |
@CastagnaIT check out #5312 |
Yep, sure sounds like my issue. Was it supposed to have been fixed back in 2014? Also, I'm unclear about buffering being the cause. If I start playback in the middle of a forced subtitles scene, the subs appear immediately. There's no waiting 8 seconds as that thread talked about. Why can't switching between subtitles be as quick? |
@crawfishie eg.
|
That's a "consequential" seek I was hoping to avoid. For my own installation, I could do that in Autohotkey, where I've implemented a new "toggle subtitles" command that works more usefully when forced subs are present. More on that here: https://forum.kodi.tv/showthread.php?tid=358553&pid=3003765#pid3003765 I don't do it because it would be rather intrusive, especially at the end of my "What did he say?" function. The start of the function is fine, because there's an implicit, expected Seek(-15), but after 20 seconds, an AHK timer fires, and subtitles are automatically turned off. It would be glitchy to do a Seek(-1) at the end of it to make forced subtitles appear immediately, which they should, because they're intended to be the "baseline" subtitles when present. OTOH, when forced subs are present, and subs are being switched instead of simply toggled, it's kind of perverse that my "What did he say?" function might leave you wondering "what he said" for 10 seconds after it's completed its duties, so maybe I will add a Seek(-1) to the end of it for that specific case, hopefully as a temporary measure. |
from: #5312 (comment)
now I don't know how it works overall VideoPlayer.cpp is very extensive code |
In general a video stream is comprised of video, audio, and subtitle streams. After demuxer the packets are progressively buffered by the stream players (up to 8 secs). The stream players have to synchronise output to VideoPlayer's clock. When buffers are full, demuxer is 8 secs ahead in time of output. Assume you switch subs from language A to language B. Since language B is not selected in he first place, those packets are thrown away right after demuxer. So right after switching the packets of language B have a timestamp of playing_time + 8 secs. |
This problem has existed for ages, there have also been issues for it, but they have all obviously disappeared into oblivion. Let's see if this will be fixed this time |
FWIW, buffering just forced and default would be sufficient for my purposes. I only ever use my custom toggle and "What did he say?" commands, and I became aware of the delay issue only because they switch between forced and default when forced are present, which is how I think they should work. I also take it that showing subs immediately when playback is started is fundamentally different than showing them immediately when switching from one to another during playback, and presumably the latter can't be made like the former without causing a noticeable audio/video glitch. Is this correct? |
@CastagnaIT I couldn't see this same issue with Inputstream Adaptive streams on 19.4 windows. I suspect that's because they are handled differently? |
@matthuisman you have to test with a MKV video the behaviour is same with all Kodi versions, its clear that VP need to be revisited in some way, kodi is the only player that need to wait the internal buffering to have subtitle displayed after a subs switching if for some reason the internal buffer will be increased in the future, this will worsen this situation and many more users will complain, i noticed this problem a years ago and I never understood where the problem came from until now... |
Moving packet selection https://github.com/xbmc/xbmc/blob/master/xbmc/cores/VideoPlayer/VideoPlayer.cpp#L1611 to the stream players would solve the issue. EDIT: updated link https://github.com/xbmc/xbmc/blob/Matrix/xbmc/cores/VideoPlayer/VideoPlayer.cpp#L1611 |
I've just played my first files with external .srt subtitles, one forced, the other not. Kodi Nexus Alpha switches between the two without delays. However, the files I described in my OP still incur the delay. Can anyone explain the discrepancy, why external text subtitles perform as desired, and internal text subtitles do not? |
Bump for no reply in 2.5 months. Anyone? |
@crawfishie the problem is about buffered packages in VP there is a kind of propose to try make a fix in the comment above, I have too little VP knowledge, i am not able to make the changes myself |
Hey, this is still an issue in Omega, is there anything planned for this? Thanks! |
Bug report
Describe the bug
Here is a clear and concise description of what the problem is:
When switching between subtitles (internal, UTF-8 in a .mkv file) using the dialog box, "Next subtitle", or JSON, the current subtitles disappear immedately, but the newly selected ones take about 10 seconds to appear. This delay does not occur when toggling subtitles on from the off state, and I don't think it should be happening when switching between subtitles. The latency can be eliminated if I immediately do a seek, even a Seek(-1). However, Seek(0) does not help.
Expected Behavior
Here is a clear and concise description of what was expected to happen:
After switching from one subtitle to another, the newly selected ones were expected to appear within a second or two at most, just as quickly as they appear when subtitles are off, and you toggle them on.
Actual Behavior
It takes up to 10 seconds for the newly selected subtitles to appear after I switch between different subtitles.
Possible Fix
A seek not equal to zero causes subtitles to appear immediately. Perhaps this could be leveraged to address the problem without doing a consequential seek.
To Reproduce
Steps to reproduce the behavior:
Debuglog
The debuglog can be found here: https://paste.kodi.tv/xudoqazoju.kodi
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:
I started a couple of threads about it here:
"Next subtitle" has 10 second latency before subtitles are shown: https://forum.kodi.tv/showthread.php?tid=365849
Why this matters to me so much: https://forum.kodi.tv/showthread.php?tid=365836&pid=3074425#pid3074425
In a nutshell:
Your Environment
Used Operating system:
Android
iOS
tvOS
Linux
OSX
Windows
Windows UWP
Operating system version/name: Sony BRAVIA 4K VH2 with Android 10.0.0 API level 29, kernel: Linux ARM 32-bit version 4.19.75 (Also Windows 10 and Kodi 19.3 per the forum threads I created back in 12/21 and linked to above)
Kodi version: 19.4 (19.4.0) Git:20220302-e12e66e019
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 text was updated successfully, but these errors were encountered: