HDMI for Channels

So....I installed ADB on my windows PC.

I'm trying to send voice commands to play channels from a specific app.
The end goal is to get this to work with the TDS TV+ (tivo) app.
I have been able to send voice commands with adb, but this is either not possible, or I just don't have the syntax figured out.
I have tried with Hulu, Fubo and TDS TV+.
I usually get a response of not being able to find what I'm looking for.
I guess this works with YTTV, but I don't currently have that, and its not my goal anyway.

Any pointers appreciated.

Could you post a couple of examples of commands you're trying to send? And, maybe a screenshot of what the TDS TV+ app interface looks like?

And to give you and idea of what it might look like to tune to a channel using keyevents (remote control emulation) -- here's a snippet from my bmitune.sh script. There's more to it, but this is the tuning core:

#Tuning is based on channel name values from directv.m3u.
tuneChannel() {
  channelName=$(awk -F, '/channel-id='"$channelID"'/ {print $2}' m3u/directv.m3u)
  channelName=$(echo $channelName | sed 's/^/"/;s/$/"/')
  
  directvMenu="input keyevent KEYCODE_MENU; \
        input keyevent KEYCODE_MENU; \
        input keyevent KEYCODE_MENU; \
        input keyevent KEYCODE_MENU"

  directvSearch="input keyevent KEYCODE_DPAD_RIGHT; \
        input keyevent KEYCODE_DPAD_RIGHT; \
        input keyevent KEYCODE_DPAD_RIGHT; \
        input keyevent KEYCODE_DPAD_RIGHT;
        input keyevent KEYCODE_DPAD_DOWN; sleep 3; \
        input keyevent KEYCODE_DPAD_CENTER; sleep 3"

  directvTune="input keyevent KEYCODE_MEDIA_PLAY_PAUSE; sleep 3; \
        input keyevent KEYCODE_DPAD_DOWN; \
        input keyevent KEYCODE_DPAD_DOWN; \
        input keyevent KEYCODE_DPAD_CENTER"

  $adbTarget shell $directvMenu
  $adbTarget shell $directvSearch
  $adbTarget shell input text $channelName
  $adbTarget shell $directvTune
}

In plain language, I'm turning the channel number into a text string that I know matches only one channel. Then I'm invoking the DTV menu, navigating to the search box, and entering that text string. Easy concept, but takes a bit of work to make it reliable -- which is what a lot of the rest of this script, and a couple of others are about.

Just pushed an update to bnhf/ah4c:test and bnhf/ah4c:latest -- they're both the same now and include the websocket version of scrcpy. My scripts for Sling TV are included, along with a sling.m3u which only has movie channels in it atm.

The scripts leave the Sling app running, which makes for super-fast tuning, but I've seen the occasional black screen this way. You can comment/uncomment the following in stopbmitune.sh to force close the app on exit, which is gives slightly slower, but more reliable tuning:

#Stop stream
adbStop() {
  stop="input keyevent KEYCODE_BACK; \
        input keyevent KEYCODE_BACK; \
        input keyevent KEYCODE_HOME"
  #stop="am force-stop $packageName"
  $adbTarget shell $stop; sleep 2
  echo "Streaming stopped for $streamerIP"
}

This ah4c (super-charged version of androidhdmi-for-channnels) container can be run standalone, as one of two ah4c containers, or in addition to ADBTuner -- so lots of options.

Attempting to setup this today with uraycoder, FireTV MAX and directv. docker for windows desktop
and it all looks setup ok,picture looks good through the encoder and VLC. I can even see and use the h264 converter and change settings by clicking. however when i try to play in channels it restarts the connection.
error message : 2023/08/20 17:29:51.751564 [ERR] Could not start stream for M3U-FiretvDTV ch13543 USA Network HD: M3U: Get "http://192.168.1.195:7654:7654/play/tuner/242": dial tcp: lookup 192.168.1.195:7654: no such host
Any ideas?

The extra :7654 is the problem. We changed a while back to using the port together with the IP address rather than hard-coded in the M3U. Scripts and M3U files are not replaced automatically, so yours may be from before the change. The port should be together with the hostname or IP in the IPADDRESS environment variable (which it appears to be, and is why it's doubled).

The current directv.m3u should look something like this:

#EXTM3U
#EXTINF:-1 channel-id="8" tvc-guide-stationid="25102",KAET PBS 8
http://{{ .IPADDRESS }}/play/tuner/8
#EXTINF:-1 channel-id="10" tvc-guide-stationid="21209",KSAZ FOX 10
http://{{ .IPADDRESS }}/play/tuner/10
#EXTINF:-1 channel-id="12" tvc-guide-stationid="20507",KPNX NBC 12
http://{{ .IPADDRESS }}/play/tuner/12
#EXTINF:-1 channel-id="212" tvc-guide-stationid="45399",NFL Network HD
http://{{ .IPADDRESS }}/play/tuner/212
#EXTINF:-1 channel-id="216" tvc-guide-stationid="45526",NBA TV HD
http://{{ .IPADDRESS }}/play/tuner/216
#EXTINF:-1 channel-id="217" tvc-guide-stationid="60316",Tennis Channel HD
http://{{ .IPADDRESS }}/play/tuner/217
#EXTINF:-1 channel-id="219" tvc-guide-stationid="82547",FOX Sports 1 HD
http://{{ .IPADDRESS }}/play/tuner/219
#EXTINF:-1 channel-id="241" tvc-guide-stationid="59186",Paramount Network HD
http://{{ .IPADDRESS }}/play/tuner/241
#EXTINF:-1 channel-id="242" tvc-guide-stationid="58452",USA Network HD
http://{{ .IPADDRESS }}/play/tuner/242
#EXTINF:-1 channel-id="501" tvc-guide-stationid="19548",HBO HD East
http://{{ .IPADDRESS }}/play/tuner/501
#EXTINF:-1 channel-id="502" tvc-guide-stationid="59368",HBO2 HD East
http://{{ .IPADDRESS }}/play/tuner/502
#EXTINF:-1 channel-id="503" tvc-guide-stationid="59363",HBO Signature HD East
http://{{ .IPADDRESS }}/play/tuner/503
#EXTINF:-1 channel-id="504" tvc-guide-stationid="19566",HBO West HD
http://{{ .IPADDRESS }}/play/tuner/504
#EXTINF:-1 channel-id="505" tvc-guide-stationid="59355",HBO2 West HD
http://{{ .IPADDRESS }}/play/tuner/505
#EXTINF:-1 channel-id="506" tvc-guide-stationid="59839",HBO Comedy HD
http://{{ .IPADDRESS }}/play/tuner/506
#EXTINF:-1 channel-id="507" tvc-guide-stationid="59357",HBO Family East HD
http://{{ .IPADDRESS }}/play/tuner/507
#EXTINF:-1 channel-id="509" tvc-guide-stationid="59845",HBO Zone HD
http://{{ .IPADDRESS }}/play/tuner/509
#EXTINF:-1 channel-id="618" tvc-guide-stationid="59305",FOX Sports 2 HD
http://{{ .IPADDRESS }}/play/tuner/618
#EXTINF:-1 channel-id="exit" tvg-logo="http://{{ .IPADDRESS }}/static/logos/exit.png",Exit DirecTV
http://{{ .IPADDRESS }}/play/tuner/exit
#EXTINF:-1 channel-id="reboot" tvg-logo="http://{{ .IPADDRESS }}/static/logos/reboot.png",Reboot FireTV
http://{{ .IPADDRESS }}/play/tuner/reboot

You could hand edit the file to remove the hard-coded :7654, or delete the m3u file (and the firetv/directv scripts for that matter to get the latest), which is probably a better option. You can rename your scripts and current m3u if you've modified them and want to integrate your previous work into the new files.

Once you've deleted the files, go into Portainer-Stacks and update (use the slider to get the latest image too). Check the Portainer logs for the container, and you should see the latest scripts and m3u file copied over to your data directory.

I tried the shortcut method by editing the M3U and got a step closer but no go.
Of course scorched earth was neccessary to get it working correctly. Up and running ok!
Thank you for your quick response.

May get lost in this massive thread.

But for anyone with 1 tuner and struggling with stream limits on quick channel changes or want to hold the first stream on if another client connects - might have the solution for you.

If you run your M3U file through xteve and set the following settings - xteve will mange the stream limit, instead of channels (which aims to change channels as quick as possible)

xteve settings:

Playlist m3u settings - 1 tuner

Stream buffer - Xteve

Buffer size - 0.5mb (not sure if this matters)

Timeout for new connection - 600+ (I set it at 1000ms just incase since I can barely tell the difference)

Channels settings:

Load xteve m3u into a Custom Channel

Set stream limit to have no limit.

Done very brief testing on this and seems to work how I am wanting. Will edit this post if I run into any issues.

3 Likes

Just added support for SiliconDust HDHomeRun thanks to @Edwin_Perez's kind donation. You will see a new m3u file which works with the firetv/hulu set of scripts. Note that firetv/hulu also supports youtube links as well.

With this in place we are ready for ATSC 3!

4 Likes

Would you please explain this? I’ve been using HDH for a while with Channels.

Do you have any local ATSC 3.0 channels that are restricted by DRM? Because at the very least there seems to be a use case in that context that is brewing.

Sure! Instead of Channels pulling the MPEG stream directly from HDHR a Android device runs the HDHR client and we record that via HDMI which sidesteps the silly encryption/drm game.

3 Likes

Ah! I understand. I think I’m lucky enough to not have those… Yet.

Sorry for the late reply, I've been out of the country.

I have not, but I'd love to hear your results

Holy cow! So, since I'm coming along late to the conversation, would it be possible to summarize the steps that I would need to take to find these channel links myself? I'm mostly using Sling for TV5Monde, so my guess is folks here won't scan those :slight_smile:

The post you were replying to has the core of it. But to expand on that some, on your computer go to Sling TV, and then to the grid guide. Click a channel's icon, then look at the URL -- and between "channel/" and "/browse" you'll see a long unique identifier. That's what you want to plug into that second URL I reference for the deep link, between "channel/" and "/watch".

My Sling scripts are pretty good, though there's still an occasional "tuning" failure that I want to cover -- so feel free to use what's there now, but be looking for updates shortly. I'm using two containers, with one using the standard port 7654 and the other using 7664. The ws-scrcpy port is 7655 and 7665 respectively. Two ports on my four port encoder are for DirecTV and two ports for Sling TV presently.

Not sure if I'm going to stay with Sling past this first super-cheap month I got, as I'm mainly using the premium movie channels and I may try subscribing to those directly next.

Oh, and here's my sling.m3u, which is also in the repo:

#EXTM3U
#EXTINF:-1 channel-id="526" tvc-guide-stationid="34949",Starz HD West
http://{{ .IPADDRESS }}/play/tuner/8a84458592844ff5849712ef7766fb4e
#EXTINF:-1 channel-id="527" tvc-guide-stationid="57581",Starz Kids & Family HD
http://{{ .IPADDRESS }}/play/tuner/148a1e391db94edf96bf25e25beb307d
#EXTINF:-1 channel-id="529" tvc-guide-stationid="57573",Starz Edge HD
http://{{ .IPADDRESS }}/play/tuner/1535e572f07348159d8924d58200690e
#EXTINF:-1 channel-id="530" tvc-guide-stationid="67235",Starz in Black HD
http://{{ .IPADDRESS }}/play/tuner/23a6ea3c163a47f390f73900ccc76bc1
#EXTINF:-1 channel-id="531" tvc-guide-stationid="67236",Starz Cinema HD
http://{{ .IPADDRESS }}/play/tuner/0eedb59656d243da914fef990a8db903
#EXTINF:-1 channel-id="535" tvc-guide-stationid="36225",Starz Encore HD
http://{{ .IPADDRESS }}/play/tuner/ed5d0f85928f45249f8a67c9746a80b7
#EXTINF:-1 channel-id="536" tvc-guide-stationid="17125",Starz Encore West
http://{{ .IPADDRESS }}/play/tuner/a0515fde0c074dc389981e8881874aae
#EXTINF:-1 channel-id="537" tvc-guide-stationid="14764",Starz Encore Classic
http://{{ .IPADDRESS }}/play/tuner/2230d31d16d541c08e654d4a11863d2c
#EXTINF:-1 channel-id="538" tvc-guide-stationid="102906",Starz Encore Westerns
http://{{ .IPADDRESS }}/play/tuner/73ab11e5664241a9811e7e22602bfda9
#EXTINF:-1 channel-id="539" tvc-guide-stationid="14766",Starz Encore Suspense
http://{{ .IPADDRESS }}/play/tuner/04e4a4f1e0ec4dfba961414197e57d7f
#EXTINF:-1 channel-id="540" tvc-guide-stationid="14870",Starz Encore Black
http://{{ .IPADDRESS }}/play/tuner/1ec67d324b564a528f6901ed8e09334e
#EXTINF:-1 channel-id="541" tvc-guide-stationid="72015",Starz Encore Action HD
http://{{ .IPADDRESS }}/play/tuner/8aed8223a6104b53b24f03555fc933a9
#EXTINF:-1 channel-id="542" tvc-guide-stationid="102903",Starz Encore Family
http://{{ .IPADDRESS }}/play/tuner/22076462a8124832967e30e0f9f92213
#EXTINF:-1 channel-id="545" tvc-guide-stationid="21868",Showtime HD
http://{{ .IPADDRESS }}/play/tuner/7f5f5993457648d68db2fa5d5103cbcc
#EXTINF:-1 channel-id="546" tvc-guide-stationid="22532",Showtime HD West
http://{{ .IPADDRESS }}/play/tuner/f8ee74606d2a47ec8ca14842b2762b9b
#EXTINF:-1 channel-id="547" tvc-guide-stationid="58533",Showtime 2 HD
http://{{ .IPADDRESS }}/play/tuner/30b674a6204f4d9b8ec053e0f6381a28
#EXTINF:-1 channel-id="548" tvc-guide-stationid="68340",Showtime BET HD
http://{{ .IPADDRESS }}/play/tuner/df9f6f06051d4681938a627be72a4cf9
#EXTINF:-1 channel-id="549" tvc-guide-stationid="60947",Showtime Extreme HD
http://{{ .IPADDRESS }}/play/tuner/ea47544f20394a4b83a2c0678c078d66
#EXTINF:-1 channel-id="550" tvc-guide-stationid="61001",Showtime Showcase HD
http://{{ .IPADDRESS }}/play/tuner/b24b20f009e94eb1ad2441a19f98b7ff
#EXTINF:-1 channel-id="551" tvc-guide-stationid="68342",Showtime NextHD
http://{{ .IPADDRESS }}/play/tuner/b5540f5fb9b542aeb0f253d9854c174f
#EXTINF:-1 channel-id="552" tvc-guide-stationid="103892",Showtime Familyzone HD
http://{{ .IPADDRESS }}/play/tuner/7b21fc1766304e268ef4757d56b3ac44

The channel-id's I used are DirecTV channel numbers, so those can be whatever works for you. Otherwise for these movie channels, the channel name, Gracenote station ID and ah4c proxy URL would be the same.

I have set up all the necessary hardware for this (4 Chromecasts, a 4 port Uray encoder, haven't started on docker etc.) and have been doing some general testing of the encoding schemes to try to find the optimal settings for quality vs. file size/bitrate.

I've noticed that if I use the remote, navigate to YouTube TV, and start playing a channel, the quality is significantly higher than if I "Cast" from the YouTube TV app on a phone or from a browser.

When you use this setup with the "deep links", is it calling the YouTube TV app on the google device and playing at high quality? Or is it essentially passing a cast link and are you getting mediocre quality?

It's calling the YouTube TV app on the Android device. Quality is based on the streaming capabilities of the Android device, the app's streaming standards, and then the capabilities of your capture device mixed with the settings you're using on the device.

Essentially you should be able to duplicate what you'd see on your TV with the same device plugged into it -- as long as your encoder is capable of that same quality, and you have settings to match.

Great, that's what I wanted to hear.

To clarify, I'm watching the device via the encoder. If I cast via an app or from the browser, it's playing what looks like 480p. If I play directly from the YTTV app, it plays at 720p/1080p (or 4K if applicable). Very confused why casting degrades the quality, but it's very noticeable.