Emulating an HDHR source?

I am testing an HDHomeRun emulation on an Nvidia Jetson Nano. Everything I want to do is working fine with VLC so I got ready to add source to Channels.

In case it helps, I have network channels I want to encode (H264) and I can do it super fast on the Nano GPU. I can preserve AC3 and strip all the other streams I don't want.

But for a reason I haven't determined, Channels App goes to HDHomeRun IP when tuning instead of Nano IP.

Here's the guide returned from HDHomeRun:

{
  "GuideNumber": "5.1",
  "GuideName": "WPTV-TV",
  "VideoCodec": "MPEG2",
  "AudioCodec": "AC3",
  "HD": 1,
  "Favorite": 1,
  "URL": "http://10.0.1.89:5004/auto/v5.1"
}

And here's what the Nano returns to Channels for same:

{
    "GuideNumber": "5.1",
    "GuideName": "WPTV-TV",
    "VideoCodec": "H264",
    "AudioCodec": "AC3",
    "HD": 1,
    "Favorite": 1,
    "URL": "http://10.0.1.101:5004/auto/v5.1"
  }

As you can see the URL and VideoCodec are changed. What am I missing? I tried changing channel numbers so they were unique but then guide fails. (The DeviceID's and FriendlyName are different.)

Tl;DR: Even though channels gets a new URL for the source, it still goes to the HDHR URL when tuning.

Emulating HDHR will not work.

I would recommend you use the Custom Channels interface and export an m3u

FYI - I removed the source and restarted. My fake HDHomeRun no longer shows in channels/admin/settings but I noticed I keep getting requests for /discover.json from channels so channels is still looking for it.

You should be able to add the emulated tuner by IP while disabling the originalHDHR(you could block UDP packets from that IP). The discovery is a little bit more complex than what you are tackling here. Part of it are broadcasts which you are still seeing on the emulator.

I successfully "emulated" a remote HDHR by allowing access by its private IP. I needed to open not only TCP ports 80 and 5004 but also TCP/UDP 65001 in order to get signal strength.

  • The clients ignore the the port specified in lineup.json and always use 5004
  • A lot of time went through trying to convince DVR to forget the public IP of the HDHR and use only the private address
  • Deleting a source is almost impossible.

Responding in case others get here. I thought emulation would be best and homerun api is simple to emulate. However, it seems channels has a special relationship with homerun and as tmm1 succinctly stated "Emulating HDHR will not work" so I abandoned that approach.

Instead I used the custom interface as recommended. It's done and working great and actually took very little code in the end.

Basically I change guide channel numbers so there'll be no confusion in channels such as HomeRun 5.1 becomes custom 510. When I get a request from channels to stream 510, I do the following:

  1. Set up ffmpeg using the homerun stream as input and encoding with the Nvidia h264_nvmpi or hvec_nvmpi encoders and output into a pipe. This can easily be done in real-time.
  2. The external ffmpeg process is managed with a twisted protocol class that keeps sending request.write(data) to channels dvr.

It's basically one file with a few device classes tying it together with asynchronous deferreds. Simple http protocol.

Now I can watch/record outside the home with high-quality streams at a significantly lower bandwidth with a lot of transcoding options.

You could also run channels dvr on the nano and let it transcode. Or feed into another dvr with m3u.