(OLD) Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Kodi Community Development

Moderator: TVJunkie198

Locked
djp952
Posts: 1339
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD USA
x 20

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by djp952 »

I'd like to invite anyone watching this thread that is using Kodi 17.x on Mac OSX to try a test version of the PVR client for that platform. It's not on the GitHub site yet, I'm still working on the details (I've had a Mac for a grand total of 24 hours now and have never used one before)

https://github.com/djp952/pvr.hdhomerun ... 7.6559.zip
edit: link changed; OneDrive link died

In theory it should work for 64-bit Intel-based OSX versions from 10.7 (Lion) through 10.13 (High Sierra), but I've only tried it on High Sierra.

I have a couple hopefully non-consequential things to work out with it, and it was all built and packaged by hand -- I have many handwritten notes to transcribe :mrgreen: It does appear to work, though, and since I know nothing about OSX I could really use the help with testing it out.

Let me know - especially interested if it works with older versions of OSX.
Last edited by djp952 on Sun Dec 17, 2017 1:30 pm, edited 1 time in total.

jasonl
Expert
Posts: 15445
Joined: Sun Oct 28, 2007 9:23 pm
x 31

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by jasonl »

The link appears to be bad, just gives "Sorry, an error has occurred."

djp952
Posts: 1339
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD USA
x 20

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by djp952 »

jasonl wrote: Sun Dec 17, 2017 12:48 pm The link appears to be bad, just gives "Sorry, an error has occurred."
Yeah, something is awry with OneDrive today (and Microsoft wonders why consumers are leaving in droves? LOL). Here is an alternate link from a comment at GitHub, hopefully more stable!

https://github.com/djp952/pvr.hdhomerun ... 7.6559.zip

ddejager
Posts: 131
Joined: Tue May 06, 2014 2:26 pm
Location: Glen Arbor, MI

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by ddejager »

I'm using PVR client version 1.2.7 on the latest version OSMC (stretch) on a Raspberry Pi. Works well in general (the bug relating to a sad face on corrupted videos that play find on the HDHomeRun add-on is still not fixed :-( ), but every now that then the guide data fails to update and the guide is entirely blank. I never turn off the Raspberry Pi, only the TV that is connected to it. When the guide data is blank, I'm still shown the next scheduled recording and I can see the guide data via the HDHomeRun add-on. If I restart OSMC, the guide data successfully loads.
1) Any idea why this is?
2) Is there a way to force guide update without restarting OSMC?

djp952
Posts: 1339
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD USA
x 20

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by djp952 »

ddejager wrote: Sun Dec 17, 2017 5:12 pm I'm using PVR client version 1.2.7 on the latest version OSMC (stretch) on a Raspberry Pi. Works well in general (the bug relating to a sad face on corrupted videos that play find on the HDHomeRun add-on is still not fixed :-( ), but every now that then the guide data fails to update and the guide is entirely blank. I never turn off the Raspberry Pi, only the TV that is connected to it. When the guide data is blank, I'm still shown the next scheduled recording and I can see the guide data via the HDHomeRun add-on. If I restart OSMC, the guide data successfully loads.
1) Any idea why this is?
2) Is there a way to force guide update without restarting OSMC?
The answer to this riddle is probably in the Kodi logs. If the client can't retrieve the guide data for some reason Kodi won't ask it again under some circumstances until a restart. You can force the refresh by doing a 'clear data' on the Guide settings, but otherwise that's the only way I am aware of to get Kodi to reload it all.

In the past there was a problem when SD blocked access to guide data from the past (if I recall, it was a bug that it worked at all it wasn't supposed to do that) that caused this condition too. Kodi asked for guide data and the client said "no gots any" due to the error, so Kodi didn't ask anymore. I'm guessing something similar is in play here, an error or bug getting the data caused it to abort.

Unfortunately, there is a bug I didn't fix by 1.2.7 where an HTTP error during some operations won't be logged fully, but if there was something that went wrong we should still see a non-descript general "SQL Error" in the logs, along with the function(s) that failed. We can guess from there.

ddejager
Posts: 131
Joined: Tue May 06, 2014 2:26 pm
Location: Glen Arbor, MI

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by ddejager »

@djp952: I've uploaded the kodi logs here: https://paste.osmc.tv/ciduhixase
The old log is probably the one you want to look at. It was working for a while and then yesterday when I looked the guide data was gone. I rebooted and it came back (in the current log).

I don't see a smoking gun in the log. Does this help you figure out what is going on with the guide data disappearing?

sfb103
Posts: 9
Joined: Sat Sep 17, 2011 11:18 pm

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by sfb103 »

I apologize in advance if this is a dup. I search a bit for it thru the forum, and didn't see it addressed. Also deserves stating once again, that your add-on is great and appreciate all your efforts.

Pretty much everything works great... just one thing... I have the "Allow passthrough" enabled in the "Audio and Subtitles" settings in the Kodi player. However when I stream Live TV from the RECORD engine through the PVR client (i.e. timeshifting is enabled and working), my receiver registers the audio output as "Stereo". If I go into the PVR client and tick the "Stream Live TV channels directly from tuner device(s)" option (i.e. timeshifitng is disabled), then my receiver registers the audio output as "Dolby Digital 5.1".

My first suspect is the RECORD engine. However one other data point that leads me to believe maybe there's something that can be done in the PVR client... If I inspect the "Audio Stream" info in the "Audio and Subtitles" settings menu and correlate that to what comes thru on the receiver, here's the results:
1) Recorded TV (streamed from RECORD engine) - "English AC3 5.1"- plays as DD 5.1
2) Live TV (streamed from RECORD engine, timeshifting works) - "English AC3" - plays as stereo
3) Live TV (streamed from tuners directly, no timeshifting) - "English AC3" - plays as DD 5.1

The last one is interesting. Even though it doesn't say 5.1 in the audio info, it still plays that way. Could the RECORD engine simply be marking the audio stream incorrectly and that throws off the PVR client wrt 5.1?

Setup specifics:
I'm running v1.2.7 of the PVR client in Kodi 17 on a NUC (NUC7i5BNK) with Windows 10, Fall creators update (1709) and the HDMI output goes to a Marantz SR7011 receiver. I have the latest RECORD engine (hdhomerun_record_linux_20171118beta1) running simply on a Ubuntu 16.04 PC on the network and the tuner is HDHomeRun PRIME (HDHR3-CC, FW: 20170930).

Any thoughts?

djp952
Posts: 1339
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD USA
x 20

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by djp952 »

ddejager wrote: Mon Dec 18, 2017 9:11 am @djp952: I've uploaded the kodi logs here: https://paste.osmc.tv/ciduhixase
The old log is probably the one you want to look at. It was working for a while and then yesterday when I looked the guide data was gone. I rebooted and it came back (in the current log).

I don't see a smoking gun in the log. Does this help you figure out what is going on with the guide data disappearing?
I agree, nothing stands out here, just one transient error getting the lineup from one tuner (timed out).

One thing I can do is start logging the requests for guide data as they happen. It will be a bit on the chatty side, probably make it an option in the Advanced settings. There probably isn't much reason to log all the discovery events by default either, I can quiet those down too using the same option.

Easy enough to do, I'll get something in the next version. At worst we might be able to tell if Kodi is still asking for the data or not.

djp952
Posts: 1339
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD USA
x 20

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by djp952 »

sfb103 wrote: Mon Dec 18, 2017 10:08 am I apologize in advance if this is a dup. I search a bit for it thru the forum, and didn't see it addressed. Also deserves stating once again, that your add-on is great and appreciate all your efforts.

Pretty much everything works great... just one thing... I have the "Allow passthrough" enabled in the "Audio and Subtitles" settings in the Kodi player. However when I stream Live TV from the RECORD engine through the PVR client (i.e. timeshifting is enabled and working), my receiver registers the audio output as "Stereo". If I go into the PVR client and tick the "Stream Live TV channels directly from tuner device(s)" option (i.e. timeshifitng is disabled), then my receiver registers the audio output as "Dolby Digital 5.1".

My first suspect is the RECORD engine. However one other data point that leads me to believe maybe there's something that can be done in the PVR client... If I inspect the "Audio Stream" info in the "Audio and Subtitles" settings menu and correlate that to what comes thru on the receiver, here's the results:
1) Recorded TV (streamed from RECORD engine) - "English AC3 5.1"- plays as DD 5.1
2) Live TV (streamed from RECORD engine, timeshifting works) - "English AC3" - plays as stereo
3) Live TV (streamed from tuners directly, no timeshifting) - "English AC3" - plays as DD 5.1

The last one is interesting. Even though it doesn't say 5.1 in the audio info, it still plays that way. Could the RECORD engine simply be marking the audio stream incorrectly and that throws off the PVR client wrt 5.1?

Setup specifics:
I'm running v1.2.7 of the PVR client in Kodi 17 on a NUC (NUC7i5BNK) with Windows 10, Fall creators update (1709) and the HDMI output goes to a Marantz SR7011 receiver. I have the latest RECORD engine (hdhomerun_record_linux_20171118beta1) running simply on a Ubuntu 16.04 PC on the network and the tuner is HDHomeRun PRIME (HDHR3-CC, FW: 20170930).

Any thoughts?
Thanks! I'm also leaning towards the RECORD engine on this one, mainly because this PVR client doesn't do any demuxing/decoding on it's own. Other than a quick inspection of the stream to remove some known problem-causing commercial break indicators, which is rare, I don't do anything to the data streams themselves. Kodi asks for specific raw positions in the data stream, and I ask the RECORD engine to start/restart at that position. From there, it's just a hand-off of the raw HTTP data.

I do know the streams from the RECORD engine are slightly different upon inspection. For example, that commercial break indicator problem we found would only occur via the RECORD engine streams, the streams from the tuners were fine (from the perspective of Kodi, the real defect there is in the ffmpeg decoder, not try to blame silicondust :)) There is some extra metadata at the start of a RECORD engine stream as well, but that should be ignored by the decoder completely and not cause any concerns/differences.

Do you have access to VLC? One thing you might be able to do to eliminate the PVR from the loop is to use VLC to stream from both the RECORD engine and the tuner(s) to see if it has the same concerns with the audio. You can get the URLs to use in VLC relatively easily:

  • From a browser, go to http://ipv4-api.hdhomerun.com/discover
  • Capture the BaseURL values for one tuner (has a "DevuceID") and the RECORD engine (has a "StorageID")
  • From VLC, go to Media/Open Network Stream...
  • Paste in the BaseURL to test, and append "/auto/vNNN" to it where NNN is the virtual channel number
  • The Tools/Media Information and Tools/Codec Information may be helpful
For example, for me to watch channel 511 from my RECORD engine, I opened:

Code: Select all

http://192.168.0.220:55127/auto/v511

If this doesn't help expose the difference(s), we can also use a tool like cURL to just save off the streams using those same BaseURLs and try to play them as regular Videos in Kodi, also bypassing the PVR client completely.

My guess is that the RECORD engine streams are perfectly fine, but have something slightly different that's exposing some limitation or glitch in Kodi and/or the ffmpeg decoder.

sfb103
Posts: 9
Joined: Sat Sep 17, 2011 11:18 pm

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by sfb103 »

Sounds good. I'll try the VLC test and report back. I also thought I might try the SD HDHomeRun Windows DVR App and see what the results are. Haven't played with that much, so not sure what to expect. VLC seems like probably a better test.

One last thought... is there any chance that when streaming live from the RECORD engine (so timeshifting is enabled) that the PVR client is simply not honoring the "Allow passthrough" flag? Though it would appear to be in the case where "Stream Live TV channels directly from tuner device(s)" is enabled? Probably not the case, but thought I'd ask.

djp952
Posts: 1339
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD USA
x 20

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by djp952 »

sfb103 wrote: Mon Dec 18, 2017 11:57 am Sounds good. I'll try the VLC test and report back. I also thought I might try the SD HDHomeRun Windows DVR App and see what the results are. Haven't played with that much, so not sure what to expect. VLC seems like probably a better test.

One last thought... is there any chance that when streaming live from the RECORD engine (so timeshifting is enabled) that the PVR client is simply not honoring the "Allow passthrough" flag? Though it would appear to be in the case where "Stream Live TV channels directly from tuner device(s)" is enabled? Probably not the case, but thought I'd ask.
Unfortunately, the PVR client is never asked any questions like that by Kodi. You wouldn't know by the 50 or so releases so far (lol), but at it's core the PVR client is just a go-between piece of software that connects Kodi up with the backend services. The real value of the PVR client is to massage all the metadata (recordings, guide data, etc) from the backend into the common format Kodi wants and deliver it when asked. When it comes to streaming/decoding itself, I've only seen one PVR (the mythtv one) that handled any decoding on it's own, and for Leia they've removed that too.

If not for one small SNAFU with how Kodi handles seeking on streams that didn't work with the RECORD engine, I would probably just generate the URLs and hand them off to Kodi and not deal with the streams either :) Kodi does literally all of the heavy lifting, it's quite amazing how much infrastructure it provides.

sfb103
Posts: 9
Joined: Sat Sep 17, 2011 11:18 pm

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by sfb103 »

Right, makes sense. Another thought (VLC results will be coming later, promise)...
I do know the streams from the RECORD engine are slightly different upon inspection. For example, that commercial break indicator problem we found would only occur via the RECORD engine streams, the streams from the tuners were fine (from the perspective of Kodi, the real defect there is in the ffmpeg decoder, not try to blame silicondust :)) There is some extra metadata at the start of a RECORD engine stream as well, but that should be ignored by the decoder completely and not cause any concerns/differences.
Do you know of any differences between how the RECORD engine streams "Live" vs "Recorded" data? Because remember with these results...
1) Recorded TV (streamed from RECORD engine) - "English AC3 5.1"- plays as DD 5.1
2) Live TV (streamed from RECORD engine, timeshifting works) - "English AC3" - plays as stereo
3) Live TV (streamed from tuners directly, no timeshifting) - "English AC3" - plays as DD 5.1
...means the RECORD engine is at least doing something right (wrt ffmpeg, etc.) for #1, but not for #2. So not a difference between RECORD and tuners, but a difference in streams just from the RECORD engine itself. Would it treat these two differently? Have you seen any other indicators of this? Maybe the recorded content is playing back a raw capture from the tuners where the live streaming is something else. wonder why it would do those differently.

djp952
Posts: 1339
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD USA
x 20

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by djp952 »

sfb103 wrote: Mon Dec 18, 2017 3:04 pm Right, makes sense. Another thought (VLC results will be coming later, promise)...
I do know the streams from the RECORD engine are slightly different upon inspection. For example, that commercial break indicator problem we found would only occur via the RECORD engine streams, the streams from the tuners were fine (from the perspective of Kodi, the real defect there is in the ffmpeg decoder, not try to blame silicondust :)) There is some extra metadata at the start of a RECORD engine stream as well, but that should be ignored by the decoder completely and not cause any concerns/differences.
Do you know of any differences between how the RECORD engine streams "Live" vs "Recorded" data? Because remember with these results...
1) Recorded TV (streamed from RECORD engine) - "English AC3 5.1"- plays as DD 5.1
2) Live TV (streamed from RECORD engine, timeshifting works) - "English AC3" - plays as stereo
3) Live TV (streamed from tuners directly, no timeshifting) - "English AC3" - plays as DD 5.1
...means the RECORD engine is at least doing something right (wrt ffmpeg, etc.) for #1, but not for #2. So not a difference between RECORD and tuners, but a difference in streams just from the RECORD engine itself. Would it treat these two differently? Have you seen any other indicators of this? Maybe the recorded content is playing back a raw capture from the tuners where the live streaming is something else. wonder why it would do those differently.
The only difference I am aware of is that a fully recorded stream has a known length and can be end-seeked. I suppose there could be some differences in the stream data but I agree it wouldn't make any sense for them to be different at that level.

One hint may be that MPEG-TS is pretty difficult to seek, we can see that with the inherent trouble Kodi has with it sometimes. Kodi's implementation tends to 'thrash' around a bit trying to be precise; you wanted +0:30, you're gonna get +0:30, but how it gets there is interesting. It makes an educated guess as to where to go, reads enough data to figure out where it actually got to, and then tries again if it's not right. No joke I've seen it take upwards of 15 seeks to just satisfy a +0:30 request. If there aren't a lot of valid timestamps in the stream I think that makes it worse. SiliconDust's app does a much better job with seeking IMO, but it also isn't trying serve an infinite number of masters like Kodi.

In the end, I really don't know for sure, it's all speculation. If I had to venture a more solid guess after thinking about it more, I'd say it's most likely that it has trouble "locking onto" that 5.1 stream when it's live since it can't jump forward to get/check something, and it gives up and uses the best one it could get.

I saw this timeout when figuring out the commercial break thing, what ultimately went wrong there is that ffmpeg was ignoring these packets due to this indicator being present, but when that packet also had more important data (the PMT) in it, ffmpeg never found the PMT and ultimately timed out, leaving Kodi in a state where it thought it was playing video but no video stream was ever detected. It could be reasonable to guess that a similar thing may be happening here, if it can't get what it wants for the 5.1 soon enough it gives up?

Again, all speculation. Blathering out loud, really :)

There are a LOT of annoying little things we could fix here by handling the decoding/demuxing in the PVR client, but I've shied away from that because I think it would take me forever to get right, and it's quite a bit pretentious to think I could somehow do better than what Team Kodi has done :) I think the number of permutations and variables involved with limited access to test streams would make that a losing proposition ...

djp952
Posts: 1339
Joined: Wed Oct 01, 2008 8:46 pm
Device ID: 131EB7F7;131ED0E0
Location: Elkridge, MD USA
x 20

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by djp952 »

No sooner do you blather on for 10 minutes and you think of something else.

There IS something the PVR controls that could be affecting the audio stream choice! There is a "realtime" flag that is under my control. I have this return TRUE if the stream is live, it prevents Kodi from buffering when you start it up. When the stream is recorded this returns FALSE. It's a decently smart implementation that works even when a stream has switched from live to recorded (fixed a lot of weirdness with viewing in-progress recordings), too.

New thought: I tell Kodi it's realtime because the length is unknown. Kodi decides not to read ahead since it's impossible (have you ever seen "Spaceballs"? That scene). Kodi doesn't have enough data to pick the 5.1 audio stream. When it's recorded, the length is known so it can skip ahead all it wants, and gets enough data to pick the 5.1 stream.

Doesn't explain why tuner-direct works, but tuner-direct does produce different streams that don't trip Kodi up as often, which we've seen.

OK, so here is something I can do to try. Let me know what you think. I can build you a one-off package that always returns FALSE for realtime. I guarantee you'll hate the buffering, but if it fixes the audio selection for you we have something tangible to present to Team Kodi for their input. What platform are you running on again? This would be a Private Message link, certainly not for general consumption :)

sfb103
Posts: 9
Joined: Sat Sep 17, 2011 11:18 pm

Re: Unofficial Kodi PVR Client for HDHomeRun DVR subscribers

Post by sfb103 »

Sounds perfect. Blathering sometimes helps me think too :) I'm very happy to be the guinea pig. Running on Windows 10 Pro x64 with all the latest updates (Fall Creator's, 1709, etc.). The HW is the 7th gen NUC (NUC7i5BNK). Kodi is 17, PVR client is v1.2.7.

Thanks! Agreed that even if the buffering is problematic, at least it would give us some thoughts on where to look next.

Locked