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

Add support for Periods #287

Closed
michaelarnauts opened this issue Jul 8, 2019 · 43 comments
Closed

Add support for Periods #287

michaelarnauts opened this issue Jul 8, 2019 · 43 comments

Comments

@michaelarnauts
Copy link
Contributor

I have a DASH manifest with multiple Periods, but currently, only the last Period is played (not the first as documented in the README.md).

Is there any progress being made to support this? Is this something that has to be parsed in this codebase, or does a lot has to change for this? I'm thinking about the total stream duration that should be the sum of all periods, seeking outside a period...

@dagwieers
Copy link
Contributor

@mediaminister Maybe you have some knowledge of this?

@mediaminister
Copy link
Contributor

mediaminister commented Jul 8, 2019

Take a look at my test branch: https://github.com/mediaminister/inputstream.adaptive/tree/test
I can play the first period, but I have no clue how to add the second period to the stream.

Maybe @peak3d can give us some tips where to start in the codebase to implement this?

@michaelarnauts
Copy link
Contributor Author

@peak3d can you take a look at how we solve this best?

@michaelarnauts
Copy link
Contributor Author

I've thought a bit about this, and talked with @dagwieers about this, I guess the only correct implementation is some kind of playlist that contains all the Periods and plays them one by one.

Please correct me when I'm mistaken with some of my assumptions.

  • I want to play all periods one by one. They should not be skipped.
  • The periods are different streams, with different codecs, resolutions or encapsulation. Some periods aren't encrypted with widevine others are. This makes me think that we can't use one stream for all periods since the player needs to be reinitialised for the next stream.
  • Chapters will not work, since they work in one stream (think like DVD chapters) and just jump to timecodes.
  • I think for the subtitles, there is chance that it will just work. If the period after an advertisement break sets the right timecodes (so they don't start at 0, but continue where it left off), the subtitles will just use the right timecode and will work fine.
  • What would be cool, but I don't see how this can work is that all the periods are on one timeline, so you can seek in the whole program, and not just in your current period. This is not how playlists work however.

@peak3d
Copy link
Contributor

peak3d commented Aug 23, 2019

thx @michaelarnauts, this helps to get an idea about the topic and makes sense.

@matthuisman
Copy link
Contributor

I've just struck a multiple period stream as well.
All the main content is in the first period which IA skips unfortunately.

Maybe a good start is first just updating the code to use the 1st period found.
I assume it's just parsing line by line and not check if it already has a period.
The same check could also be done for multiple base_urls as well (use 1st found).
(as per my issue here: #283)

@mediaminister
Copy link
Contributor

With other streams the first period may be a commercial...
But I have a commit which always uses the first period: mediaminister@35d9160

@matthuisman
Copy link
Contributor

I'm thinking if there is anyway I can proxy the mpd file to merge the periods myself.
I don't think it's possible...
Unless IA could handle 2x SegmentTemplates in a single representation?

@dagwieers
Copy link
Contributor

dagwieers commented Sep 2, 2019

Yeah, so choosing the first or last period will most likely makes one party happy, and breaks it for another party. At least it may break things that were working flawlessly today (e.g. VTM GO children shows).

Another option coined by @peak3d was to play the largest segment, which would be the better option for the cases where there is only one real segment. But it would fail for the reporter of the issue. So personally I would not look at quick fixes as they are a distraction for doing what is needed.

PS I was honestly surprised that Kodi (or inputstream.adaptive) is having its own implementation for handling manifests etc. Surely other Open Source media players have the same needs and possibly a better/more complete implementation? Possibly something we can collaborate on?

@peak3d
Copy link
Contributor

peak3d commented Sep 7, 2019

Anyone can point me to a free resource / .strm file where protected content is inside a multi period manifest?
Edit: Beside this you can start thinking about how to skip advertisment, from what I have seen so far the url could be used or something that only encrypted streams should be parsed.

@mediaminister
Copy link
Contributor

@dagwieers
Copy link
Contributor

IMO we don't want to skip the ads per se. If the business model of the content provider is advertisements, I think we need to respect that. If that is technically not possible, then that is how it is and up to the add-on developer to either make the user aware of the terms of use or disclaim any rights. If it would be possible to also avoid forwarding ads then I would keep such an option open for the add-on. That's my opinion.

@peak3d
Copy link
Contributor

peak3d commented Sep 7, 2019

VTM Go works fine here, thx @dagwieers . Prevent forwarding is currently not supported by kodi, we can think later about it.

Edit: Fact is also that inputstream.adaptive does not know if a period is advertisment or not. So if someone wants a special logic for adverts, the first step is to provide a logic how to dect it.

@peak3d
Copy link
Contributor

peak3d commented Sep 7, 2019

thx @mediaminister, too, good to have different sources

@matthuisman
Copy link
Contributor

Wow peak3d moves fast:
efa4a86

@mediaminister
Copy link
Contributor

Nice improvement, but when I try to watch VTM Go live tv Kodi crashes with a Floating point exception.

@peak3d
Copy link
Contributor

peak3d commented Sep 8, 2019

@mediaminister pls. make an issue report including kodi log and maybe stack traces

@mediaminister
Copy link
Contributor

mediaminister commented Sep 8, 2019

@peak3d You can find an issue with the logs here: #322

@michaelarnauts
Copy link
Contributor Author

@peak3d thanks for you work! Can you elaborate on how your implementation from a5b1fab works?

  • Do you get one big stream?
  • What happens when the end of the period is reached?
  • What happens when you seek to a timestamp in a different period?

@peak3d
Copy link
Contributor

peak3d commented Sep 9, 2019

  • In Kodi you'll see a timeline with dots, each dot is the start of a new chapter.
  • At the end of a period the next period is played
  • seeking / chapter skip works, but not heavily tested -> you can time-seek over multiple chapters

image

@dagwieers
Copy link
Contributor

@peak3d It appears to work and on VTM GO it tends to start with a commercial (everytime a different one). The subtitles for the show however starts immediately. So somehow the subtitles ought to track the show periods only, and not the commercials to work correctly.

During a period-transition the video stalls for a few seconds, and then the audio goes silent when video restarts, and then after a few seconds everything is fine again. Maybe this is related to #133 (which also still affects me).

I am using the latest master build (1f109197)

@michaelarnauts Normally you can use Up and Down to skip forward and backward through chapters, but this does not appear to work here.

@peak3d
Copy link
Contributor

peak3d commented Sep 9, 2019

@dagwieers I pushed a new commit for VTM Go VOD stream types which should at least make seeking better.

For your idea with external dash library: parsing the files is easy and currently there is no need to care about an external lib. The implementation, in special aligning it to kodi capabilities, takes the most time, this is completely independend from having all data read.

@peak3d
Copy link
Contributor

peak3d commented Sep 9, 2019

@dagwieers chapter skip (up / down) only works if you have kodi installed with the IChapter PR merged

@dagwieers
Copy link
Contributor

I pushed a new commit for VTM Go VOD stream types which should at least make seeking better.

Seeking works correctly now. Also restarting from previous offset now works correctly too. (I hadn't noticed this was broken, but now it is fixed !)

@dagwieers
Copy link
Contributor

@peak3d Oh right 🙄

@mediaminister
Copy link
Contributor

@dagwieers The subtitles are not part of the MPEG-DASH manifest that InputStream Adaptive opens, VTM Go uses separate WEBVTT files and cues for commercials are available in the non-standard json file that contains the MPEG-DASH manifest url. Fixing the subtitle timings should be done in the VTM GO add-on.

@dagwieers
Copy link
Contributor

dagwieers commented Sep 9, 2019

@mediaminister Let's discuss this in a separate ticket. My concern is that it means the VTM GO add-on needs to reimplement a lot of the Period logic in order to fix the offsets. I was hoping there was a better solution for this (i.e. get playback offset from Kodi for non-commercial periods, if that is at all feasible).

@mediaminister
Copy link
Contributor

I'll create an issue in the VTM GO repository.

@peak3d
Copy link
Contributor

peak3d commented Sep 9, 2019

@mediaminister but therew are subs in the manifest. why provide external?

@michaelarnauts
Copy link
Contributor Author

@mediaminister created this issue: https://github.com/michaelarnauts/plugin.video.vtm.go/issues/51

I also remember seeing subtitles in the manifest, but maybe we should continue discussion regarding the subtitles in the above issue.

@matthuisman
Copy link
Contributor

@peak3d
Will multi-period only work with your chapter PR?

Using your latest master build, I can't play past the first period.
It just exits back to menu.

@peak3d
Copy link
Contributor

peak3d commented Sep 9, 2019

@matthuisman they should play as a single stream, pls. make sure that you really have inputstream.adaptive 2.4.0 installed, master version is smaller than current Matrix. And disable auto updates of inputstream.adaptive.

If this doesn't help, provide information pls. log / url / strm / mpd. whatever.

@matthuisman
Copy link
Contributor

Windows 64 Kodi 18.4
Using IA from below:
https://jenkins.kodi.tv/job/peak3d/job/inputstream.adaptive/job/master/110/artifact/cmake/addons/build/zips/inputstream.adaptive+windows-x86_64/inputstream.adaptive-2.4.0.zip

Video shows as 03:32:29 in length (correct)

It stops playback at 00:37:38.
I assume this is the end of the first period as it shows "Stream has ended" card.
It then should move onto post-race interviews etc.

If I then try to resume from that time, it fails to play.
The log has me playing, seeking, and then trying to resume.

Log & MPD attached
Log is pretty big as I left it playing the last minute to catch it ticking over to next period.
I then try to resume

It's behind a paywall and region locked unfortunately so hopefully having a look at the mpd may help. Via their webplayer, it uses same mpd and the same total time and seeking through is ok.

kodi.log.txt
master.mpd.txt

@matthuisman
Copy link
Contributor

matthuisman commented Sep 9, 2019

Oh wait, it appears it is actually the fullstream but the kodi timeline is out.
In kodi, 00:37:38 is actually the same as the end of the actual stream 03:32:29
But if I rewind to start while playing, it starts at the start of the 2nd period..

OK, I see the issue.
I'm sure if I let it play without seeking - it would be fine.

However, if I seek forward any, kodi jumps to the 2nd period and seeks on that.
This 2nd period is only about 37:38 in length. so that is why I'm seeing the correct end of the stream and it's stopping at 37:38.

Appears seek forward or seek back both cause it to jump to 2nd period.

Starts playing at start of period 1
Seek forward 10 seconds, it will start playing 10 seconds in of 2nd period

Start playing at start of period 1
Seek backward, it will start playing at start of 2nd period

This stream does not have commercials.
Period 1 is the main race.
Period 2 is after-race interviews, awards etc.

Attached is a new log.
In this, I start playing the video, and then seek backwards.
Kodi then goes back to 0:00:00 with same duration 03:32:29 but is now playing period 2 from the start.

Once it has skipped to period 2, seeking works correctly (can't get back to period 1 though) and only plays until 37:58

kodi.log.txt

@matthuisman
Copy link
Contributor

matthuisman commented Sep 13, 2019

@peak3d did you see the above?
I also confirmed the same issue with latest master d6091b8

@peak3d
Copy link
Contributor

peak3d commented Sep 24, 2019

@matthuisman I have pushed some changes today (inputstream.adaptive), but all the things will only work well if my avsync PR goes into kodi. Without this PR the chapter change is not working correctly.

@matthuisman
Copy link
Contributor

matthuisman commented Sep 25, 2019

@peak3d
Just tested (windows x64) and now works perfectly

Uses latest commit (b796ea4) build from here
https://jenkins.kodi.tv/blue/organizations/jenkins/peak3d%2Finputstream.adaptive/detail/master/119/artifacts

and latest kodi nightly (KodiSetup-20190924-7a9ced55-master-x64.)
(It wouldn't install in current 18.4 due to dependency error on binary addon)

Can now seek around on 1st and 2nd segment without issue.
And chapters appear to work as well (only quickly tested)
Even though I see your PR (xbmc/xbmc#16658) isn't merged yet.

@piejanssens
Copy link

@matthuisman I have pushed some changes today (inputstream.adaptive), but all the things will only work well if my avsync PR goes into kodi. Without this PR the chapter change is not working correctly.

@peak3d With the avsync PR being reverted, how will this continue?
xbmc/xbmc#16706

@peak3d
Copy link
Contributor

peak3d commented Nov 4, 2019

@piejanssens I'll have to spend more time on it for a different solution.

@michaelarnauts
Copy link
Contributor Author

@peak3d

It seems that the recent commits (I think the one related to seeking), broke seeking with periods. I can't seek beyond a period. When a new period is started, the current time position is that one of the period playing, not of the total.

I've tested this with the vtm go addon.

@peak3d
Copy link
Contributor

peak3d commented Nov 25, 2019

Thank you. And yes, you are completely right. I pushed the fix commit in master branch

@dagwieers
Copy link
Contributor

Since Periods supports is now in the Matrix branch, and soon backported in the Leia branch I would close this issue.

Please open new issues for any problems encountered with the existing implementation. This makes it easier to track in isolation. Thanks everyone! cc @peak3d

@michaelarnauts
Copy link
Contributor Author

I've opened a tracking issue at https://github.com/michaelarnauts/plugin.video.vtm.go/issues/139 to keep track of the avsync issue after playing a short period.

The relevant issue in inputstream.adaptive is #332

I think this issue can indeed be closed since the implemantation of Periods is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants