xbmc / inputstream.adaptive

kodi inputstream addon for several manifest types
Other
452 stars 241 forks source link

[Possible DASH subtitle-bug] Subtitles wont stay on for live DASH-stream #1574

Closed boirello closed 3 months ago

boirello commented 3 months ago

Describe the problem

Not sure if this is a bug in inputstream.adaptive, but I had no responses on forum.kodi.tv regarding this problem: https://forum.kodi.tv/showthread.php?tid=377569

The behaviour I see, is this:

I wonder if this may be because Kodi is requesting the next subtitle segment to soon? Or because the video stream may have a frame rate of 50 or 25?

   <Representation id="V0" bandwidth="6923000" codecs="avc1.64002a" frameRate="50" width="1920" height="1080" sar="1:1"/>
   <Representation id="V1" bandwidth="4989000" codecs="avc1.640020" frameRate="50" width="1280" height="720" sar="1:1"/>
   <Representation id="V2" bandwidth="2993000" codecs="avc1.64001f" frameRate="25" width="1280" height="720" sar="1:1"/>
   <Representation id="V3" bandwidth="1688000" codecs="avc1.64001f" frameRate="25" width="1024" height="576" sar="1:1"/>
   <Representation id="V4" bandwidth="974000" codecs="avc1.64001e" frameRate="25" width="768" height="432" sar="1:1"/>

Possible fix

No response

Steps to reproduce

Requirements:

  1. Have a subscription for Teliaplay Norway (I dont know if this problem is present in Sweden, Finland, or other contries where Teliaplay is available).
  2. Install my quick-fix fork of @Mariusz89B's teliaplay plugin which supports login from Norway: https://github.com/boirello/plugin.video.teliaplay-boirello

Steps to repoduce the bug:

  1. Select Live TV from the main menu
  2. Choose a channel that have live texting (i.e. the NRK-channels in Norway)
  3. Enable subtitles (the second one if channel is NRK)
  4. Watch for 30 seconds or a minute, and observe that the subtitle at first appear, but then disappear and never shows up again.

Debug log

Full debug log where two subtitle segments are downloaded at first (curl-commands), but then the next segments are not: https://paste.kodi.tv/vanecovola.kodi

Stream manifest file(s)

Example of how the manifest.mpd may look like: https://paste.kodi.tv/rogufojovo manifest.txt

Two subtitles are present (ID T2 and T3), and they appear to be in TTML-format:

  <AdaptationSet id="5" mimeType="application/mp4" lang="nor" segmentAlignment="true" startWithSAP="1">
   <Role schemeIdUri="urn:mpeg:dash:role:2011" value="subtitle"/>
   <SegmentTemplate initialization="sc-gaFEzQGL/$RepresentationID$_init.mp4" media="sc-gaFEzQGL/$RepresentationID$_t$Time$.m4s" timescale="90000" presentationTimeOffset="154614284672912">
    <SegmentTimeline>
<S t="154614284672912" d="540000" r="1995"/>
    </SegmentTimeline>
   </SegmentTemplate>
   <Representation id="T2" bandwidth="4000" codecs="stpp.ttml.im1t"/>
  </AdaptationSet>
  <AdaptationSet id="6" mimeType="application/mp4" lang="nor" segmentAlignment="true" startWithSAP="1">
   <Role schemeIdUri="urn:mpeg:dash:role:2011" value="caption"/>
   <SegmentTemplate initialization="sc-gaFEzQGL/$RepresentationID$_init.mp4" media="sc-gaFEzQGL/$RepresentationID$_t$Time$.m4s" timescale="90000" presentationTimeOffset="154614284672912">
    <SegmentTimeline>
<S t="154614284672912" d="540000" r="1995"/>
    </SegmentTimeline>
   </SegmentTemplate>
   <Representation id="T3" bandwidth="4000" codecs="stpp.ttml.im1t"/>
  </AdaptationSet>

The first one (T2) is texting only foreign language (value="subtitle"), while the second one (T3) is texting everything (value="caption"). This problem occurs on both T2 and T3.

The problem also occurs on both live texting (i.e. texting on news) and on regular programs on TV. Video On Demand seems to work fine (not affected).

Additional info

No response

Operating system(s)

Windows

Operating system version(s)

Windows 10

InputStream Adaptive version(s)

21.4.9 (Widewine CDM: 4.10.2710.0)

Kodi version(s)

Kodi 21.0

boirello commented 3 months ago

Here is an example of two subtitle segments (I added the .log fileending just to be able to upload the files here): T3_t154614455852912.m4s.log T3_t154614456392912.m4s.log

CastagnaIT commented 3 months ago

no one will investigate for Kodi 20 for that version development is ended

you can test your problem on Kodi 21, and then update your Issue for Kodi 21 version or close/create a new one

i want also remind you that logs like the one you posted is not so useful, the log must be in full without being shrinked

boirello commented 3 months ago

no one will investigate for Kodi 20 for that version development is ended

you can test your problem on Kodi 21, and then update your Issue for Kodi 21 version or close/create a new one

i want also remind you that logs like the one you posted is not so useful, the log must be in full without being shrinked

I have now installed Kodi 21 on Windows and ran it in portable mode (kodi.exe -p) to not mess with my current setup. Because of this, I have now removed Linux from the list of operation systems since I havent tested Kodi 21 there.

I have only installed my test plugin for teliaplay, and adjusted the buffer (which I dont think is related to this problem, but if you wish I can reset it and test again).

The log is replaced with a full log from start to end, where debugging is enabled: https://paste.kodi.tv/vanecovola.kodi

Observe that two subtitle-segments where downloaded at first (line 905 and line 913), and then subtitle-segments are not requested any more for some reason - while video- and audio-segments continue to be requested.

CastagnaIT commented 3 months ago

sound like that subs stream has been closed i made a little change but idk if will works try test this test build on your portable K21: https://jenkins.kodi.tv/blue/organizations/jenkins/xbmc%2Finputstream.adaptive/detail/PR-1576/1/artifacts/

boirello commented 3 months ago

It seems to be working now 👍 - I watched NRK1 live for 10 minutes, where a sport event were live texted: https://paste.kodi.tv/axowamukaj.kodi

But I did have 4 short buffering events during this playback (CVideoPlayerAudio::Process - stream stalled), but I dont know if this is caused by:

So the buffering can be unrelated, but nice if you can take a look at it.

boirello commented 3 months ago

I tested seek by the way - went 10 minutes back, then one minute forward, etc. At every seek I get at green video picture at first, but when the video loads, its fine again. Not a problem really, but I think I didnt see this in previous version of inputstream adaptive.

CastagnaIT commented 3 months ago

But I did have 4 short buffering events during this playback (CVideoPlayerAudio::Process - stream stalled), but I dont know if this is caused by:

ISA is not so well optimized for live streaming and sometime can happens buffering problems you can try mimetize the problem by using a higher live_delay value with https://github.com/xbmc/inputstream.adaptive/wiki/Integration#inputstreamadaptivelive_delay-

At every seek I get at green video picture at first, but when the video loads, its fine again

this is a know problem with some streams, no idea if can be fixed in some way

however your feedback confirms that the fix works, it was the only old piece of code that i suspected was causing problems

boirello commented 3 months ago

I just watched for an hour now with no buffering at all, so maybe random, or maybe caused by the enabled debugging which I now turned off. Anyway: Subtitles were now present throughout the whole hour I watched, including when I seek backward and forward, so nice work. :-)

I have not tried the inputstream.adaptive.live_delay-flag, but I thought of trying it. The DASH manifest already have suggestedPresentationDelay set to 10 sec. I may try to change it to 16 if buffering starts happening again. But I guess this flag wont make a difference for the VOD-content?

Will you publish this fix for Kodi 20 as well, or just for Kodi 21?

CastagnaIT commented 3 months ago

Will you publish this fix for Kodi 20 as well, or just for Kodi 21?

nope, the old version is more messed up, making even a small change without thorough testing can create regressions and compromise functionality for many users, since no devs has time to dedicate it is not worth the risk

boirello commented 3 months ago

Copy that.

Then I think we can close this bug.