ADBTuner: A "channel tuning" application for networked Google TV / Android TV devices

ADBTuner tunes so quickly, and even this early, feels robust and stable. So I'm tinkering with other Android TV apps to "tune into" and stream from, into the Channels UI on AppleTV. I'm just manually sending adb commands, found a full listing here:

So for example, using adb -s [IP address] shell input keyevent 22 while watching the TikTok app, skips to the next video. And keyevent 21 skips back to the previous one. Of course this is really only of practical use when you're watching "live," i.e. not in the buffer. But the point I'm trying to make is, this same sort of control can be used to navigate to, or within, other apps too. This includes live TV apps that aren't deep-linkable, and apps that play video that wouldn't be considered live TV at all.

Anyway, my feature request is that ADBTuner gets a virtual remote control (like a mini widget, or pulldown menu) we can use to send the most common adb commands manually for content and/or navigation when troubleshooting, streaming or something else. And if we could save favorites and/or string together and assign multiple ADB commands as "tuning macros," that would open up more avenues too.

Just thinking out loud, I appreciate how great ADBTuner is right out of the gate. This development is liberating and exciting. Once again the future feels bright!

2 Likes

I agree, not sure how ADBTuner does it but I'm glad it does haha.

Current Fubo Progress:

shell am start -a android.intent.action.VIEW -d "fubotv://al/v1/al1%3Fv%3D1%26a%3Dgoto%26d%3Dpage%26pn%3Depg" com.fubo.firetv.screen/tv.fubo.mobile.presentation.onboarding.dispatch.controller.DispatchActivity

Opens to the EPG, but for the life of me I can't get to a live stream for ADBTuner to work it's magic.

I wish I could help, but I don't have a Fubo TV account and I'm pretty sure I'm permanently banned because i used more than one free trial. :grinning:

I would look into using URLs that contain https://link.fubo.tv. Perhaps seeing if there are links in the web UI somewhere that go to a specific channel and using whatever path they have specified there.

$ adb shell dumpsys package com.fubo.firetv.screen
Activity Resolver Table:
  Schemes:
      fubotv:
        c823270 com.fubo.firetv.screen/tv.fubo.mobile.presentation.onboarding.dispatch.controller.DispatchActivity filter 27a266e
          Action: "android.intent.action.VIEW"
          Category: "android.intent.category.DEFAULT"
          Category: "android.intent.category.BROWSABLE"
          Scheme: "fubotv"
          Authority: "app_open": -1
          Authority: "al": -1
      http:
        c823270 com.fubo.firetv.screen/tv.fubo.mobile.presentation.onboarding.dispatch.controller.DispatchActivity filter ccc110f
          Action: "android.intent.action.VIEW"
          Category: "android.intent.category.DEFAULT"
          Category: "android.intent.category.BROWSABLE"
          Scheme: "https"
          Scheme: "http"
          Authority: "link.fubo.tv": -1
          Authority: "link.fubo.tv": -1
          Path: "PatternMatcher{PREFIX: /}"
          Path: "PatternMatcher{PREFIX: /}"
          AutoVerify=true
      https:
        c823270 com.fubo.firetv.screen/tv.fubo.mobile.presentation.onboarding.dispatch.controller.DispatchActivity filter ccc110f
          Action: "android.intent.action.VIEW"
          Category: "android.intent.category.DEFAULT"
          Category: "android.intent.category.BROWSABLE"
          Scheme: "https"
          Scheme: "http"
          Authority: "link.fubo.tv": -1
          Authority: "link.fubo.tv": -1
          Path: "PatternMatcher{PREFIX: /}"
          Path: "PatternMatcher{PREFIX: /}"
          AutoVerify=true

Edit: Also, can Fubo be added to the Live tab in Google TV? If so you can run adb logcat on that device and see what commands are run when you load the channel from the Live tab.

To some extent you're circling back to what the androidhdmi-for-channels extension (sullrich fork) is really good at, particularly live TV apps that aren't deep-linkable. I use ah4channels everyday, and although the tuning isn't super speedy, it works well for me with the DTV app (no deep link support).

As far as the "adb remote" you're talking about, that's available now for FireTV users, with Amazon's excellent "Fire TV" app which will connect via WiFi to any FireTV device and act as a remote when needed. Much, much better than trying to juggle multiple RF remotes for special navigation.

One other item worth mentioning that ah4channels works well for, is creating custom channels that are tied to special functions. E.G., I have a "channel" that does nothing but force an exit of the DTV app if things go pear-shaped, and another to reboot my FireStick if things go fully off-the-rails. Neither are needed much, but when they are it's great to be able to make those things happen right from the EPG.

I'm using one of the remote control apps from the iOS App Store to control both of my Fire devices plus my Onn box, all of which are connected to HDMI encoders, since they're in a utility room with my networking gear. I have a one-line FFMPEG command which I enter, specifying streamer IP address, duration of recording, and a file name. I then just use the remote app to hit "play" for a piece of content that normally wouldn't be in Channels (using VLC as I navigate the menu). But it would be nice if this could be easily automated within Channels.

I agree with this. ah4channels provides the ability to really get into custom, app-specific commands in ways that I don't anticipate ever supporting in ADBTuner.

At some point I might add some advanced features to customize the am start command, but it won't be sufficient enough to handle "press down 3 times, wait 2 seconds, click play" or things like that and it definitely won't be piping video to ffmpeg.

There is also probably a place for using a computer or a Pi as a "tuner" connected to one of those HDMI devices. With browser automation tools you would have much more control (ex. find button labeled ESPN, click on it). I don't know if that's an extension of ah4channels or something else, but something to think about.

I might need a little more detail to understand exactly what you're doing here, but similar to my response to @Fofer, the ah4channels project has what I think you're talking about. A custom FFMPEG command can be specified for each tuner, and could be tied to a specific item in the EPG to execute it.

@turtletank has done an outstanding job with this project, but my understanding is that he'd like to limit the scope of it to apps that support deep links. This project, and ah4channels can be run side-by-side, and could each control two HDMI inputs on a four-port encoder. They are not mutually exclusive. :wink:

1 Like

I got it!

https://link.fubo.tv/al1%3Fv%3D1%26a%3Dplay%26t%3Dchannel%26channel_id%3D129560

(Where the number on the end is the channel number)

Now to integrate with ADBTuner!

3 Likes

I'll have to check out that project to see if it streamlines what I do. Right now I have a two step process, but it is manual so not ideal:

  1. I enter this command in Terminal on the Mac (I've already installed FFMPEG), for example, if I want to record for 2 hours and ten minutes, from my HDMI encoder at IP address 192.168.7.152, to a file named mymovie.mp4
ffmpeg -t 02:10:00 -i http://192.168.7.152/0.ts mymovie.mp4
  1. I start playing content on the streaming device attached to the encoder with IP address of 192.168.7.15. (Let's say I want to record a movie from Amazon Prime. I remote into the encoder's streaming stick using VLC, start Amazon Prime, find the content, and start playing the content).

It's not an automatic process at all, so I'll definitely check out ah4channels, which I hadn't heard of previously. Where can it be found? I came up empty in a Google search, and it is only mentioned twice in these forums, as best I can tell.

(By the way, if anybody knows how to split my post off to its own topic, feel free to do so. I don't want to sidetrack this great project of @turtletank)

Interesting, it works great for one channel, but when I add another the second one never launches the Fubo app (yet the first one continues to work just fine).

What I could get from the logs:

2023-07-23 21:57:23.626 - lib.adb - ADB: 192.168.5.197 - am start -S -a android.intent.action.VIEW -d " https://link.fubo.tv/al1%3Fv%3D1%26a%3Dplay%26t%3Dchannel%26channel_id%3D726500001" com.fubo.firetv.screen
2023-07-23 21:57:29.207 - server - Tuner: Compatibility Mode - Stream released after 6.14 seconds. Display was on, application (com.fubo.firetv.screen) was closed.
1 Like

ah4channels=androidhdmi-for-channels (sullrich fork) -- ah4channels was just my attempt to differentiate the sullrich fork from the original. As you know, I containerized the original extension, and later the fork. It's become a really capable project, with some impressive features:

and for the Docker container:

https://hub.docker.com/repository/docker/bnhf/androidhdmi-for-channels

I haven't added ffmpeg to the container yet though, but that would be easy enough to do if there's interest. Support for custom transcoding is already in the source, and was being used by @KompilerDJ for the internal capture cards he was using.

I think it's important for users of this project, that mostly came from the original androidhdmi-for-channels, to understand there's a "companion" project that can already address many of the "blue sky" features people are likely to conjure up. Especially now that ADBTuner is addressing the core functionality many were struggling with.

3 Likes

Two step reply here, because you've just described exactly what PlayOn does -- which is also nicely integrated into Channels DVR. PlayOn is flat-out awesome when it comes to static content like you're talking about. I use it with pretty much all of my streaming services. PlayOn recording credits are cheap in bulk, and typically last me quite a while.

With all the fantastic CDVR extensions that have been developed, like this one, it's more important than ever to choose the right tool for the job. :slight_smile:

1 Like

I've used PlayOn Cloud, and even have some credits remaining. I do have some concern with using it now that Netflix is looking for account sharing, as the cloud version will be using a different IP address than I normally use. But that might be unnecessary worry on my part. I do find the Netflix recordings in PlayOn to be solid, but the Disney+ ones weren't the greatest. I'm on a Mac, so unfortunately can't use the desktop version.

Cool, I see there are a bunch, which one are you using? The free "Google Home" is working for me, but the functionality feels a bit buried. What other remote app have you found that works well?

Good points and thanks for the informative replies, it all makes a lot of sense. I'm going to install the docker of ah4channels (sullrich fork) and run it concurrently alongside ADBTuner as described.

True that!

I tried to install using the command listed on linked page, but got this error:

fofer@CDVRServer ~ % docker pull bnhf/androidhdmi-for-channels
Using default tag: latest
Error response from daemon: manifest for bnhf/androidhdmi-for-channels:latest not found: manifest unknown: manifest unknown

Installing via this instead worked fine:

docker pull bnhf/androidhdmi-for-channels:alpha2

This reminded me of an old thread someone posted awhile ago to create a manual Channels recording from terminal. I took that and created a Keyboard Maestro macro that prompted the user for some information about the recording (channel#, duration, title and a bunch of optional parameters) then it creates a json file with that data and commands Channels to start the recording. I tried it on one of my ADBTuner channels and it worked great. I filled in the required fields, clicked ok, then ADBTunder went to work tuning the channel while ChannelsDVR started recording. This could work for deep links in ADBTuner or ah4channels.

The key command to start the recording after you populate the json file is:

curl -XPOST --data-binary @/tmp/CDVRrecording.json http://(ip-of-channels):8089/dvr/jobs/new
1 Like

With great power comes great responsibility :laughing:, i.e. you need a lot more than that:

version: '3.9'
services:
  androidhdmi-for-channels:
    image: bnhf/androidhdmi-for-channels:alpha2
    container_name: ah4channels-alpha
    hostname: ah4channels
    dns_search: localdomain # Specify the name of your LAN's domain, usually local or localdomain
    ports:
      - 5037:5037 # Port used by adb-server
      - 7654:7654 # Port used by this androidhdmi-for-channels proxy
    environment:
      - IPADDRESS=${IPADDRESS} # Hostname or IP address of this androidhdmi-for-channels extension to be used in M3U file (also add port number if not in M3U)
      - NUMBER_TUNERS=${NUMBER_TUNERS} # Number of tuners you'd like defined 1, 2, 3 or 4 supported
      - TUNER1_IP=${TUNER1_IP} # Streaming device #1 with adb port in the form hostname:port or ip:port
      - TUNER2_IP=${TUNER2_IP} # Streaming device #2 with adb port in the form hostname:port or ip:port
      - TUNER3_IP=${TUNER3_IP} # Streaming device #3 with adb port in the form hostname:port or ip:port
      - TUNER4_IP=${TUNER4_IP} # Streaming device #4 with adb port in the form hostname:port or ip:port
      - ENCODER1_URL=${ENCODER1_URL} # Full URL for tuner #1 in the form http://hostname/stream or http://ip/stream
      - ENCODER2_URL=${ENCODER2_URL} # Full URL for tuner #2 in the form http://hostname/stream or http://ip/stream
      - ENCODER3_URL=${ENCODER3_URL} # Full URL for tuner #3 in the form http://hostname/stream or http://ip/stream
      - ENCODER4_URL=${ENCODER4_URL} # Full URL for tuner #4 in the form http://hostname/stream or http://ip/stream
      - STREAMER_APP=${STREAMER_APP} # Streaming device name and streaming app you're using in the form scripts/streamer/app (use lowercase with slashes between as shown)
      - CHANNELSIP=${CHANNELSIP} # Hostname or IP address of the Channels DVR server itself
      #- ALERT_SMTP_SERVER="smtp.gmail.com:587"
      #- ALERT_AUTH_SERVER="smtp.gmail.com"
      #- ALERT_EMAIL_FROM=""
      #- ALERT_EMAIL_PASS=""
      #- ALERT_EMAIL_TO=""
      #- ALERT_WEBHOOK_URL=""
    volumes:
      - /data/androidhdmi-for-channels/scripts:/opt/scripts # pre/stop/bmitune.sh scripts will be stored in this bound host directory under streamer/app
      - /data/androidhdmi-for-channels/m3u:/opt/m3u # m3u files will be stored here and hosted at http://<hostname or ip>:7654/m3u for use in Channels DVR - Custom Channels settings
      - /data/androidhdmi-for-channels/adb:/root/.android # Persistent data directory for adb keys
    restart: unless-stopped

Portainer is your friend here...

Can we maybe move the android-hdmi troubleshooting to that thread?

It’s absolutely cool to discuss that and other projects here, just don’t want confusion with docker-compose files and such.

Yes, absolutely.

I have the URay encoder as a second tuner and I have audio sync issues, even after using the suggested settings. I have ordered two J-Tech HD enconders (https://www.amazon.com/gp/product/B0761X6L3C/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1) the first one is perfect, no sync issues, CPU is around 70% when encoding. On the second unit I purchased the CPU was constantly over 100% and the image stuttered.

I just bought the Exvist H265 video encoder and wanted to know if i neded some specific settings.
The tuner i'm using is an ONN 4k.
I have it all setup just want to make sure picture is good on my 55 In tv etc.
Any settings would be good to know.
Assistance appreciated.