kodi-pvr / pvr.iptvsimple

IPTV Simple client for Kodi PVR
GNU General Public License v2.0
784 stars 373 forks source link

Enable timeshift buffer for DASH/Smooth played through addons using Inputstream Adaptive #628

Open rgainza opened 2 years ago

rgainza commented 2 years ago

It is normal for most DASH/Smooth live channels to have timeshift already in place in the stream which will be played correctly through the addon you can create for Kodi using Inputstream Adaptive.

But if you use IPTV Simple to play the addon URL it will only be able to play the stream live and you won't be able to seek. If you try to seek in the live stream it will end up at the start of the initial timeshift buffer which obviously differs from stream to stream. Is there a way to fix this? I might have the wrong settings though? Looking through the README, there is barely anything regarding the cooperation between IPTV Simple and Inputstream Adaptive.

For information: Catchup works pretty good, but I'm kinda annoyed that the catchup option has to input the $end tag if you want to catchup to the the latest program that is on. The end tag won't be input to the future end of the program creating problems. It can be worked around through the addon where if time-end = ? you can remove it to still let Inputstream Adaptive play the stream live. And to make it play it from the start you use x.setProperty('inputstream.adaptive.play_timeshift_buffer', 'true'). You might need a special routing path for this.

phunkyfish commented 2 years ago

@glennguy for awareness.

So catchup is supported in two different modes. The first is using VOD where it pretty much jumps to a video file and you navigate within that space. The other is timeshifted catchup where you get a virtual days long buffer but that uses inputstream.ffmpegdirect.

The query strings used are up to your provider. Whether or not they they use end variable for the live stream is dictated by the M3U entry. Do you have an example of one that is problematic?

Note that if the dash stream supports a large buffer you really shouldn’t need catchup enabled all. The feature exists because many provider only support URL based catchup and not the buffer built into the stream.

rgainza commented 2 years ago

@glennguy for awareness.

So catchup is supported in two different modes. The first is using VOD where it pretty much jumps to a video file and you navigate within that space. The other is timeshifted catchup where you get a virtual days long buffer but that uses inputstream.ffmpegdirect.

The query strings used are up to your provider. Whether or not they they use end variable for the live stream is dictated by the M3U entry. Do you have an example of one that is problematic?

Note that if the dash stream supports a large buffer you really shouldn’t need catchup enabled all. The feature exists because many provider only support URL based catchup and not the buffer built into the stream.

Thanks for being active and the quick reply!

I did this for Viaplay (Swedish region) and an own plugin where I handle the request for the channels. In their streams they use a time tag in greenwich time start-end. But you can actually just remove the end tag to make it a live stream and the start tag will then generate a mpd with that much "timeshift" from the start tag. It might be difficult for me to setup for you to test if that's what you meant? I could try if you're willing to look into it.

The m3u looked like this

EXTM3U tvg-shift=0

EXTINF:-1 tvg-id="TV3" tvg-name="TV3" tvg-logo="" tvg-chno="1" catchup-source="plugin://plugin.video.example/?video=/play/channelId290?t=${start}-${end}" catchup-days="3" group-title="TV",TV3

plugin://plugin.video.example/?video=/play/channelId

(I know I can just use append, just experimenting with this atm)

So if the program has been aired completely => start-end, otherwise => start. I handled this manually in the plugin that if the end tag from IPTV Simple was less then 15 seconds it would only send start tag to the Viaplay mpd, but in my opinion IPTV Simple shouldn't send the end tag (time now) if you choose to play the latest program. Since if I hadn't done anything it stops playing right when it reaches the end tag. It's okay for me to handle this manually though, it was just an input!

I like the catchup option a lot thou since I can just scroll to a program that was aired more easily? It's okay for me that it plays like a VOD. I'm just kind annoyed that the timeshift doesn't work like it does when I open it in inside the plugin instead of through IPTV Simple.

Titukis commented 3 weeks ago

@rgainza hey, is it possible to do this without any plugins?

phunkyfish commented 3 weeks ago

I assume you are using inputstream.adaptive to play your DASH streams?

If adaptive supported the itimes interface then it would be possible to implement a similar timeshift capability to what we use in ffmpegdirect. That would be cool. But thats a feature require for adaptive to begin with.