HDMI for Channels

I am very excited and interested in this; also a Spectrum user. I have some reading to do to figure this out. Does this currently require Home Assistant? Studying that as well. Thanks!

Yes, I use Home Assistant to control the ATV. If you don't have an HA instance up and running, you might look at https://pyatv.dev. An enterprising person familiar with python could probably fully replicate ADBTuner using that library. But since I already have HA running, seemed logical for me to go that way for now.

It has been a fun project, and the results are fantastic. I now have a three tuner setup giving me everything that the Spectrum streaming app has to offer in terms of content; all through CDVR.

1 Like

Yes, on my linux box that has a GTX-3060/Meanwell. It's currently offline due to adb funkiness.

I'm guessing there may also be a way to turn on/off captions at the source...for an enterprising person.

I'm not understanding a few things. What is the -H Authorization for in the script? Also, is this bmitune.sh used for each of your 3 tuners, 0 through 2, with each tuner IP? I'm also planning on setting this up with the Magewell Pro Capture card I snagged off ebay and I have the environment sample for that from github /sullrich/ah4c. Just trying to see how it all fits together and will dive in to try and make it work over the next few weeks. Just not fully clear on the process. I guess I need to learn docker and also set up Home Assitant. Also, is hdmi-for-channels docker only? I'm sure I'll work through it all, just fighting the learning curve a little. Would be cool to see your full setup with 3 tuners. I have no issues with setting up the M3U, that all makes sense.

I'm currently running CDVR on Ubuntu and have a separate Windows box dedicated to CC4C. CC4C is running fine, but looking for a little better video and audio quality. With that, video panning motion is not fully fluid and the audio has a very reduced volume.

1 Like

ah4c is not Docker only. I'm the container maintainer, and have done substantial scripting for using the project with DirecTV and Amazon Live TV.

Normally, I'd recommend using the Docker version, but in this case that may not be the ideal approach. @KompilerDJ (who wrote the Go code taking this project from its roots to what it is now), is the only one I know of using the Magewell card.

He runs the project natively, so it's possible a thing or two he's done for Magewell will have to be adapted to Docker. I'm happy to do it, but I use an external capture box -- so there's no way for me to test anything internal card related.

ffmpeg is required I believe for Magewell, and I already have that in the container. @KompilerDJ can, I'm sure, shed light on what else may be needed if you want to use Docker.

1 Like

Right, sorry if I was unclear. I'd prefer not to use docker, since I will have to use ffmpeg, and want to use Intel Quick Sync for the encoding to mpeg (no discreet GPU). I already have Quick Sync setup and working for transcoding to watch outside my network. Using docker would complicate things in this case to pass through the hardware accelerator. Not interested in that, want to run natively, but thanks.

What I'm not clear on is how to fully modify the scripts to use ATV and Spectrum. @chasut showed what was used for bmitune.sh, but not sure what else I may need to modify...prebmitune, stopbmitune, anything else? I'm not a coder.

By the way, here is some good info on Intel QuickSync transcoding for anyone who is interested: ([Guide] Hardware Transcoding: The JDM way! QuickSync and NVENC - #2 by JDM_WAAAT - [LGA1151,LGA1200] NAS Killer 6.0, Plex QSV Builds - serverbuilds.net Forums)

Seems like you're clear on what's needed for your somewhat unique combination of hardware and streaming service -- which is good. :slight_smile:

For anyone looking at this in the future, ffmpeg processing of the stream coming from the encoder, before it reaches Channels, is normally not required.

ah4c typically just handles the virtual tuner selection and the tuning itself. The stream is passed through to the DVR as-is. ah4c is usually just a proxy, and requires nothing special hardware-wise.

1 Like

The -H Authorization line is the Home Assistant long lived Bearer Token created for access.

The whole thing is just a external CURL to a Home Assistant Service called media_player.play_media

Yes there is a set of these scripts for each "Tuner", in my case Tuner0 through Tuner2.

As for pre-bmitune, it is a call to the HA service media_player.turn_on. It is not really needed because my ATVs do not go to sleep, but just following the pattern provided.

#!/bin/bash

#Turn On ATV
curl \
  -H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"entity_id": "media_player.tuner0"}' \
  http://xx.xx.xx.xx:8123/api/services/media_player/turn_on 

The stopbmitune is a little different. It uses the remote control entity that is set up in HA for the Media Player to execute the "Home" button on the ATV.

#!/bin/bash


#Stop Video
curl \
  -H "Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"entity_id": "remote.tuner0", "command": "home"}' \
  http://xx.xx.xx.xx:8123/api/services/remote/send_command 

I run this on the same machine as CDVR without docker.

Awesome, thank you!!

  • Is the xx.xx.xx.xx:8123 just the IP and port for each tuner?
  • Is there other code somewhere I'm not aware of that I need to modify to make this work?

Thanks again

  1. That is the ip address of Home Assistant, the target of the CURL.
  2. The only other necessary modification is to the go program AH4C to specify the information for each encoder.
var (
	tunerLock sync.Mutex

	tuners = []tuner{
		{
			url:   "http://xx.xx.xx.xx/0.ts",
			pre:   "/[path]/prebmitune0.sh",
			start: "/[path]/bmitune0.sh",
			stop:  "/[path]/stopbmitune0.sh",
		},
		{
			url:   "http://xx.xx.xx.xx/0.ts",
			pre:   "/[path]/prebmitune1.sh",
			start: "/[path]/bmitune1.sh",
			stop:  "/[path]/stopbmitune1.sh",
		},
		{
			url:   "http://xx.xx.xx.xx/live/stream0",
			pre:   "/[path]/prebmitune2.sh",
			start: "/[path]/bmitune2.sh",
			stop:  "/[path]/stopbmitune2.sh",
		},
	}
)

@arwrite This looks to me to be a snippet from the original androidhdmi-for-channels project. You’ll need to use the sullrich/ah4c fork to get the Magewell support you’re after.

1 Like

I am not familiar with Docker but as long you can get /dev/videoX passing into the Docker container it should work great with ffmpeg.

1 Like

Any luck trying to do it by phone - > HDMI out?

I could try it with my laptop usb c dock that has an HDMI out from my pixel, but I don't have an encoder to connect it to channels. I guess it would let me see if I could output from an adroid phone instead of an android tv device.

I'm using TVE login to access TV through a cable providers app. The app doesn't let me access content on android tv devices outside of the home network, but it lets me access it on phone outside of the home network. I'm trying to set up something that will require as little interaction with the home network, because the home network is a condo that is occupied seasonally.

Edit: Dock doesn't seem compatable with using the HDMI out on the phone.

The LinkPi ENC5 V2 got here today. It's been running for about 30 minutes, nothing super new to report until I build my multi-tuner LinkPILE over the holiday. But it's fun to see this:

2 Likes

I concur on the black levels. I may try tinkering to see if i can improve.

Let me know if you find anything. Good luck.

I tried this several months ago but gave up. Then saw @turtletank created a Docker program and thought I’d give it another shot. Worked great! However, I have one issue…

I’m using a Firestick with Hulu and if I have some inactivity I get a Hulu error message that they are having trouble loading the content. If it use the remote to relstart the app, everything works great and I can switch channels, etc. but as soon as there’s inactivity, same message.

On the program everything’s green, including ADB. I can’t preview a program either on the program until I reload the app.

I have disabled sleep on the device and everything else I can think of. Any help would be appreciated.

I think I figured it out. There’s an “ambient display” feature that was interrupting things. I disabled that and it appears to be working now. Not that familiar with Firestick… so there you go.

NBC's been working great until the last couple of weeks, now it fails to launch on the onn once every few tries. My bmitune script checks to see if it's running after launch with the shell pidof command and it returns a pid, but the app is not actually running onscreen. So all you get in the recording is the onn home screen. Rebooting the onn did not fix the issue so now my recordings are unreliable.

I'm wondering if this is a new bug in the NBC app because I've also seen it crash a few times not long after a launch. This all started recently, anyone else see it?