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

I believe there is a variable UPDATE_ M3Us that you can set to false.

By design. If you don't want your scripts and/or M3Us updated you need to set their env vars accordingly. For example, these values would prevent either from ever being updated:

UPDATE_SCRIPTS=false
UPDATE_M3US=false

Be sure to read through the comments in the ah4c docker compose, so that you're familiar with what each variable does.

That is what I thought...Thanks!

Yeah, I thought so, just wanted to make sure. I set it to False...Appreciate the answer to a bad question...

Anybody else using the Ospreys seeing DTV ads all of a sudden? I've been getting a screen advertising other DTV subscription channels - with a "Press OK to dismiss".

It eventually closes after about 10 seconds, but the problem is it prevents tuning to the requested channel and records the last channel that was used. It's getting more frequent in the past 2 days...

Is there an easy way to detect text in a video stream so that I can send ADB commands to get the NBC banner to go away? Every once in awhile the NBC app likes to throw up a stupid ad banner at stream start that never disappears, so all I need to do is look for the text "Not now" and if it appears just simply do a down and then enter to make it go away.

The ah4c container includes tesseract now, for just that purpose. Here's an example of a function using it, where a video frame is captured, and then searched for occurrences of any of these three words Guide\|WHAT'S\|SPORTS:

tuneCheck() {
  local sleepBeforeTuneCheck=$1

  sleep $sleepBeforeTuneCheck
  ffmpeg -i $encoderURL -frames:v 1 -y $streamerNoPort/screencapture.jpg -loglevel quiet
  tesseract $streamerNoPort/screencapture.jpg $streamerNoPort/screencapture
  grep -q "Guide\|WHAT'S\|SPORTS" $streamerNoPort/screencapture.txt

  if [ $? == 0 ]; then
    echo "Deeplink tuning appears to have failed. Killing app and re-tuning..."
    $adbTarget shell am force-stop $packageName
    tuneChannel
  else
    echo "Deeplink tuning appears to have been successful!"
  fi
}

In this example, I'm killing the app and re-tuning if the app appears to be "stuck" on the landing page. However, you could send whatever ADB commands you like instead.

Thanks! Yeah I figured you had that in, did some googling on my own and here's the windows commands to check for this in NBC app.

ffmpeg -i %ENCODER_URL% -v 0 -frames:v 1 out.png
"c:\Program Files (x86)\Tesseract-OCR\tesseract" out.png out
find /I "Maybe" out.txt >nul
if not errorlevel 1 (
        adb -s %IP% shell input keyevent KEYCODE_DPAD_DOWN
        ping -n 2 localhost >nul
        adb -s %IP% shell input keyevent KEYCODE_DPAD_CENTER
        ping -n 2 localhost >nul
      )
)
del out.png out.txt

Have no idea whether this will work because the ad banner is random, will have to wait and see but I tested this out and it works with other random text. For some reason ffmpeg takes about 6 seconds to run this on my PC, any way to speed this up? Doesn't really matter I guess because my monitor script runs in background after video is started by bmitune.

Update: did work this morning for an Olympics ad overlay, text to look for was 'Maybe later'.

Finally spent some time figuring why I couldn’t get this to work. Made a print of all my settings then deleted everything. Recreated container using Synology container manager using all my previous settings. Watched the stick thru the pass-thru on the encoder and acted on the ADB prompt (probably my issue all along).

It seems to take a long time to tune (1-1/2 minutes) but that's probably just my setup. I hope that quickens up when I move from my test server.

One issue I did find is that when I attempt to tune to "E", it brings up both "A&E" and "E" channels, then it selects the A&E channel. Is there a way to make it search for the channel number rather than the channel number?

So, my next steps will be:

  1. Set up container on main DVR
  2. Set up Olive Tin using Portainer on test DVR.
  3. Get some new sticks and a multi-port encoder

Synology DSM 7
Directv Stream
Firestick 4K
Uray Single port Encoder

1 Like

With remote control emulation, reliability has been emphasized over speed, but that does slow things down. With my previous setup, it was more on the order of 30 seconds as I recall. You'll probably want to switch to a FireStick 4K Max 2, to speed things up.

Not sure if you've been following this thread, but deeplinks can now be derived for both DTV and DTV Stream. It's a bit of an advanced skill to get them, but it can be done. The deeplinks are different depending on what type of DTV customer you are, and where you live.

I've been using deeplinks for the last couple of months, and they've been working well with ah4c. It's definitely faster, and maybe a bit more reliable -- though both methods are good. Something to think about doing if you're confident with your computing skills, but something of a hill to climb if you're not.

Yep, It's time to do a Firestick trade in again.

My main reason in getting this to work is the upcoming Olympics. Other than the tuning delay, I'm quite happy because I can record events that I want. I plan to install the container on my main DVR NAS today thus freeing up the test DVR NAS for additional testing.

I think my next step will be setting up using Portainer rather than the Synology Container Manager. Portainer is already installed on the test NAS. I'll install Olive Tin and go from there. Having a test NAS helps with the WAF.

I'll look into deep links after I feel more comfortable with Portainer and Olive Tin.

On an off topic question, I'm wondering if the FireTV Live project would accomplish the same thing since I'm only looking at 20-30 channels.

Sounds good. Portainer has many more features, is cross-platform, and will allow you to use Project One-Click.

Taking it a step at a time is a great approach.

It would, but I think you're better off with what you're using now. Both are using remote control emulation, but the LiveTV approach is something I'd only recommend if that's the only option.

1 Like

Keep getting these errors in Channels now whenever I try to tune anything. I did not change anything, it just started happening. I have rebooted everything and restarted everything. Same issue.

2024/07/23 19:17:32.693980 [HLS] Stopping transcoder session ch1016-dANY-ip10.1.1.205 (out=0s finished=false first_seq=0 last_seq=-1)
2024/07/23 19:17:33.807774 [ERR] Failed to start stream for ch1016: M3U: GET: http://10.1.1.201:7654/play/tuner/216: 500 Internal Server Error
2024/07/23 19:17:33.807877 [HLS] Couldn't generate stream playlist for ch1016-dANY-ip10.1.1.205: M3U: GET: http://10.1.1.201:7654/play/tuner/216: 500 Internal Server Error
2024/07/23 19:17:33.807940 [HLS] Stopping transcoder session ch1016-dANY-ip10.1.1.205 (out=0s finished=false first_seq=0 last_seq=-1)

For some reason I had to reauthorize the player. Not sure if it's because of the Update to the Osprey. Seems to be ok now.

For the Olympics, USA and two alternates are all on channel 242. Is there a way to tune them using Osprey boxes? Unfortunately channel 242 goes directly to one of the alternates, not to USA.

@spammedeeper?

That's a good question. I will need to test and report back.

1 Like

It's very odd. There are 3 channels for 242, two Olympic and regular USA. I'm not sure if these are permanent or place holders. I also noticed channel 105 is the "4K" feed.

The other 242s are the Paris Extra channels that will be providing bonus coverage starting Saturday. On satellite they're on channels 242-1 and 242-2, but since DIRECTV still hasn't implemented support for subchannel numbering on their app, you'll likely have to use the deep links to get a specifc 242.

For satellite customers:

dtvnow://deeplink.directvnow.com/play/channel/USAHD/214a502e-c54a-4b61-8904-b4ce37c1e38a
dtvnow://deeplink.directvnow.com/play/channel/OLYX1/350e3196-719a-4e61-95b4-36a39d178637
dtvnow://deeplink.directvnow.com/play/channel/OLYX2/b1502b2c-bdb0-468d-a469-8bb5c5d7a717

For stream/internet customers you'll have to use the "allchannels" json method described a while back with a web browser or curl to find the resourceId

This is how I "solved" it. It tunes to 242 then changes the channel twice to get to the proper 242.

usa="\"242\""

tuneChannel() {

  if [[ "$channelID" == "$usa" ]]; then
    $adbTarget shell input text $channelID; 
    sleep 1;
    $adbTarget shell input keyevent 166; 
    $adbTarget shell input keyevent 166;
  else
    $adbTarget shell input text $channelID; 
  fi
}
1 Like