AndroidHDMI for Channels (ah4c): A virtual channel tuner using HDMI Encoder(s) + streaming stick(s)

Nothing in the Channels DVR log when you try to tune?

Please post the environment variables you're using in the Portainer stack, and a screenshot of your Custom Channels Source settings from CDVR.

Channels log shows this. I was testing in VLC too:

2024/04/12 13:29:14.799496 [ERR] Failed to start stream for ch9496: M3U: Get "http://10.10.10.26:7674/play/tuner/265": dial tcp 10.10.10.26:7674: connect: connection refused
2024/04/12 13:29:14.856762 [HLS] Couldn't generate stream playlist for ch9496-dANY-ip10.10.10.245: M3U: Get "http://10.10.10.26:7674/play/tuner/265": dial tcp 10.10.10.26:7674: connect: connection refused

Environment vairables:

TAG=latest
DOMAIN=localdomain
IPADDRESS=10.10.10.26:7674
NUMBER_TUNERS=1
TUNER1_IP=10.10.10.94:5555
ENCODER1_URL=http://69.69.69.72/8.ts
STREAMER_APP=scripts/osprey/directv
CHANNELSIP=10.10.10.4
ALERT_SMTP_SERVER=smtp.gmail.com:587
ALERT_AUTH_SERVER=smtp.gmail.com
[email protected]
ALERT_EMAIL_PASS=yourgmailapppassword
[email protected]
CREATE_M3US=false
TZ=US/Eastern
HOST_DIR=/data

Custom Channels Source:

Port 7674 here, and then you used 7654 in your Custom Channels settings.

Brilliant, thank you. Stupid mistake by me. I got it working! I would prefer these things to not sleep, because the time it takes for it to boot and tune is a little slow for me. I assume I'll have to edit the scripts, @spammedeeper any reason for sleeping these ospreys in particular? If I can avoid that to increase tuning times, that'd be ideal.

1 Like

The Osprey boxes are always streaming a TV channel by design. I set my Osprey boxes to sleep to stop any background streaming. The wake/play/sleep does add a small delay to turning as the device wakes up, up to about 10 seconds, but I find this acceptable.

If you don't want the sleep to occur, you could modify the script stopbmitune.sh section #Device Sleep. For testing you could start by adding # to line 15-18 to see if it will just skip the sleep.

# $adbTarget shell $sleep
# echo "Sleep initiated for $streamerIP"
# date +%s > $streamerNoPort/stream_stopped
# echo "$streamerNoPort/stream_stopped written with epoch stop time"

The scripts I modified were an attempt to tune as fast as possible with sleep. They are as fast as I could reliably make tuning.

During my testing of tuning speed, I also substituted sleep with kicking in the screens saver on the Osprey box. This worked, and the device stopped streaming video, but would stay awake ready to tune slightly faster. But this created a bunch of extra encoding work on my HDMI capture devices as the screen saver is technically a video stream. I decided sleep was better.

1 Like

I totally agree with this approach. Having multiple boxes streaming 24x7 with no one watching, or no recording happening seems pretty wasteful for some seconds of tuning speed. Plus having your encoder(s) run full tilt, whether there's need or not?

Stupid question, how can I go about editing those if these run in portainer/ docker?

All of the persistent data (scripts, M3Us, etc) is stored on your docker-host, in the directory you specified as HOST_DIR.

EDIT: What OS is running on your host computer?

Thank you, I'll dig into that. I run this docker instance inside an ubuntu 22 VM

@spammedeeper interesting, you can script to go to screen saver? Might be more up my alley

The /data you used for HOST_DIR should be fine then, and you should see these directories under that parent + ah4c (/data/ah4c) on your Ubuntu VM:

Sorry to be a pain. I now have a new issue. ADB commands don't appear to be sent the units now. Might have to start from scratch with one and troubleshoot

What do mean by that? ADB commands from where?

EDIT: There shouldn't be any need to start over...

Like when I tune a channel on Channels DVR, it doesn't tune it on the osprey box. Logs in AH4C show it... but I don't see it. Rebooted everything too.

EDIT: I'm watching it in the channels dvr web player. It will tune channel sometimes, then sleep randomly, then wake then tune another. Very weird, something I screwed up somewhere.

I can't think of a scenario where the ah4c logs would show no errors, but a tuning attempt wouldn't happen. Can you post the ah4c logs, from where a tune begins until it ends?

And what does the Portainer log look like at startup of the ah4c container? Does it show you're connecting to the Osprey box?

1 Like

I missed this before, but there's no way this is the correct address for your encoder. It should be on the same subnet for one thing, and this is not an address in the "private" space.

EDIT: Also, are you sure localdomain is the correct domain name for your LAN? It's correct for me, but it's by no means universal.

1 Like

Sure it is. I do understand your concern with the subnet though, I'll pop it over to my 10.10.10.4 network tonight. It was working fine before I broke something with Portainer.

I will have more time to screw with this tonight when people are not watching too much TV, and will try again :slight_smile:

That is probably the default address from the factory you have to give it an IP in your network.

No, I'm pretty sure that's a public IP address, and as @Edwin_Perez said it's probably just a dummy static address that you're supposed to change:

So, when you're ready to work on this again:

  • Change the IP on your encoder so that it's on your local network. (I'd recommend using DHCP on the encoder with a DHCP reservation on your router.

  • Determine the network domain name of your local LAN. local and localdomain are common, but people also use lan, home and others.

I just wanted to report back that this is working fantastic. Like, super solid. I found typos in my compose file and my environment variables after looking at it with a clear head; this just works now.

Been running 4 channels over a couple of days. Status portal is nice. I'm an egghead and tried initiating screensaver like @spammedeeper kindly pointed out... but was unsuccessful. Is it an ADB command to launch that?

EDIT: And to clarify, everything is on the same subnet now as @bnhf advised :+1: Thank you!!!

2 Likes