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

I think you'll need to explain it to me, in executive summary please. Since these two "channels" have the same play/tuner/ URL, as far as ah4c is concerned they are the same.

Only two values are passed to an ah4c script, a tuning ID (whatever value is after play/tuner/), and the IP/hostname:port of the streaming stick being controlled by ADB.

Give me an idea of what you're trying to accomplish, and I think we can come up with a way that doesn't involve using duplicate tuning IDs.

As for your GitHub question, I was fixing things based on @Shaggylive's reports so once he gives me the all clear, I'm fine with it being merged.

Did you figure out a way to deal with these duplicate tuning IDs/URLs he's using?

I just got up here, so I'm going to start looking into that now.


Alright, the robots came up with a solution. So, if it can't identify the tuner reliably, it should come up with a little popover like this.

Update:
@bnhf the plan is to ship this as another PR, so it's nice and readable for you. I just make my agent go through multiple adversarial reviews every time it changes something, so it's at least clean and hopefully not as buggy. So it's just kind of going through that loop right now.

Spun up the minimal compose with:
tag=beta2
GPU_DEVICE=
HOST_DIR=/Users/alang

Opened the wizard and put in addresses.
Moved to Streaming app. Browse local scripts is highlighted. Clicked and nothing there. Selected GitHub for scripts and selected scripts/firetv/dtvstreamdeeplinks
* On a 1st launch, I would have expected the Check GitHub option would be highlighted
I left the Update scripts as Yes (for now). I'm assuming I can override with an environment variable later. Looked at Advanced:upload custom control files but left as is. Hit Next. Moved to tuners section.
Left default on pyatv.
Tuner selection: Had to authorize twice- probably just me since it's located upstairs across the house. I really like that it stayed visible while I walked across the house to authorize. Checked preview and I could see video. On a side note, when adding a tuner, hostname:5555 — many people don’t use hostname but use ip address's. I had to check my Osprey config to decide whether to use http:// or not. With the encoder requiring http://, it might confuse someone new entering that value.
Went to Channel M3Us and added dtvstreamdeeplinks.m3u. Checked Channel sources and it was there. Edited channel number start. Checked guide but no data. Added provider and it’s filling in.

Selected a few channels and average start time was about 23 seconds, comparing to my Osprey's tuning about 9-10 seconds. We'll have to work on that tuning time but I’m only doing this to test. Will add 2nd tuner and Ethernet adapters later this week.

I'll try the upload m3u feature after I convert my Osprey Deeplinks to FireTV Deeplinks.

Well Done @mackid1993 :clap: :clap: :clap:

Thanks, yeah. Tuning time has nothing to do with this. That's just the scripts. Don't put HTTP in for an ADB address. That will error out and warn you. I have validation built in for that.

Check GitHub for scripts, it is right there in the wizard. I don't know if you maybe missed that or if there's anything else I can do with that. I'm not really sure what the issue is. It's not really highlighted or not highlighted; it's just kind of design language. If you want that one to be yellow, I can make it yellow.

I think the idea is that's an optional thing. Some people might not want to call out to the internet for scripts if they're a little more tech-savvy or cautious, so the intent is to make that not the default option.
Edit:
you're right, I'm flipping the colors on those buttons

If your goal is to use DTV with ah4c and no Ospreys, you definitely want to use the FastChannels ah4c bridge. Tuning times are ~5 seconds, and Closed Captions can be enabled in the source stream. For those using DTV, Sling, Philo (and a few others I haven't tested including Fubo and Spectrum), tuning via provider app deeplinks is yesterday's news.

@jagrim I implemented that suggestion, so the option to check scripts on GitHub will show up in yellow now.

@Shaggylive / @bnhf when something is detected as a duplicate, it will come up with a popover asking you which tuner you'd like to release rather than blindly releasing the wrong tuner.

I think this is good guarding regardless, but maybe there's a better way to do what you're trying to do.

I opened up a second PR #41 for this duplicate tuner logic to keep things a little bit cleaner. #40 has the yellow coloring added to it since that's purely polish. #40 to be merged before 41. It seems to be working on my end, but I'd appreciate it if anyone would like to test, especially @Shaggylive.

It's just on my test container, you can do: mackid1993/ah4c:beta or :latest whichever is easier.

What I’m saying is: It's yellow, the same as all other command prompts (Next). Since it's not loading any scripts when spinning up, a novice will immediately select the browse local first then have to go back and check GitHub. This is on a first run. After you’re up and running, it’s not an issue. Maybe neither should be yellow. Maybe just an additional statement saying check GitHub on first run.

On the Tuner, I checked my other ah4c stack before inputting so I did not see a validation. When I add my second tuner, I'll input it incorrectly to see your validation.

I ran the minimal to see how the wizard works as a new user trying to get it up and running. Please don’t take my comments or suggestions wrong. It's going to be a major improvement in getting new users up and running.

I really like the adb authorization. No need to run and find remote before it disappears. I did have to do it twice - was that me or does it require 2 authorizations?

That’s the way I'm heading. I just don’t have enough FTV sticks enough to make that change. I'll have a 2nd stick plus wired Ethernet later this week. Can’t trade in another stick for a max 4K until Oct 1.

Pull my latest image, I already made it yellow.

It's the standard primary button color in the CSS. We have two styles of buttons, so I'm not going to make it a different color.

We have more of a muted color and a call-out color, and that's just kind of how the design is.

You shouldn't have to do it twice, but maybe it just took too long. Maybe try again on a different test stack just to confirm it works. All check tuners does is run adb connect. It's pretty simple.

I'm about to push another small, like literally two-line fix SETUP_WIZARD=false will now actually block the wizard rather than just hiding it. The rerun button to access it in the settings page, which was an afterthought of mine, is now disabled, also settings?wizard=1. That way, your environment variables kind of take over, and you don't have that getting in your way. Just kind of to preserve the existing behavior for people who prefer that. Check in about 10 minutes, and I should have an image up. I have an image up.

Have you tried the Walmart Onn 4K boxes or sticks?

bnhf/ah4c:beta4 pushed that includes all @mackid1993 PRs up to the time of this post (thru PR#41)

1 Like

How well is it working for you so far?
Are there any other features you think I should implement?

Personally, I think the tuner selection logic is actually quite solid when it's ambiguous. I think the idea of letting the user pick which tuner to release when ah4c can't figure it out is a good idea, honestly.

And thank you everyone for your feedback and suggestions. I think it really helped polish things up here. Hopefully we're getting toward an actual latest tag and out of beta tag.

@Shaggylive Thank you for sharing your recordings of cable news with us. I genuinely appreciate that because that's a good hardening thing to have. I don't know why you need two MS Nows, but maybe I need two MS Nows. lol

Yea, I have one that's Tuner 3 on my ADBTuner w/ FDL container. It really only gets used in basketball, softball, & baseball. It's a good 3rd option for me.

I really like the interface as it sits well on the iPad or 34” monitor.

I just need to figure out the easiest way to convert my Osprey Deeplinks for use here. Maybe there's a P1C already. Just need to rename and upload.

not sure what that is, the only collar I wear is flannel lol. I hope this is close. (it's not)

so i'll do my best to explain most of what lead to the config i'm using. I realize some bits and pieces may not be necessary, but aside from the gui getting confused it's the cleanest way i've come up with so far.

in a nutshell :coconut:
I'm trying to recreate the DirecTv 4hr live tv buffer where you could essentially watch tv 4hr behind all day if you wanted. Dish and other dvr's had similar, but I really liked that Directv could do it with with 2 tuners and use the down arrow to switch between without losing the buffer.

with CDVR the best way i've found is by using Autoplay, however this only works if all the shows have the same title, hence the custom placeholder.

Custom Placeholders / Autoplay

I started by just having a custom channel text source
example of one of the variations I used for a while

#EXTINF:-1 channel-id="3" tvg-id="3" tvg-chno="3" tvg-name="MSNow30" tvc-guide-title="MSNow News30" tvc-guide-description="MS Now News 30min" tvc-guide-placeholders="1800" tvc-guide-placeholders-grouping="MSNow30" tvc-guide-tags="ah4c, 720" tvc-guide-art="https://tmsimg.fancybits.co/assets/GNLZZGG002H5PTL.png?w=360&h=270" tvg-logo="https://tmsimg.fancybits.co/assets/GNLZZGG002H5PTL.png?w=360&h=270",MSNow30
http://127.0.0.1:8089/devices/ANY/channels/356/stream.mpg?format=ts&codec=copy
  1. even before my n100 reverted to 6watt and tanked performance I found that 1 hour was too long for comskip to be affective (since live detection sucks) and have found 30 minute blocks to be a decent middle ground (average ~3-5min comskip) and hour block would commonly take ~10-15min and couldn't start until the hour was done.
  2. the smaller the placeholder block the more indexing(or whatever) cdvr's guide data would have to do and any passes have more entries to look through, also comskip doesn't quite understand 15min shows.. lol.

Duplicate(ish) Entries

this layer started seperatly
with a dialed in ah4c setup the only problems I've ever really had are

  1. Docker4win/Portainer/Containers Not starting, but ah4c starting and not using it's persistent volume or not having access to olivetin's adb, generating a recording with adb auth showing, usually on the menu screen or wrong channel
    @bnhf and I have tried and had sporadic success, but it never lasts. there are solutions on my list to explore, but it's actually a separate issue that is only slightly mitigated by duplicate channels in a small percentage of recordings
    it's my biggest peeve, but low on priority since I have a UPS.

also @mackid1993 and @bnhf have made great strides with readiness gates, ect.. which help at least letting cdvr know the recordings not going to happen and to reschedule or find another source

  1. channel # input to fast after wake - again @mackid1993 and @bnhf have rendered this essentially solved :crossed_fingers: (or I could do deeplink I guess.. :grimacing: )
    reasons having duplicate helped are below #3

  2. Flakey internet connection. (my options are mediacon :-1: or t-mob home cell :-1: )
    -if the connection cuts Out/In multiple times over 5 or 10 mins or so many times in a hour (wish we could see osprey logs)
    -or if the connection is just too slow for too long - can be re-creacted by throttling an osprey's bandwidth in router (I don't remember how low I went.. 256k or 512k :person_shrugging: )
    -then you get a connection problem screen on the osprey and it will NOT retry without input. ie tuning attempt.

any back to back recording on the same channel just re-use the existing tune and if that tune was bad, it was bad all day rather than just for that hour/show
only other way i've found to mitigate(retune every recording) without duplicates is to have negative padding in the pass.

I have shared some ideas on other ways to potentially error correct but so far nobody thought it was a problem worth dealing with in the way i was brainstorming.

since I have 4 tuners and equip/options for more, I've adopted the mindset that a busy bot will let me know there's a problem sooner and retries on a predictable schedule. a lazy bot is easily forgotten and only tries when it wants. lol
the only devices i trust to share tuners/tunes are HDHR's and they have the option to not share tuners at least.

I want a new tuner &or tune for every recording. I want my all day news to exercise as many tuners as possible every day for these unimportant recordings since news is both very repetitive and quickly obsolete.
that way regular tv shows and movies I want recorded won't bump into a tuner that hasn't been used for a while acting up.

this is my current setup that uses hour long placeholder blocks (faster guide updates ect..) but uses 2 identical passes on 2 different channels with one padded to end 30min early and the other to start 30min late.

ah4c m3u

#EXTINF:-1 channel-id="60.356" channel-number="60.356" tvg-name="MSNow60" tvc-guide-description="MSNow60 News" tvc-guide-placeholders="3600" tvc-guide-placeholders-grouping="title" tvc-guide-title="MSNow News" tvc-guide-tags="Live",MSNOW60
http://{{ .IPADDRESS }}/play/tuner/356

#EXTINF:-1 channel-id="61.356" channel-number="61.356" tvg-name="MSNow61" tvc-guide-description="MSNow61 News" tvc-guide-placeholders="3600" tvc-guide-placeholders-grouping="title" tvc-guide-title="MSNow News" tvc-guide-tags="Live",MSNOW61
http://{{ .IPADDRESS }}/play/tuner/356

Passes

I think it actually works great! cdvr autoplay will only autoplay to the end of the current recording when you start a Watch Next, but it still lets the tv play in the background unattended for a few hours :+1:

the gui confusion is minor, and likely only affects me. I can go back to the extra custom source loop but that requires multiple containers/stacks as well.
so I appreciate the effort!!
I'm just glad I was able to isolate the issue to me fairly quick so you knew.

I look forward to any improvements anyone might bring to the table as I know a good live tv buffer is something that has eluded cdvr thus far.

you know if they would have come out with that membership thing they just launched, a few years ago, I never would have switched from emby to channels and used ah4c. :lying_face: still would have when hdhr-prime lost all channels. (I lost msn on it a year earlier lol)

i'll pull your latest asap :+1:

Well, I'm actually working on some M3U code right now.

I'm trying to make the M3U editor a little bit more user friendly, so I'm not sure how that's going to pan out. So maybe hold off on pulling my latest. Maybe try @bnhf's latest as it rolls in my current changes that have been a little bit more tested.