Using an HDMI Encoder with ah4c:appletv capturing from an AppleTV running the Cox Contour App

Im using : docker desktop 4.42.1 (196648)

I saw the PSA you linked and got very excited. There is an option to select enable host networking. However, according to CHatGPT, when I asked it

On the docker desktop dashboard under resources\network there is a radio button to "enable host networking". would that work?

ChatGPT replied..


Unfortunately no, not on macOS. Here’s the key reason:

:lock: macOS does not support true host networking in Docker

Even though Docker Desktop for Mac shows a checkbox for “Enable host networking,” it’s only effective on Linux. On macOS, this option is ignored, and host networking is silently disabled due to how Docker runs using a lightweight Linux VM under the hood (via qemu or virtiofs).

So:

  • Checking “Enable host networking” on macOS does not actually enable it.
  • Docker containers still run in a VM with their own private network.
  • This means containers cannot natively access the Mac’s Tailscale network or LAN broadcast services like mDNS.

:white_check_mark: Workaround Options

To work around this on macOS:

  1. Run pyatv from macOS directly (as you’ve done — this works).
  2. Bridge your Docker container to a custom network with specific routing (complicated).
  3. Run Tailscale inside the container, giving it its own tailnet IP (advanced).
  4. Use Tailscale Subnet Router from another LAN device, so Docker can reach .1.x devices like Apple TV indirectly (clean and safe, but needs another node).

Let me know which direction you’d prefer — especially if keeping Docker portable is still a priority.


Im still going to try this anyway, perhaps ChatGPT has developed an ego, and is locked to its opinion.....

:laughing:

@mnwxman132 I'm pretty certain host networking is not required. Though I've never used ah4c:pyatv in production, I did test it a number of times using an AppleTV on my network with standard bridge networking.

If you look at the pairing script @ChannelSam used, and his Docker Compose, you'll see he's not using host networking either:

The command both of us used to pair devices is shown in the script as a comment.

His Docker Compose:

Note that host mode is not in use.

1 Like

@bnhf @ChannelSam

Just wanted to poke in and report back to you both. I have a proof of concept working tuner for the cox contour app with some hardcoded logic up and running end to end with channels.

Some early observations are that

1: Olivetin is freakin awesome. The "find grace note IDs" has already payed huge dividends. Cant thank you enough for all you do @bnhf

2: The manual pairing and tuning using mimicked button keypress works, but is highly dependent on each individual apps like spectrum, or cox, or some others individual UI. With spectrum, it looks like you are using streamlink —edit I meant deep links- @ChannelSam , so the tuning is quick

3: For those go us using

atvremote --storage-filename /root/.android/.pyatv.conf -s 10.10.11.42 up
atvremote --storage-filename /root/.android/.pyatv.conf -s 10.10.11.42 down

type commands the tuning is slow and inefficient, and at times can be limiting if future expansion is needed.

3: Ive already tested a simple python script that can allow alphanumeric entry for tuning to reduce the slow key press wait times. This will allow for future expansion and quicker channel tuning and flipping live.

4: As I integrate this more and fine tune the scripts, it may be possible to make a stable "generalized Apple TV tuning model" for ANY app that is installed. Im jumping ahead of myself, but I could see it happen. It would be a series of Python and ah4c scripts combined. Have to think this through more,

My new shorter term goal is to write stable python bmitune, prebmitune (if needed) and stopbmitune Iiff needed) scripts. that can call the more advanced alphanumeric entries for channel tuning using the cox search bar. This will be my next proof of concept phase. Im currently moving logic blocks around where the more advance calls are made.

Thanks to you both and have a great 4th. I need a break. ChatGPT does have an ego, and a short memory as well.

@mnwxman132

Thanks for the update.
I am not sure if you are aware of some of this or not so I will take a mention it.
The links I am using to "tune" the channels on ATV4k are called deeplinks...This is the same thing that ADBTuner uses to tune channels on android devices if that device supports adb debugging and the particular app supports deeplinks.

What I posted was my beginning script for tuning because I am trying to do some different things that complicate the script for no reason. With a few changes using "Case" in your scripts you can have different commands that could tell bmitune to use a specific tuner for that channel, use specific commands only for some channels. The current ATV version of ah4c doesn't support android adb so you would have to spin those up on a second instance with android support. If you look at the firetv scripts installed automatically you can see an example of using "Case"

If you haven't investigated whether Cox has deeplinks you can use a few things to give you clues.
If you are looking at the Cox app and watching a channel on a computer, phone or tablet does it allow you to "cast it" directly to your tv/appletv/android tv.
Another way to know is if the Cox app intergrates with the ATV main menu, tv providers. If you see menu items at the top showing what is currently on cox tv channels allowing you to click on them AND go directly to that channel THAT is a deeplink.

Where it gets extra complicated is that they may support deeplinks on some devices and not on others. One example of this is Spectrum...It supports deeplinks on ATVs but NOT on Roku devices (Rokus were going to be my original low cost solution to tune spectrum channels). And spectrum is not available at all on Firetv or Android devices (I assume because they can't agree who deserves to get more money from their customers. lol)
Do some searching about deeplinks on the forum where it talks about finding them.

You don't need separate entries for each command in atvremote it supports multiple commands and delays separated by spaces.
Example:

/usr/local/bin/atvremote --storage-filename /root/.android/.pyatv.conf -s $streamerIP up up up delay=2000 left left delay=1000 select

:slightly_smiling_face: Good Luck, Keep us informed.

1 Like

Thanks. I’ll research further. I think I said something about streamlinks in my last post, but I meant deep links.

I spent a lot of time when I first got my linkPi playing with an android firestick and also an onn device. As well as the iPhone cox contour app, and diving into its apk file for deeplinks. Then later also chrome capture. I ran into many many different authorization issues of different manifestations on different approaches and tuner platforms Between NBC affiliates and COX it just made more sense to use the native contour app on the ATV in my case. Very very stable with no authorization hiccups for many months now.

But thanks for the tips. I’ll investigate adding the multiple commands in each case. Perhaps when my head is back in it next week I may poke you again if you don’t mind for and example syntax if I can’t figure it out with ChatGPT. And I’m gonna revisit the deep link search on the ATV the way you suggested.

Thanks for sharing and supporting me and others!!

I’m gonna eventually summarize all my pitfalls that a I ran into in a new preface to this thead, so others can benefit and build their own stuff too. Just need a break for now.

Thank you for paying it forward. Appreciate it. I’ll do the same

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

@ChannelSam I was just adding your scripts/atv/spectrum files to the repo, and I noticed you didn't include prebmitune.sh. Could you post that one too please?

@bnhf I just poked around in my development environment to take a look at my scripts. The docker compose and env are very straight forward based on your templates. I have a bunch of python scripts that are running in my tuner container that are called from bmitune and stopbmitune. I created an alphanumeric tuner, that works on the appletv that could potentially work in other applications that dont support deeplinks. The alphanumeric approach is relatively fast and much more flexible instead of mimicking remote control pad keypresses - depending on the situation. However, right now it is hardcoded strictly for the cox application, and it works as long as the application is in the correct search menu. Thats where an OCR or other watchdog might make sense. And to preserve decent tuning times it may or may not make sense to have this watchdog running all the time in a separate container that can be called by all the various tuners in multiple stacks. I need to take some time to think about this all further.

In the meantime thinking slightly ahead, how would you like me to post these scripts once there a little more cleaned up for others to use?

I could post here on this thread, or post them on GitHub or we could direct message? At the moment, these are not ready for prime time, but very workable here for me - If that makes sense. There would be a mix of shell scripts and python scripts etc

What would you think about PM'ing me the scripts as they are now (which I won't share), so I can see what we're talking about -- and how things might work as far as including them in the container.

To date the scripts have always been in bash, so there may be a few new things to consider on my end.

Ultimately the idea would be to add them to the ah4c repo, just in case anyone wants to build from source.

I don't run any prebmitune.sh code.
It is just a script with no run instructions...

premitune.sh

#!/bin/bash

# Nothing needed in this file!

It needs to be included though; ah4c doesn't work without its scripts, even if they're "no op".

1 Like

If I am understanding this thread correctly, does this setup only support the Cox and Spectrum AppleTV apps? If so, is there any potential to support other apps like the DirecTV app?

@benmarks
This version of ah4c with the appletv tag is just a special version of ah4c that has had python and pyatv installed in the image.

This allows us to control Atv's as our "tuners"
It can "support" any app that is installed on an ATV "tuner". How easy it is to control any particular app would depend on THAT specific app. If it supports deeplinks then you should be able to directly start each channel directly. If it doesn't then you might need to send a series of directional/select commands instead.

Specifically for Directv, You might find it makes alot more sense to use an android dongle or directv android box and the regular version of ADBTuner or ah4c instead.

I see, ok thanks. I currently have ah4c + Osprey box, but the Osprey is the only non-Apple device in my environment, so I was hoping there might be a viable ah4c + AppleTV option. But, I don't have the skillset to modify what's outlined in this thread for another app.

@benmarks

I think I have read somewhere that nothing tunes as fast as the ospreys since they are basically running the directv app constantly...

If you decide you want to try with an ATV we can do some experiments with one of the AppleTVs you already have without setting anything up in channels just to test deeplinks/tuning. I would be happy to help walk you through it...

Basically we would install/run a new container using bnhf/ah4c:appletv image.

then we would use the "Exec Console" in the new ah4c docker container to "register" your test ATV so we can manually send commands using "pyatv/atvremote" to see what commands we need to use for launching/closing directv links on ATVs.

You should be able to do all this without intergrating anything into Cdvr or even using an encoder as long as you can see the hdmi output on the ATV.
Just tag me with @ChannelSam so I see it if you decide to try. :slightly_smiling_face: