HDMI for Channels

Yay, got it all working with the Onn 4K and the Uray encoder! Pretty slow to wake and start the NBC app then have the app start the stream, from what I've seen it's about 20-25 secs total. That's fine for recording which is all need, don't care about live. I'm using H.265, 1920x1080@60fps, 8k VBR, MPEG-TS.

Here's my pre and post tune scripts for anyone curious, I force close the app and put the box to sleep after a tune which is why the app takes longer to startup I'm sure.

prebmitune.bat

@echo off
set IP=192.168.1.94:5555

c:\platform-tools\adb connect %IP%
c:\platform-tools\adb -s %IP% shell input keyevent KEYCODE_WAKEUP
rem c:\platform-tools\adb -s %IP% shell input keyevent KEYCODE_HOME

stopbmitune.bat

@echo off
set IP=192.168.1.94:5555
c:\platform-tools\adb -s %IP% shell am force-stop com.nbcuni.nbc.androidtv
c:\platform-tools\adb -s %IP% shell input keyevent KEYCODE_HOME
c:\platform-tools\adb -s %IP% shell input keyevent KEYCODE_SLEEP
1 Like

Yeah if you look at my bmitune.bat script above I put those in as params for the NBC app and it worked. Thanks!

I'm hoping here that with the pre- and post- tune scripts that allow for stopping the app that it might work ok with a fresh start every time. Who knows, but I don't have much choice anyway since I'm not subbing to YTTV.

FWIW I went back and edited earlier posts that had wrong channel mappings to hopefully minimize any confusion. I also wanted to add, that the 14 channels I've got set up are still working fine for me, the links haven't changed, so the verdict may still be out on their relative (im)permanence.

This is good to keep in mind. Not just for folks who don't have YTTV's unlimited plan, but also for folks set up to be sharing the YTTV family subscription in other households.

Not a bad idea, I may mix-and-match too. Maybe just for a few channels. I'll experiment over the weekend.

Yeah, as interactive apps their UI's are pretty bad, but if we can launch straight to a live channel's stream reliably, and just use Channels UI for everything else, it seems like something to consider. That YTTV splash / outer space scraping sound is growing more annoying by the hour and this would cut down on that, at least...

Yes.

One thing to consider about H265 is that it makes comskip take a MUCH MUCH longer time to scan the files after recording stops. In my case it was quite excessive so I landed back on H264.

By the way, I came across this:

It appears to be a semi-automated way to get the channel links for YTTV - perhaps it could be the basis for a future way of keeping YTTV links refreshed...

2 Likes

Nice find. It's a bit out of date as the url and some other things have changed but it's generally the same.

That being said, if you are going to be in the dev console you might as well just scrape the page using JavaScript.

Paste in developer console on tv.youtube.com/live:

const channelRows = document.querySelectorAll("div.container.ytu-epg-row");
results = []
for (i = 0; i < channelRows.length; ++i) {
   var network = channelRows[i].querySelector(".network-title").innerHTML
   var targetLink = channelRows[i].querySelector(".tenx-thumb > a.yt-simple-endpoint.style-scope.ytu-endpoint").href
   if (network && targetLink && targetLink.includes("watch")) {
      results.push({
         networkName: network,
         targetLink: targetLink
      })
   }
}
console.table(results);

This will give you a nice table of data like this:

And if you want JSON data you can right click on the "array()" at the bottom and choose "copy object" to copy a JSON representation of the results to your clipboard.

It should be a pretty simple task to write a small script to take this JSON data and spit out a bmitune.sh file and an m3u playlist. I will do that tomorrow if someone doesn't beat me to it.

4 Likes

Has anyone been able to run the NBC app on the Onn TV 4K? I am getting "unable to connect" "please check your internet connection and try again" on two different boxes - one connected to the encoder and one to a TV.

Had some high strangeness this evening. My newer mecool device prompted for are you still there within 3 minutes after starting a recording?

At this point not sure what is going on as the stream just started. I am sticking with the original amazon fire tv 4k ultra until I can get this figured out. Will start testing random shows on my 2nd tuner with these new devices - more info to come!

EDIT: I have added checks to my tune in script and keep alive handler. I am now making note of what station is "tuned in" and during my keep alive checks if the stream is not playing it will attempt to recover by tuning in again.

Keep alive checker: Monitors streams and restarts if needed. Also attempt to keep the player thinking someone is hitting buttons. · GitHub
My tune in script: tmm1/androidhdmi-for-channels hulu tuner script · GitHub
My stop script: Stop playing media · GitHub

Hopefully this can give inspiration for anyone else wanting to make the process a bit more refined/robust.

1 Like

Yeah I wouldn't have posted all that info about how I got it to work if it didn't actually work. :grinning: But not long after I had it working on the ONN yesterday, I tried to launch NBC again from the channels guide just to see how it worked over time and I got an endless stream of three dancing dots in the middle of the NBC app. I then tried to run the NBC app manually and it got content not available when I selected the live tab. Force close the app, clear cache, clear data, still didn't work.

So then I installed the app on my Samsung phone and it also got content not available, so it wasn't an ONN issue. Strangely enough, the app worked fine on my Apple TV. Go figure, but I hope this isn't a recurring issue with NBC on Android.

is it possible to extend the timeouts when tuning a Channel using HDMI ? maybe adding a wait in the M3U ? Right now it is 20 seconds. There are so many things that can interfere with tuning. I do not watch HDMI lifetv but do record... so wait time is not an issue. I seem to be off by a second or so but Channels DVR timeout after 20s.

1 Like

Well, I figured out that the NBC app is the only streaming app that I have on any device (Nvidia Shield, FireTV or Onn) that doesn't like DNS ad blockers like Adguard. I have two Adguard DNS servers which serve to cut down on the number of annoying pop-ups, etc. on web sites. I also block any outgoing DNS traffic for devices with hard coded DNS servers that attempt to bypass the Adguard servers. The NBC app will only come up when I disable Adguard. I didn't have enough time to get it to work properly with Adguard turned back on (by trying to create an exception rule), so will have to continue trying tonight.

On another note, when trying to download a backup of the URaycoder firmware, Windows flagged the file as containing a virus and removed it. I contacted URay - they suggested that Windows made a "mistake". They did send me the latest .bin file to try and update the encoder. I added a rule to block any outgoing internet traffic from the encoder.

If you use androidhdmi-for-channels there won't be any timeout problems. It sends the encoder stream immediately and runs the scripts in the background.

How is everyone handling the inevitable mess of hardware that comes with this project?
Once you get multiple devices involved and add ethernet adaptors and such it quickly gets out of hand.

As an on-theme, temporary solution I decided to shove everything into an onn. cable organizer I happened to pick up while I was in the store.

The goal being to have a single box with one electrical and one ethernet connection that I can throw in the closet with my other home automation stuff and forget about. This is very much function over form lol.


Contents:

2x "LinkPi ENC1v2" HDMI encoders
Amazon | Aliexpress

2x "Chromecast with Google TV (4k)"
Amazon | Walmart

2x "Vemont USB C hub / ethernet adaptor"
Amazon

1x Ubiquiti UniFi Flex Mini 4-Port Switch
B&H Photo
I have other Unifi gear so this made sense, it might not if you don't already have a Unifi setup. This was helpful as it can be easily powered via usb-c or PoE.

1x USB 2.0 A Male to DC 5.5x2.5mm Barrel Jack Power Cable Adapter 5V (2-pack)
Amazon
I don't know if this is true for all of these devices, but the ENC1v2 encoders will happily work with a 5v power input from a USB connection. This eliminates two AC adaptors.

So the box has one ethernet cable and two usb-c cables coming out of it. The usb-c cables connect to a 2-port Anker charger I had lying around so it only takes up one AC outlet.

As I said, function over form, but it works and now I don't have to look at a pile of gear sitting on a shelf. The box is decently ventilated and according to the web UI the encoders do not get any warmer then they did when just sitting out in the room.

For now, I've gone the "pile of gear sitting on a shelf" (in a corner in my basement home office) route as I fine tune everything. I dug out an unused table to keep everything on.

My plan, if I ever get to the point where I'm done tinkering, will be to move it all into a utility room where I have a metal rack (I call it my server rack, but it's just some shelves). It is near a 24-port network switch, so I'll be able to plug directly into that.

1 Like

Heh, I just jammed my "christmas tree" in the little cabinet. It's a bit of a jumbled mess, but it all works pretty well, and I'm happy with it.

I like the idea of a cable management box though. Looking into it :slight_smile:

The androidhdmi-for-channels scripts are ok but overkill for what I need all I need is to pass the Channel number to my Windows Script and capture the steam and close it.. I figured a way around the timeouts. I can capture DRM from my Primes and XFINITY stream this way... by channels Numbers.

@cyberskier @Fofer yeah that's where i was just a few days ago!

I'm hoping that moving this into the closet will get me to stop tinkering (at least with hardware) for a bit.

I am using simple amazon shelf's for my setup. Works for now but plan to revisit.

2 Likes

Since we are sharing. My experiment just pretty much sits on a shelf in a cabinet too. Not too concerned about the mess. But the cabinet is about 1 degree F warmer on average now. And the secondary cooling fan kicks off a little more often. Will probably do a complete rewiring/organizing and labeling this weekend.