Closed MattRCole closed 1 year ago
Why not copy what the existing YouTube add-on does?
Good question! I've looked into the youtube addon's code and they mainly deal with dash
which piped
doesn't (usually) have.
I could try converting between hls
and dash
manifests. I don't know if that's feasible or even possible, but it could be the easiest way forward.
Assuming that sticking with hls
is the way to go (which again, I'm new to streaming things so it might not be), the youtube addon uses the inputstream.adaptive
plugin which, when using hls
, only supports multi-bitrate playlists.
I did look into using inputstream.adaptive
at first, but had no luck. I don't have the logs, but I never got the segmented playlists to run.
I was able to get this to work by downloading all of the necessary m3u8
files, and modifying the master playlist
's uri
s to pointing to the locally downloaded files.
Brief example:
For the example, I saved the master playlist
to /tmp/my-addon/index.m3u8
, before saving the file I used the m3u8
addon to modify it to only include the video playlist of the stream we want to play with its corresponding audio
playlist. I also updated the uri
s of both of those properties to point to the locally downloaded video/audio
m3u8
files.
I downloaded the audio/video m3u8
files and saved in the same directory under the names video-index.m3u8
and audio-index.m3u8
(I also updated the uri
s to be absolute uri
s)
After all of that, I went from the m3u8
files I posted earlier to these:
New /tmp/my-addon/index.m3u8
file:
#EXTM3U
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-MEDIA:URI="audio-index.m3u8",TYPE=AUDIO,GROUP-ID="234",NAME="Default",DEFAULT=YES,AUTOSELECT=YES
#EXT-X-STREAM-INF:CLOSED-CAPTIONS=NONE,BANDWIDTH=4565100,RESOLUTION=1920x1080,FRAME-RATE=60,CODECS="avc1.64002A,mp4a.40.2",AUDIO="234"
video-index.m3u8
abbreviated example of the /tmp/my-addon/[audio|video]-index.m3u8
file with absolute uri
s:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:7
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:6.6,
https://pipedproxy-xxx.kavin.rocks/videoplayback/really-long-uri/seg.ts
#EXTINF:5.8,
https://pipedproxy-xxx.kavin.rocks/videoplayback/really-long-uri/seg.ts
#EXTINF:4.966666,
https://pipedproxy-xxx.kavin.rocks/videoplayback/really-long-uri/seg.ts
#EXTINF:5.166666,
https://pipedproxy-xxx.kavin.rocks/videoplayback/really-long-uri/seg.ts
then I was able to use the config I included at the beginning of this issue with one slight change:
list_item = xbmcgui.ListItem(
path="/tmp/my-addon/index.m3u8"
)
I got the idea to download the m3u8
files after I tried to use ffplay
to play the stream, passing in the url
to the master playlist
, and it took about 10 minutes for ffmpeg
to download all of the stream playlists before it started playing the video.
I then tried downloading all of the playlist files (like I described above) and used them with ffplay
and the video started in less than 10 seconds.
After seeing that, I figured something similar might be happening with the ffmpegdirect
plugin.
I haven't tried this out, but maybe just changing inputstream.ffmpegdirect.open_mode
to curl
would solve this issue as well. I thought of this right before posting this update.
I'm closing this issue, but will update this comment with any relevant updates.
Hi! I'm trying to write an addon that uses piped's hls setup. My main goal is just to have some given quality of video stream (like pick a stream and stick with it) with its accompanying audio, and have video playback be seek-able.
Piped gives back a "master” playlist. Here are some example
m3u8
files frompiped
with the URI's shortened.master playlist index.m3u8
shortened video index.m3u8 linked from master playlist
and the link to the audio
index.m3u8
looks exactly the same as the video one, just with different urismy setup
This setup results in the following logs in kodi:
Any help with this would be amazing.
Am I using this plugin as intended? Should I be using a different plugin? I'm new to kodi addon development, so if I'm missing some context, I apologize and would love some help with pointers.
edit: update terminology and post name to be more specific