OpenLiveStream() and m3u8 streams.
#1
pvr.nextpvr uses  XBMC->OpenFile() to read http streams to ts data and it works fine, however when I pass an m3u8 (which is the NextPVR transcoded interface returning HLS application/x-mpegURL files) the stream immediately fails

2020-01-08 15:05:27.593 T:12628   DEBUG: Thread FileCache start, auto delete: false
2020-01-08 15:05:27.593 T:12628    INFO: CFileCache:Tonguerocess - Source read didn't return any data! Hit eof(?)
2020-01-08 15:05:27.644 T:9448   DEBUG: ffmpeg[24E8]: [mpegts] Could not detect TS packet size, defaulting to non-FEC/DVHS

I am assuming this is because it doesn't know how to read m3u8 files.  Are there are parameters that can be passed or appended to the stream to assist. I tried |reconnect=1  etc don't seem to change the parameters.

I did see that pvr.iptvsimple has some logic to help set stream properties https://github.com/kodi-pvr/pvr.iptvsimp...t.cpp#L241  but it not clear what documentation I need to read to use those properties.

Thanks,

Martin
Reply
#2
I believe the issue might be related to the relative links  in the m3u8 file being returned
Code:
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXTINF:3.003000,
../temp/CNN-18544c1ac8d14f5f8ec0359bb2a91a510.ts?sid=8a3195b0a8f749e996ebbe8eeb30abdd
#EXTINF:3.003000,
../temp/CNN-18544c1ac8d14f5f8ec0359bb2a91a511.ts?sid=8a3195b0a8f749e996ebbe8eeb30abdd
#EXTINF:3.003000,
../temp/CNN-18544c1ac8d14f5f8ec0359bb2a91a512.ts?sid=8a3195b0a8f749e996ebbe8eeb30abdd
#EXTINF:3.003000,
../temp/CNN-18544c1ac8d14f5f8ec0359bb2a91a513.ts?sid=8a3195b0a8f749e996ebbe8eeb30abdd

Instead of calling the source base URL as expected (which works via python)

'http://172.16.3.105:8866/temp/CNN-18544c1ac8d14f5f8ec0359bb2a91a510.ts?sid=8a3195b0a8f749e996ebbe8eeb30abdd'

it is calling

2020-01-08 21:09:46.085 T:4852   ERROR: ffmpeg[12F4]: [hls,applehttp] Error when loading first segment 'pvr://channels/tv/temp//CNN-18544c1ac8d14f5f8ec0359bb2a91a510.ts?sid=8a3195b0a8f749e996ebbe8eeb30abdd'

Is there a method I can use to have this function open a ts stream from a relative URL? 

It isn't just the NextPVR m3u8, any m3u8 file that has segments not starting with http seem to have this issue.  If I pass an m3u8 with an absolute reference it works.

Martin
Reply
#3
So comparing with detailed logging  if I hardcode an m3u8 that has  absolute links in OpenLiveStream() it works.   I guess there is no way to pass back the base url to get this too work.
Code:
2020-01-09 10:14:19.583 T:17052   DEBUG: ffmpeg[429C]: Probing hls,applehttp score:100 size:2048
2020-01-09 10:14:19.583 T:17052   DEBUG: ffmpeg[429C]: Format hls,applehttp probed with size=2048 and score=100
2020-01-09 10:14:19.583 T:17052   DEBUG: CDVDDemuxFFmpeg::Open - probing detected format [hls,applehttp]
.....
2020-01-09 10:14:20.171 T:17052   DEBUG: ffmpeg[429C]: [hls,applehttp] new_program: id=0x0000
2020-01-09 10:14:20.171 T:17052   DEBUG: ffmpeg[429C]: [hls,applehttp] HLS request for url 'https://videos-hwcdn.wurl.com/39236121/hls/1200-00086.ts', offset 0, playlist 0
2020-01-09 10:14:20.171 T:17052    INFO: ffmpeg[429C]: [hls,applehttp] Opening 'https://videos-hwcdn.wurl.com/39236121/hls/1200-00086.ts' for reading
2020-01-09 10:14:20.171 T:17052   DEBUG: ffmpeg[429C]: [https] Setting default whitelist 'http,https,tls,rtp,tcp,udp,crypto,httpproxy'
2020-01-09 10:14:20.496 T:17052   DEBUG: ffmpeg[429C]: [https] request: GET /39236121/hls/1200-00086.ts HTTP/1.1
...
2020-01-09 10:14:22.277 T:17052   DEBUG: CDVDDemuxFFmpeg::Open - av_find_stream_info finished
2020-01-09 10:14:22.277 T:17052    INFO: ffmpeg[429C]: Input #0, hls,applehttp, from 'pvr://channels/tv/All channels/pvr.nextpvr_9549.pvr':

2020-01-09 10:08:07.955 T:12256   DEBUG: ffmpeg[2FE0]: Probing hls,applehttp score:100 size:177
2020-01-09 10:08:07.955 T:12256   DEBUG: ffmpeg[2FE0]: Format hls,applehttp probed with size=2048 and score=100
2020-01-09 10:08:07.955 T:12256   DEBUG: CDVDDemuxFFmpeg::Open - probing detected format [hls,applehttp]
2020-01-09 10:08:07.955 T:12256   DEBUG: ffmpeg[2FE0]: [hls,applehttp] new_program: id=0x0000
2020-01-09 10:08:07.955 T:12256   DEBUG: ffmpeg[2FE0]: [hls,applehttp] HLS request for url 'pvr://channels/tv/temp/CNN-552a61dc8a6c43cc8aed1ca541233a0a0.ts?sid=d066d4025f744da298a36021a09404be', offset 0, playlist 0
2020-01-09 10:08:07.955 T:12256   DEBUG: ffmpeg[2FE0]: [hls,applehttp] Failed to open segment 0 of playlist 0
2020-01-09 10:08:16.303 T:12256   DEBUG: ffmpeg[2FE0]: [hls,applehttp] Opening 'pvr://channels/tv/All channels/pvr.nextpvr_9549.pvr' for reading
2020-01-09 10:08:16.303 T:12256   DEBUG: ffmpeg[2FE0]: [hls,applehttp] Failed to reload playlist 0
2020-01-09 10:08:16.303 T:12256   ERROR: ffmpeg[2FE0]: [hls,applehttp] Error when loading first segment 'pvr://channels/tv/temp/CNN-552a61dc8a6c43cc8aed1ca541233a0a0.ts?sid=d066d4025f744da298a36021a09404be'
2020-01-09 10:08:16.303 T:12256   ERROR: CDVDDemuxFFmpeg::Open - Error, could not open file pvr://channels/tv/All channels/pvr.nextpvr_9549.pvr
2020-01-09 10:08:16.304 T:12256   ERROR: CDVDDemuxFFmpeg::Open - error probing input format, pvr://channels/tv/All channels/pvr.nextpvr_9549.pvr

Martin
Reply
#4
I think the only way I can do this is to send the m3u8 in properties similar to pvr.iptvsimple and provide two logic paths.  It is a pain because there is no Close()  method where I can tell the backend to stop transcoding and it looks like the m3u8 file keeps being streamed as I change channels.

Alternate solutions are welcome.

Martin
Reply

Logout Mark Read Team Forum Stats Members Help
OpenLiveStream() and m3u8 streams.0