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

fyi at least on the osprey's you may have a stack of adb authorizations build up in the background (usually you can see them by pressing menu) but in your current state they may be there, but not showing. they need power cycled. then when their up, start/restart ah4c/adbtuner and make sure the current saved key is authorized.

This did it, thank you!!

1 Like

Which "this" did it? Are you now running ah4c or ADBTuner?

I’m on ADBTuner and so far it’s working perfectly

1 Like

@bnhf
Looking to move from Channel Numbers to deeplinks on my Osprey's in ah4c. I utilized Olive Tin Action to gather the m3u deeplinks data (P1C is great). Below are my current compose and environmental variables. What changes do I need to facilitate?

I have already made a backup of my channel number m3u's in case I need to revert.

version: '3.9'
services:
  # 2024.10.30
  # GitHub home for this project with setup instructions: https://github.com/sullrich/ah4c
  # Docker Hub home for this project: https://hub.docker.com/repository/docker/bnhf/ah4c
  ah4c:
    image: bnhf/ah4c:${TAG}
    container_name: ah4c
    hostname: ah4c
    dns_search: ${DOMAIN} # Specify the name of your LAN's domain, usually local or localdomain
    ports:
      - ${ADBS_PORT}:5037 # Port used by adb-server
      - ${HOST_PORT}:7654 # Port used by this ah4c proxy
      - ${WSCR_PORT}:8000 # Port used by ws-scrcpy
    environment:
      - IPADDRESS=${IPADDRESS} # Hostname or IP address of this ah4c extension to be used in M3U file (also add port number if not in M3U)
      - NUMBER_TUNERS=${NUMBER_TUNERS} # Number of tuners you'd like defined 1, 2, 3, 4, 5, 6, 7, 8 or 9 supported
      - TUNER1_IP=${TUNER1_IP} # Streaming device #1 with adb port in the form hostname:port or ip:port
      - TUNER2_IP=${TUNER2_IP} # Streaming device #2 with adb port in the form hostname:port or ip:port
      - TUNER3_IP=${TUNER3_IP} # Streaming device #3 with adb port in the form hostname:port or ip:port
      - TUNER4_IP=${TUNER4_IP} # Streaming device #4 with adb port in the form hostname:port or ip:port
      - TUNER5_IP=${TUNER5_IP} # Streaming device #5 with adb port in the form hostname:port or ip:port
      - TUNER6_IP=${TUNER6_IP} # Streaming device #6 with adb port in the form hostname:port or ip:port
      - TUNER7_IP=${TUNER7_IP} # Streaming device #7 with adb port in the form hostname:port or ip:port
      - TUNER8_IP=${TUNER8_IP} # Streaming device #8 with adb port in the form hostname:port or ip:port
      - TUNER9_IP=${TUNER9_IP} # Streaming device #9 with adb port in the form hostname:port or ip:port
      - ENCODER1_URL=${ENCODER1_URL} # Full URL for tuner #1 in the form http://hostname/stream or http://ip/stream
      - ENCODER2_URL=${ENCODER2_URL} # Full URL for tuner #2 in the form http://hostname/stream or http://ip/stream
      - ENCODER3_URL=${ENCODER3_URL} # Full URL for tuner #3 in the form http://hostname/stream or http://ip/stream
      - ENCODER4_URL=${ENCODER4_URL} # Full URL for tuner #4 in the form http://hostname/stream or http://ip/stream
      - ENCODER5_URL=${ENCODER5_URL} # Full URL for tuner #5 in the form http://hostname/stream or http://ip/stream
      - ENCODER6_URL=${ENCODER6_URL} # Full URL for tuner #6 in the form http://hostname/stream or http://ip/stream
      - ENCODER7_URL=${ENCODER7_URL} # Full URL for tuner #7 in the form http://hostname/stream or http://ip/stream
      - ENCODER8_URL=${ENCODER8_URL} # Full URL for tuner #8 in the form http://hostname/stream or http://ip/stream
      - ENCODER9_URL=${ENCODER9_URL} # Full URL for tuner #9 in the form http://hostname/stream or http://ip/stream
      - STREAMER_APP=${STREAMER_APP} # Streaming device name and streaming app you're using in the form scripts/streamer/app (use lowercase with slashes between as shown)
      - CHANNELSIP=${CHANNELSIP} # Hostname or IP address of the Channels DVR server itself
      - ALERT_SMTP_SERVER=${ALERT_SMTP_SERVER} # The domainname:port of the SMTP server you'll be using like smtp.gmail.com:587. This is for sending ah4c alerts if tuning fails.
      - ALERT_AUTH_SERVER=${ALERT_AUTH_SERVER} # The auth server for the e-mail you'll be using like smtp.gmail.com
      - ALERT_EMAIL_FROM=${ALERT_EMAIL_FROM} # The e-mail address you'd like your ah4c failure alert e-mails to show as being from.
      - ALERT_EMAIL_PASS=${ALERT_EMAIL_PASS} # Gmail and Yahoo both support the creation of app-specific e-mail passwords, and this is the way to go! It's NOT recommended to use your everyday e-mail password.
      - ALERT_EMAIL_TO=${ALERT_EMAIL_TO} # The e-mail address you'd like your alert e-mails sent to.
      #- ALERT_WEBHOOK_URL=""
      - LIVETV_ATTEMPTS=${LIVETV_ATTEMPTS} # For FireTV Live Guide tuning only, set maximum number of attempts at finding the desired channel
      - CREATE_M3US=${CREATE_M3US} # Set to true to create device-specific M3Us for use with Amazon Prime Premium channels -- requires a FireTV device
      - UPDATE_SCRIPTS=${UPDATE_SCRIPTS} # Set to true if you'd like the sample scripts and STREAMER_APP scripts updated whether they exist or not
      - UPDATE_M3US=${UPDATE_M3US} # Set to true if you'd like the sample m3us updated whether they exist or not
      - TZ=${TZ} # Your local timezone in Linux "tz" format
      - SPEED_MODE=${SPEED_MODE} # Set to false if you'd like the target streaming app to be closed after each tuning cycle (limited script support).
      - KEEP_WATCHING=${KEEP_WATCHING} # In supported scripts, set the delay before resending a tuning deeplink to prevent "Are you still watching?" type messages. Examples: Use 4h for 4 hours or 240m for 240 minutes.
    volumes:
      - ${HOST_DIR}/ah4c/scripts:/opt/scripts # pre/stop/bmitune.sh scripts will be stored in this bound host directory under streamer/app
      - ${HOST_DIR}/ah4c/m3u:/opt/m3u # m3u files will be stored here and hosted at http://<hostname or ip>:7654/m3u for use in Channels DVR - Custom Channels settings
      - ${HOST_DIR}/ah4c/adb:/root/.android # Persistent data directory for adb keys
    restart: unless-stopped
**strong text**
TAG=latest
DOMAIN=local
ADBS_PORT=5037
HOST_PORT=7654
WSCR_PORT=7655
IPADDRESS=10.0.1.65:7654
NUMBER_TUNERS=3
TUNER1_IP=10.0.1.76:5555
ENCODER1_URL=http://10.0.1.34:8090/stream0
TUNER2_IP=10.0.1.29:5555
ENCODER2_URL=http://10.0.1.34:8090/stream1
TUNER3_IP=10.0.1.77:5555
ENCODER3_URL=http://10.0.1.34:8090/stream2
TUNER4_IP=
ENCODER4_URL=
TUNER5_IP=
ENCODER5_URL=
STREAMER_APP=scripts/osprey/directv
CHANNELSIP=10.0.1.65
ALERT_SMTP_SERVER=
ALERT_AUTH_SERVER=
ALERT_EMAIL_FROM=
ALERT_EMAIL_PASS=
ALERT_EMAIL_TO=
UPDATE_SCRIPTS=true
UPDATE_M3US=false
TZ=US/CENTRAL
SPEED_MODE=false
KEEP_WATCHING=4h
HOST_DIR=/volume1/data

scripts/osprey/dtvospreydeeplinks

Which m3u file is this using? Want to make sure I put my info in the correct file.

that isn't an m3u file. that's the script location.
update the script location, drop your new m3u in the bind mount m3u folder, name it whatever.m3u and point channels at it.

1 Like

Got it figured out. I added dtvospreydeeplinks.m3u to the m3u folder and changed the CDR source to the new m3u file and all is working right now.

1 Like

So you need to also update the .env file.
STREAMER_APP=scripts/osprey/dtvospreydeeplinks

2 Likes

Did that first from your earlier post. Added my m3u file but had forgot to change the CDR source url so it sent me to wrong stations. Once I changed that, everything was good. My tuning is now about 8-9 secs versus 11-13 secs with the channel numbers.

My biggest issue was getting the m3u data from Chrome. DTV would lock me out every time I tried to log on thru Chrome and make me reset password. I finally used Chrome to reset (vs my normal browser) and was able to grab the data. One thing that I did notice is that you can use the old password when resetting which I thought odd.

1 Like

I find it odd that companies feel the need to keep a record of the old password. (my bank keeps last 10)
alot has changed in the ~30yrs of cybersecurity, but the #1 rule has never changed, and they are finally realizing it again. the most secure password is the one you remember.

1 Like

I mean this is the company that has you use email and SMS for 2FA and doesn't support TOTP or really passkeys or anything. Security-wise, it's a data breach waiting to happen.

1 Like

A post was merged into an existing topic: ADBTuner: A "channel tuning" application for networked Google TV / Android TV devices

It seems like DirecTV pushed an update that broke tuning, at least for me from sleep. Cold tunes from sleep just would not work. They'd freeze. I don't know if it's a bug or a permanent change, but based on the APK analysis I had Claude do, it seems like it might be an intentional change to the way they negotiate HDMI on the Osprey boxes.

What resolved it was adding a sleep 2 to prebmitune.sh.

main() {
  adbConnect
  adbWake
  sleep 3
}

if anyone else sees this behavior, let me know and I can open a PR for this one line change. @bnhf please let me know if this is a good candidate for a pull request or if you wanna just update the script at some point. This was actually pretty reproducible for me on the latest Osprey update that seems to just get pushed down at random by DirecTV and just adding the sleep seemed to fix it, although I'm not sure if sleep 2 is long enough. A longer interval might be better, but I also wanted to prioritize fast tuning, so I was kind of pushing it a little bit close to the edge. I think with the initialization that ah4c has to do, sleep 2 should be enough though, from what I can tell.

Edit: I changed the ordering of the sleep command and it's working a little bit better now.
Edit 1: this is tested with osprey/dtvospreydeeplinks but I'm not sure if it affects channel # tuning as well.

Edit: seems sleep 3 is more reliable so far.

Finally okay claude made something more intelligent, ensure the box is awake and alive (streaming) before firing a tune. That way it always tunes.

main() {
  adbConnect
  adbWake
  $adbTarget shell 'for i in $(seq 1 80); do dumpsys audio 2>/dev/null | grep -E "pack: com.att.tv.openvideo.*gain: GAIN " >/dev/null && break; dumpsys media_session 2>/dev/null | grep "PlaybackState {state=3" >/dev/null && break; sleep 0.1; done'
}

Using standard android frameworks (two of them whichever fires first) to detect rediness.

1 Like

I have the C71KW-400 60164.
Is there a way, a trick, using tvquickactions etc to make the channel up/down work within the Favorites collection??
Using the box or the app, this is my main question.

Other thoughts.
DEAL KILLERS for me that make it rarely used:
. Channel up/down toggle ONLY goes thru the ALL collection, or page up/down in the Guide
. Directv stream is one of the most expensive providers but has crap software,
. they have a Channel up/down toggle but it can't do Favs Channel up/down,
. you can't even rearrange your Favorites, its Alpha or Numeric, that's it.
. You can't create your own multiview as in YoutubeTV, at least they offer a group of pre-made multi-views

It seems like you're asking about using this Osprey model without ah4c, or CDVR for that matter? Am I misunderstanding your questions/thoughts? I'm pretty sure everything you're listing as deal killers, are easily handled when this box is used with an encoder, ah4c (or ADBTuner) and CDVR.

1 Like

You are correct sir, and thanks for the reply.
I'm just trying to figure if there is a way, on this Directv box, do Ch Up/Down for only the Favorites "Collection" since this thread has some Directv box experts perhaps.
.

So I have the Osprey stuff narrowed down.
My PR has been merged into main, which is great. This should be purely defensive for those on the 5/22 update, and those who get the 6/10 update shouldn't have any interruption as long as you get the new script.

From what I can tell based on the analysis that I've been doing for the last several days is they are checking authentication when the box wakes from sleep. So you really need to pull for video and audio prior to trying to fire a deep link, else the box wedges. So immediately once the box has detected that it's up and running, we fire the deep link. That's how I got around it.

On one hand, this is good news. That means they're updating Osprey boxes still, and hopefully they have a long life ahead. On the other hand, this is annoying that they're doing this and it's making it harder to tune them. When I get a chance, I will try to work on a config for ADB tuner users as well.

Ok has anyone with recent channels updates been seeing deeplinks randomly re-fire on their own. I've been hitting some weird edge case where I'm viewing normally and randomly the channel will re-tune.

I am currently running a test to see if it's maybe related to something upstream in Channels but I'm curious if anyone else has run into this?

I have a potential future PR here: GitHub - mackid1993/ah4c at fix/skip-same-channel-retune · GitHub

It's just super weird and happens pretty randomly but usually towards the start of a stream. I thought it was a DTV issue but started firing deeplinks manually over adb and it wasn't happening then as far as I could tell.