HDMI for Channels

I am finding this experimental project exceptionally fun and also a little reassuring looking toward possible future TVE and even future Broadcast roadblocks. I started out with just a single channel URayCoder HEVC H.265 H.264 Live HDMI Video Encoder with a Chromecast with Google TV (HD) Streaming Stick.

But decided right away I would kick myself constantly if I didn't get the 4 channel URayCoder 4K 4 Channels H.265 H.264 HDMI IP Video Streaming Encoder (so I am using one of those now). I added a second Chromecast and my primary main tuner is now an onn Android TV 4K. I am keeping my 4th available HDMI port open because frankly I think my current usage will only kick in the second tuner occasionally and the third rarely. Though who knows, maybe I'll play around with one of my old FireTV 4k Max sticks.

I have to offer my profound thanks to everyone here who have been posting their research and development. In particular @tmm1 for the original files. But also to @JT-DFW and @Fofer whose constant reports and updates and scripts I have Frankensteined into something that is working very well for me. BTW: I am doing a Windows setup for androidhdmi-for-channels, so I am using .bat files instead of .sh.

One thing I would like to see is maybe a modification/addition to the androidhdmi-for-channels program file to optionally run a maintenance script if it detects that all tuners have been inactive for a period of time. Currently I am running a nightly scheduled task to reboot the "tuners" and then put them to sleep. I would like to find a way to detect if all the tuners have been inactive for an hour and just simply do a cleanup reboot and put them to sleep till they are needed next.

In the interest of fair sharing, here is my current script batch files. There are three of each script, with only differences being the ip addresss of the 2 chromecast and 1 onn. These batch files of course need coding optimization and cleanup. They are a work in progress for me.

bmitune.bat script

@echo off
set "p1=%1"
set link=""
if "%p1%"=="nbc" set link=https://tv.youtube.com/watch/vsHPIz9ZC-4?onboard=1
if "%p1%"=="fox" set link=https://tv.youtube.com/watch/yVKpCICuh-A?onboard=1
if "%p1%"=="msnbc" set link=https://tv.youtube.com/watch/q6bWEVqhP8o?onboard=1
if "%p1%"=="e" set link=https://tv.youtube.com/watch/4XA2gdEOngg?onboard=1
if "%p1%"=="bravo" set link=https://tv.youtube.com/watch/P12seiJcdYo?onboard=1
if "%p1%"=="oxygen" set link=https://tv.youtube.com/watch/_XptfCraPjM?onboard=1
if "%p1%"=="usa" set link=https://tv.youtube.com/watch/8xN3o2PSL5s?onboard=1
if "%p1%"=="syfy" set link=https://tv.youtube.com/watch/uSfozGAsGMk?onboard=1
if "%p1%"=="cnbc" set link=https://tv.youtube.com/watch/GIBoX-XF5i0?onboard=1
if "%p1%"=="golf" set link=https://tv.youtube.com/watch/XK34g7QRvGk?onboard=1
if "%p1%"=="nfl" set link=https://tv.youtube.com/watch/_pYg9qMKKIA?onboard=1
if "%p1%"=="newsnation" set link=https://tv.youtube.com/watch/ZIzM3eNrylg?onboard=1
if "%p1%"=="mtvclassic" set link=https://tv.youtube.com/watch/YPB9f0dageg?onboard=1
if "%p1%"=="bbcnews" set link=https://tv.youtube.com/watch/g5BmB1qXulc?onboard=1
if "%p1%"=="smithsonian" set link=https://tv.youtube.com/watch/E7D0KRZIUso?onboard=1
if "%p1%"=="magn" set link=https://tv.youtube.com/watch/9dTo5rwwTjU?onboard=1
if "%p1%"=="nik" set link=https://tv.youtube.com/watch/cN5V1eeO3E4?onboard=1
if "%p1%"=="just" set link=https://tv.youtube.com/watch/EBdQc7HoF_E?onboard=1
if "%p1%"=="twcyt" set link=https://tv.youtube.com/watch/P_w3HTppc6E?onboard=1
if "%p1%"=="twc" (
	adb -s 192.168.1.135:5555 shell monkey -p com.weathergroup.twc 1
	waitfor ClearOutSpecialWeatherStatement /t 20
	adb -s 192.168.1.135:5555 shell input keyevent 20 66
	goto END
)

if "%link%"=="" goto END

c:\platform-tools\adb -s 192.168.1.135:5555 shell am start -a android.intent.action.VIEW -d %link% -n com.google.android.youtube.tvunplugged/com.google.android.apps.youtube.tvunplugged.activity.MainActivity

:end

The prebmitune scripts are

@echo off
set CONNECT=connect 192.168.1.135:5555
set WAKE=input keyevent KEYCODE_WAKEUP
set HOME=input keyevent KEYCODE_HOME

adb %CONNECT%
adb %CONNECT%
adb %CONNECT%
adb -s 192.168.1.135:5555 shell %WAKE%
adb -s 192.168.1.135:5555 shell %WAKE%

And the stopbmitune scripts are

@echo off
rem c:\platform-tools\adb -s 192.168.1.135:5555 shell am force-stop com.google.android.youtube.tvunplugged
c:\platform-tools\adb -s 192.168.1.135:5555 shell am force-stop com.weathergroup.twc
c:\platform-tools\adb -s 192.168.1.135:5555 shell input keyevent KEYCODE_HOME
rem c:\platform-tools\adb -s 192.168.1.135:5555 shell input keyevent KEYCODE_SLEEP

Oh, and the nightly maintenance batch file is

@echo off
c:\platform-tools\adb connect 192.168.1.194:5555
c:\platform-tools\adb -s 192.168.1.194:5555 shell input keyevent KEYCODE_WAKEUP
c:\platform-tools\adb -s 192.168.1.194:5555 shell am force-stop com.google.android.youtube.tvunplugged
c:\platform-tools\adb -s 192.168.1.194:5555 shell am force-stop com.weathergroup.twc
c:\platform-tools\adb -s 192.168.1.194:5555 shell input keyevent KEYCODE_HOME
c:\platform-tools\adb -s 192.168.1.194:5555 reboot

c:\platform-tools\adb connect 192.168.1.137:5555
c:\platform-tools\adb -s 192.168.1.137:5555 shell input keyevent KEYCODE_WAKEUP
c:\platform-tools\adb -s 192.168.1.137:5555 shell am force-stop com.google.android.youtube.tvunplugged
c:\platform-tools\adb -s 192.168.1.137:5555 shell am force-stop com.weathergroup.twc
c:\platform-tools\adb -s 192.168.1.137:5555 shell input keyevent KEYCODE_HOME
c:\platform-tools\adb -s 192.168.1.137:5555 reboot

c:\platform-tools\adb connect 192.168.1.135:5555
c:\platform-tools\adb -s 192.168.1.135:5555 shell input keyevent KEYCODE_WAKEUP
c:\platform-tools\adb -s 192.168.1.135:5555 shell am force-stop com.google.android.youtube.tvunplugged
c:\platform-tools\adb -s 192.168.1.135:5555 shell am force-stop com.weathergroup.twc
c:\platform-tools\adb -s 192.168.1.135:5555 shell input keyevent KEYCODE_HOME
c:\platform-tools\adb -s 192.168.1.135:5555 reboot

waitfor GiveTimeToFullyReboot  /t 90

c:\platform-tools\adb connect 192.168.1.194:5555
c:\platform-tools\adb -s 192.168.1.194:5555 shell input keyevent KEYCODE_WAKEUP
c:\platform-tools\adb -s 192.168.1.194:5555 shell input keyevent KEYCODE_SLEEP

c:\platform-tools\adb connect 192.168.1.137:5555
c:\platform-tools\adb -s 192.168.1.137:5555 shell input keyevent KEYCODE_WAKEUP
c:\platform-tools\adb -s 192.168.1.137:5555 shell input keyevent KEYCODE_SLEEP

c:\platform-tools\adb connect 192.168.1.135:5555
c:\platform-tools\adb -s 192.168.1.135:5555 shell input keyevent KEYCODE_WAKEUP
c:\platform-tools\adb -s 192.168.1.135:5555 shell input keyevent KEYCODE_SLEEP

That is really promising, as there are some TV Everywhere channels that take that long. I wish I had an unlimited budget for this project, to try out different devices to see what the fastest one is. I’m not well-versed in the Android world to know what the fastest processor is considered to be.

As I spend more money on this, I keep telling myself that the money isn’t just for the gear, but for the fun of it, just like other people have expensive hobbies. :slight_smile:

2 Likes

It's quite a nice box. It has ADs stripped away from the home screen and seems well engineered. If I was to purchase another box to add to my streaming setup it will definitely be these going forward.

I hear you. I've already spent more money on this random project than I would care to admit. :smile:

2 Likes

So much for channels being an inexpensive alternative :laughing: on the HDMI work-around.

Watching, but not spending yet! Playing with scripts on my *ix box and Android TV devices tho.

1 Like

Yeah, I’ve actually spent around just as much for the hdmi experiment as I did to get the Synology Channels server I use. Lol.

1 Like

Same here. Small price to pay for feeling liberated by the fact that TV everywhere can disappear at some point. NBC, etc.

3 Likes

I had my finger hovering over the "purchase" button for that one last night, but decided I'd sleep on it for a few days. I had visions of someone else jumping in here after I ordered and saying "6 seconds? I have one that loads a channel in 4 seconds!" :smile:

From my casual reading the Amazon Fire cube seems to be the next step up in terms of hardware.

1 Like

OK I've got the hardware and software setup for the NBC channels, but I can't find in the thread how to launch the NBC app directly to a channel via adb. Everyone's doing it through YTTV but I know that Channels is doing it directly with the nbctve:// streamlinks, so how is Channels doing it and can it be done in adb without doing keypresses?

I've got direct streamlinks for live channels working fine, just need to figure out how to launch them with adb in the tune file. I think the package is com.nbcuni.nbc.androidtv on the Onn TV stick but don't know the intent (I'm guessing VIEW?) and URIs to get the app to launch a specific channel.

I think we have to get into apk hacking to see if we can't remove that stupid YouTube TV splash screen lol. That's a few seconds right there if the app isn't already open.

I have been going down this road this week. Already destroyed two onn boxes lmao. It's dark in these parts.

Maybe try something like this (complete guess, apologies if it doesn't work):

adb shell am start -a android.intent.action.VIEW -d nbctve://path/to/content

Yes please, lol. If not the whole splash screen, then maybe just that awful launch sound effect (some sort of scraping noise in outer space?) that I’ve grown sick of hearing :slight_smile:

1 Like

Thanks! I got it to work manually, still trying to figure out the go syntax to run the Windows batch files instead of bash shell scripts, go build is bombing out. Looks like I need to escape some chars.

Here's my bmitune.bat to launch NBC channels via the app:

@echo off
set p1=%1
set link=""
set IP=192.168.1.94:5555
set PKG=com.nbcuni.nbc.androidtv

if "%p1%"=="nbc" set link=nbctve://live/nbc
if "%p1%"=="msnbc" set link=nbctve://live/msnbc
if "%p1%"=="usa" set link=nbctve://live/usa
if "%p1%"=="syfy" set link=nbctve://live/syfy
if "%p1%"=="cnbc" set link=nbctve://live/cnbc
if "%p1%"=="golf" set link=nbctve://live/golf

c:\platform-tools\adb -s %IP% shell am start -a android.intent.action.VIEW -d %link% -n %PKG%/com.nbc.nbctvapp.ui.main.view.MainActivity

For anyone wondering how to get the Android default activity for an app (the -n param in the start command above), the command is:
adb shell cmd package resolve-activity --brief "pkgname"

where pkgname is the NBC package name here (com.nbcuni.nbc.androidtv), you get these by running:
adb shell pm list packages "filter"
where filter is nbc in this case to only show the NBC packages

I might be miss-understanding what you are saying... but all you need to do is make sure the main.go file says the right names... mine has this

	tuners = []tuner{
		{
			url:   "http://192.168.1.168/0.ts",
			pre:   "C:\\androidhdmi-for-channels-main\\prebmitune.bat",
			start: "C:\\androidhdmi-for-channels-main\\bmitune.bat",
			stop:  "C:\\androidhdmi-for-channels-main\\stopbmitune.bat",
		},
		{
			url:   "http://192.168.1.168/4.ts",
			pre:   "C:\\androidhdmi-for-channels-main\\prebmitune2.bat",
			start: "C:\\androidhdmi-for-channels-main\\bmitune2.bat",
			stop:  "C:\\androidhdmi-for-channels-main\\stopbmitune2.bat",
		},
		{
			url:   "http://192.168.1.168/8.ts",
			pre:   "C:\\androidhdmi-for-channels-main\\prebmitune3.bat",
			start: "C:\\androidhdmi-for-channels-main\\bmitune3.bat",
			stop:  "C:\\androidhdmi-for-channels-main\\stopbmitune3.bat",
		},
	}

I see 2 big advantages for YTTV users to use the NBC app for the NBC channels: 1-the links appear to be more permanent and 2-it doesn't take up one of your 3 allowed streams

I am going to modify my bmitune.bat file when I get home to use a combination of NBC and YTTV (only for the non NBC channels, like BBCNews)

BTW - isn't Bravo an NBC channel?

Yeah had to figure out (again) that you need to escape the backslashes in Windows, ugh.

1 Like

I'd be interested to hear how this works out when launched this way. When using as Stream Links, I found the NBC app to be an unreliable train wreck, loading some times, not loading other times, and giving me errors at times.

1 Like

Looking over here at Stream Link URLs - have you all tried this format?

nbctve://live/$NETWORK