![]() |
|
SageTV Github Development Discussion related to SageTV Open Source Development. Use this forum for development topics about the Open Source versions of SageTV, hosted on Github. |
![]() |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
||||
|
||||
Native HDHomeRun Prime Support
I was wondering if anyone is working on this for either Windows or Linux. If not I am willing to try and put some effort into it, but I am not sure where to even start. On windows it appears that the first issue happens very early on in the DirectShow discovery of the device. I am sure even after that is resolved there would still be a ton of additional issues to sory out.
Are there different options to support the HDHomeRun Prime that might be more cross platform than suing DirectShow? Should libhdhomerun be utilized on both Windows and Linux? Would there be some benefit to using it over Direct Show? |
#2
|
||||
|
||||
I think going forward most of these type of support should be in the form of a network encoder, NOT natively built into the core. This will future proof things far better. Of course, I really different tasks being segregated completely. I think that currently, PrimeNetEncoder is still relying on some windows .exe's, but I think all the features that are required are in the web interface of the HDHomeRun, including streaming the video, which ffmpeg could pull in. this would allow full cross platform capability, and not depend on any drivers or software being installed on a given device.
In all honesty, I am hoping to approach silicon dust about actually building network encoder support directly into the HDHomeRun firmware, which would be quite awesome... This can't be done until there is an extension made to the network encoder profile to enable streaming from an encoder to the server and having the write that stream to disk itself. With the current network encoder profiles, it will require the encoder (the HDHomeRun in this case) to have write access to network share, and I'm thinking that would be far more complication than it'd be worth.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer) unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers. Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA. Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S Other Clients: Mi Box in Master Bedroom, HD-200 in kids room |
#3
|
||||
|
||||
Quote:
__________________
Jeffrey Kardatzke Founder of SageTV |
#4
|
||||
|
||||
Ahh, yeah, I had seen the UploadID, but didn't dig too deep into it, as it looked like it was tied deeply into the core network encoder/client connection. I'll have to do some reading.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer) unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers. Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA. Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S Other Clients: Mi Box in Master Bedroom, HD-200 in kids room |
#5
|
||||
|
||||
When I read "native" support, I was thinking about the ability to play the stream directly in Sage, which is currently hit or miss (the "dump" method as SageDCT calls it, the networkencoder doesn't offer this option). If Sage was capable of rendering the direct stream, wouldn't that be a good precursor to whatever the tuner solution may be?
|
#6
|
|||
|
|||
Fuzzy if we would do network capture with the built network encoder would we not be just capturing the native stream like SageDCT. If so would we not be also caring over the same problems with comcast where sagetv would not play them sometimes. I know we can update the SageTV Clients with the newest mplayer builds but if I have been reading the forums correctly we won't be able to correct them in the extenders since they can not be upgraded them to the newest mplayer, correct.
|
#7
|
||||
|
||||
Before I knew about the above mentioned uploadID network encoder PUSH method, I had intended the future STREAM network encoder command to leverage ffmpeg as the stream sink on the server, which would result in fixing streams on the way to the HDD. I can't test the 'broken' streams that comcast sends out, as I don't have comcast. I had used dump for a few years with Charter and not experienced much of a problem - I now use ffmpeg, but mostly as a result of switching to PrimeNetEncoder instead of SageDCT.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer) unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers. Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA. Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S Other Clients: Mi Box in Master Bedroom, HD-200 in kids room |
#8
|
||||
|
||||
One downside to the network encoders is I think they still do not support the "gapless" playback of live tv (you get a pause/glitch when the program you are watching is scheduled to end that lasts for a couple of seconds). Sage v7 added a fix for the pause with native recording sources, but not for network tuners.
__________________
Server: Ryzen 2400G with integrated graphics, ASRock X470 Taichi Motherboard, HDMI output to Vizio 1080p LCD, Win10-64Bit (Professional), 16GB RAM Capture Devices (7 tuners): Colossus (x1), HDHR Prime (x2),USBUIRT (multi-zone) Source: Comcast/Xfinity X1 Cable Primary Client: Server Other Clients: (1) HD200, (1) HD300 Retired Equipment: MediaMVP, PVR150 (x2), PVR150MCE, HDHR, HVR-2250, HD-PVR |
#9
|
||||
|
||||
Quote:
__________________
Buy Fuzzy a beer! (Fuzzy likes beer) unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers. Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA. Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S Other Clients: Mi Box in Master Bedroom, HD-200 in kids room |
#10
|
|||
|
|||
Quote:
I don't have a PRIME, but if you would test the server on a linux (ubuntu 14.04 would be best) and describe what is not working, I may help. You would need to compile the HDHomeRun2.0 as debug, edit the HDHomeRun2.0 Makefile and add a line "DEBUG=1" on the top and make a clean.sh and buildall.sh afterwards. With debugging enabled on the SageTV server (setting in Sage.properties or via placeshifter) you will get the sagetv_0.txt logfile which will support identifying issues. Be aware that there is still the blocker of recording video streams on 64bit, all the rest seems now pretty OK. I don't think the libhdhomerun is used on Windows, but I didn't spend too much time. I recall windows is mainly using the BDA driver installed through the Windows HDHomeRun software. All my changes here refer to the native plain libhdhomerun usage, NOT to the dvbhdhomerun kernel module usage!
__________________
Standard Intel PC with 4GB RAM Ubuntu 16.04 64bit JVM version=1.8.0_121-b13 / SageTV V9 latest HDHR DUAL EU with 2 DVB-C and HDHR EXPAND 4DC with 4 DVB-C XMLTV using WebGrabPlus in Switzerland Clients: HD200, Placeshift on OSX (limited) and Windows, Sage Android Client on ShieldTV and Tablets |
#11
|
||||
|
||||
Quote:
![]() Ideally we should probably extend the protocol to query the network encoder itself for this capability, as that would be easier to setup (of course if its setup using network encoder discovery, then it can control the config that way).
__________________
Jeffrey Kardatzke Founder of SageTV |
#12
|
||||
|
||||
Quote:
Would you mind explaining a little bit how to use the UploadID with the MediaServer. I assume the NetworkEncoder client gets both the filename and uploadID from the server. It can then either place the file directly to the path itself, or use the MediaServer to upload the file. Besides not needing direct access to the storage path and possibility of gapless playback, is there other benefits to using this methodology. Would this enable quicker start of playback? As mentioned by Fuzzy I am using FFMPEG to clean up the stream. I am not exactly sure what is wrong with the "pure" stream from comcast, but it can causes pixelation, audio pops, and sometime no video playback. For some reason when the stream is put through FFMPEG with no conversion it is able to fix the stream in such a way that Sage has no problems with it. Should/Could this type of stream fix be moved to SageTV? I think if this was fixed by Sage it might speedup the time it takes for Live TV playback to start. Thanks, Josh |
#13
|
||||
|
||||
The UploadID isn't required for the gapless playback. All that is required is ensuring the streams are uninterrupted between files, meaning the transition happens at the right frame in the stream, and that the encoder is configured in sage as supporting this. What it essentially does, I believe, is since sage 'knows' it is the same stream simply continuing i a new file, it doesn't tear-down and recreate the playback graph.
The UploadID is a different thing, and yes, allows the encoder to push the stream to the server. I've been messing with it off and on the last couple days. Essentially, the encoder receives the uploadID with the START request, and then can EITHER write directly to the file, or open up a channel to the MediaServer port (8171). It requests permission to stream to the file via WRITEOPEN filename UploadID\r\n. If sage recognizes the uploadID, it allows it, and awaits "WRITE offset length\r\nDATA". It seems to work on the server end for me, I'm having issues on my encoder end getting the data cleanly from ffmpeg. I am using Perl, trying to make my encoder as light as possible, and capturing the piped output from ffmpeg. PERL doesn't seem to have the umpf to do this without dropping data, so the stream gets corrupted. Going to have to move to a compiled c program for the streaming, most likely. In any case, avoiding samba share issues will be worth it if I can get this implementation to work.
__________________
Buy Fuzzy a beer! (Fuzzy likes beer) unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers. Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA. Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S Other Clients: Mi Box in Master Bedroom, HD-200 in kids room |
#14
|
||||
|
||||
Quote:
![]() Regarding stream repair...SageTV has extensive code for doing this already. It's what's been always used with any of the Digital TV systems we support. It actually remuxes the transport stream into a program stream and then writes that out. There is a facility in sage.media.format.MPEGParser for doing the remuxing from a Java level...but I don't know if that specific path of code still works because we stopped using that awhile ago. At the native layer though, it definitely works. Ideally, we would add this to the MediaServer so that you can send in the MPEG2-TS that way (along with some config parameters for setting up certain aspects of the remux) so that it'll do it as it's receiving the data before it writes it to the file. This would then provide this general remuxing service to any network encoder easily. You may want to give the remuxing code in MPEGParser a shot and see if it works...it's pretty easy to use, and if it works...then that's a huge step forward regarding this. ![]()
__________________
Jeffrey Kardatzke Founder of SageTV |
#15
|
||||
|
||||
Thanks Jeff and Fuzzy. This is great info. I am going to try and implement all of it. I agree that if we could pull all of those things off it would be pretty good implementation. I also would like to add tuner locking support as well. I would like to add all the other features first though.
Josh |
#16
|
|||
|
|||
One thing that would be nice to support is being able to do is "gang" tuners if what is scheduled to record is in separate programs of the same physical QAM channel. I know Cox cable here in OKC has some of the local networks that way. I know it's also a feature that the DVB crowd has requested in the past.
__________________
Server: i5 8400, ASUS Prime H370M-Plus/CSM, 16GB RAM, 15TB drive array + 500GB cache, 2 HDHR's, SageTV 9, unRAID 6.6.3 Client 1: HD300 (latest FW), HDMI to an Insignia 65" 1080p LCD and optical SPDIF to a Sony Receiver Client 2: HD200 (latest FW), HDMI to an Insignia NS-LCD42HD-09 1080p LCD |
#17
|
||||
|
||||
Quote:
__________________
Buy Fuzzy a beer! (Fuzzy likes beer) unRAID Server: i7-6700, 32GB RAM, Dual 128GB SSD cache and 13TB pool, with SageTVv9, openDCT, Logitech Media Server and Plex Media Server each in Dockers. Sources: HRHR Prime with Charter CableCard. HDHR-US for OTA. Primary Client: HD-300 through XBoxOne in Living Room, Samsung HLT-6189S Other Clients: Mi Box in Master Bedroom, HD-200 in kids room |
#18
|
||||
|
||||
I have made some pretty good progress. Here is how I am currently recording to Sage.
hdhomerun_config.exe (UDP) -> ffmpeg (STDOUT) -> SageTV MediaServer (TCP). This is working pretty well. I also made some tweaks to ffmpeg. I am setting analyzeduration and probesize. Channel changes are now taking ~3-4 seconds instead of ~6 seconds. I also have discovery working properly. I even have discovery working correctly when PrimeNetEncoder is started as a runnable class from Sage. Now I am looking to see if I can utilize the MPEGParser class to remux the file instead of ffmpeg. I have a few questions on how to use the class that I am hoping you guys might be able to help me with. 1. Is this library available in Windows environments? What file is this library compiled into. 2. What is the mode variable. I am assuming it is either REMUX_TS or REMUX_PS. Is that the input or output format? 3. What is the channel variable? I see in remuxFile it is set to 0. 4. Here is what I think the usage would look like. openRemux(REMUX_TS, 0, outputStream), pushInitData for first 8192 bytes, muxy.seek(0), pushData starting a position 0 till the end of stream, muxy.close(). |
#19
|
||||
|
||||
Quote:
2. I'd think it would be output format...it should autodetect input format. 3. It's likely for multiple program transport streams; 0 would mean use the 'primary' one (whatever that would be defined as). 4. Yeah, looks right....the remuxFile method in there is what'd I'd use as my guide to try it out (and looks like you already were thinking that).
__________________
Jeffrey Kardatzke Founder of SageTV |
#20
|
||||
|
||||
Thanks Jeff,
I will write a test program and load it as a runable in Sage to make sure the library is loading in Windows. I was having a hard time tracing everything that was going on in the C/C++ code, so I was not sure if/when the calls were available. Do you have any interest or opposition if I were to attempt to add functionallity to sage to allow for tuner locking? I was thinking of adding a get/set method to CaptureDevice that would default to return not locked. I know that the sage core would need to be modified to check to see if the tuner is locked prior to utilizing the tuner for live or recorded tv. Quote:
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Question about HDHomeRun (Not Prime) | TechBill | Hardware Support | 27 | 06-13-2017 08:24 AM |
Does SageTV 7 support HDHomerun Prime? | LabyrinthMike | Hardware Support | 14 | 02-18-2015 04:32 PM |
HDHomeRun Prime on Woot 5/24 | ranger | The SageTV Community | 6 | 05-25-2012 07:10 PM |
HDHomerun Prime? | cenwesi | Hardware Support | 26 | 04-19-2011 05:40 PM |
HDHomeRun 68 channel remap limit / Native QAM tuning? | taylork | Hardware Support | 40 | 07-11-2008 04:50 AM |