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

Funny, in the whole USB HDMI Capture thread, that never came up. I made those changes, but still no go in VLC. Using OBS, I can see the firestick home page.

When I try to watch the USB HDMI channel in CDVR, the error message is that it can't find the audio device. I used the directions in the other thread to find the device names, so I thought it was right. Maybe not...

OK, so that tells us that this has nothing to do with ah4c...

My guess is the problem now has to do with what you're using as your virtual encoder URL. Looking at the ENCODER1_URL you used (from one of your original screenshots), there's no "channel number" in the URL.

The more recent screenshot you posted cuts off any channel number you may have assigned. If you didn't assign one (I used 9550 as in the tmm1 example), I'd suggest you do -- otherwise you'll need to figure out what channel Channels assigned, to use in the virtual encoder URL:

http://convertible-pc3:8089/devices/M3U-Capture/channels/9550/stream.mpg?format=ts&codec=copy

It's certainly possible I'm doing something here-or-there that's not required, however one can't really argue with success. I had the whole thing up-and-running in maybe 20 minutes.

Well, I'll keep plugging away and, as always, thanks for your help!

If nothing else, at least we now know that it does work with a capture card and a firestick!

@daldana7296 In fact, as I look more closely at what you used for ENCODER1_URL, it's not even a stream, it's an M3U. Get that sorted out, and I bet you'll be good-to-go.

Could you tell me what you used for yours? The other thread seemed to indicate that I should copy the source M3U and use it for the encoder. I must have misunderstood it.

http://convertible-pc3:8089/devices/M3U-Capture/channels/9550/stream.mpg?format=ts&codec=copy

Your hostname or IP would be different, and the channel number could be different if you didn't assign 9550 as the starting channel number in the "first source".

Yup, this time I got good interaction with ah4c, still no video though. But that should come when I figure out the correct parameters for the usb hdmi capture source.

I got this from the ffmpeg command:

C:\Users\The Slayer>C:\ProgramData\ChannelsDVR\latest\ffmpeg.exe -list_devices true -f dshow -i dummy
[dshow @ 00000290538fc340] "HP True Vision 5MP Camera" (video)
[dshow @ 00000290538fc340]   Alternative name "@device_pnp_\\?\display#int3480#4&2ff580f2&0&uid144512#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\{bd89b7f2-631c-44fb-a505-17ef8b0e2c53}"
[dshow @ 00000290538fc340] "USB Video" (video)
[dshow @ 00000290538fc340]   Alternative name "@device_pnp_\\?\usb#vid_534d&pid_2109&mi_00#6&a5cfd33&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global"
[dshow @ 00000290538fc340] "OBS Virtual Camera" (none)
[dshow @ 00000290538fc340]   Alternative name "@device_sw_{860BB310-5D01-11D0-BD3B-00A0C911CE86}\{A3FCE0F5-3493-419F-958A-ABA1250EC20B}"
[dshow @ 00000290538fc340] "Digital Audio Interface (USB Digital Audio)" (audio)
[dshow @ 00000290538fc340]   Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{FDDC2AA2-2E10-42A9-983A-B4DFB4ABC200}"
[dshow @ 00000290538fc340] "Microphone Array (Intel® Smart Sound Technology for Digital Microphones)" (audio)
[dshow @ 00000290538fc340]   Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{7357ED10-CFE2-446B-85AA-24412DFF130A}"
[in#0 @ 00000290538de5c0] Error opening input: Immediate exit requested
Error opening input file dummy.

And then, with the two devices chosen and URL encoded, I used this:

capture://dshow/USB%20Video/Digital%20Audio%20Interface%20%28USB%20Digital%20Audio%29/?framerate=60

Maybe the URL encoding is not required by Channels DVR, but it doesn't hurt anything -- and it's always the safest option.

@mackid1993 What was your final opinion on those Elgato Cam Link 4K Capture Cards? It seems pretty clear to me that these $10-$20 cards are not the answer, but I'd prefer not to buy a $200+ card and still need to encode.

If I could find a capture card that's HDMI 2.0+ and HDR compatible, and the typical streaming stick will recognize for 4K capture -- that could be worth taking for a spin. And, it would be a nice differentiator from the network encoders, none of which seem to be able to deal with the HDCP required for 4K -- not to mention HDR (however, that can be turned off on FireSticks).

I recommend not buying them unless you have access to USB 3.0.

On my LinkPi units with USB 2.0, they would hit 60fps 1080p but would freeze up occasionally, particularly when I put my Osprey boxes to sleep.

They were really meant for USB 3.0 and I think they were pushing the limits of what USB 2.0 could do.

I ended up selling mine just to recoup some money and just getting and ENC5-V2.

You can find them on eBay, though.

1 Like

I'm using FFmpeg and the PC's iGPU to mimic what LinkPi does for the USB capture cards.

  • HTTP MPEG-TS Streaming: Serves raw MPEG-TS video over HTTP (/stream/{id}), giving a local capture card the exact same network URL interface as a physical LinkPi encoder.

  • Real-Time Hardware Encoding: Uses your PC's GPU (NVENC, QSV, or AMF) to compress raw HDMI capture data on the fly, replacing the dedicated encoder chip inside a LinkPi.

  • Signal Normalization: Applies standard broadcast color tagging (BT.709), AAC 48 kHz audio, and a fixed 10 Mbps mux rate to standardize raw capture feeds into clean streams.

  • Auto-Detection & Probing: Probes DirectShow devices to automatically pick the highest resolution and framerate (e.g., 1080p60), mimicking hardware HDMI handshaking.

  • Deinterlacing & Lip-Sync: Applies bwdif deinterlacing for broadcast signals and adelay for audio offset correction, mirroring standard encoder firmware settings.

2 Likes

Very cool. Sounds like the answer for Windows users that want to do this on the cheap. The quality of the captured video I saw today from a $10 card seemed only OK though. Definitely not on par with what the LinkPi or URayCoder produce, particularly with sports. Maybe with a slightly better card, and your solution, all would be well. :slight_smile:

It is so dependent on a good card. 1080/60 is a must for any live action. The larger ones seem to handle the heat better than the stick style capture devices do.

2 Likes

Hello,

I'm a new linux user and have been trying to deploy ah4c on a linux zorin core pc. I am running the latest bnhf/ah4c container on an x86 Linux host acting as an ADB network bridge for Channels DVR (hosted on a separate local server).

The container successfully establishes an ADB handshake with my Firestick 4K (192.168.1.32:5555), passes the security authorization check, and correctly serves the M3U mapping layout. However, whenever a live tuning request is initiated by Channels DVR, the execution engine crashes with a generic 500 Internal Server Error during the pre-script phase.
My Portainer Stack Configuration:
version: '3.9'
services:
ah4c:
image: bnhf/ah4c:latest
container_name: ah4c
restart: unless-stopped
ports:
- "7654:7654"
- "8080:8000"
environment:
IPADDRESS: "192.168.1.124:7654"
NUMBER_TUNERS: "1"
TUNER1_IP: "192.168.1.32:5555"
ENCODER1_URL: "http://192.168.1"
CHANNELSIP: "192.168.1.152"
STREAMER_APP: "firetv/youtubetv"
UPDATE_SCRIPTS: "true"
UPDATE_M3US: "false"
PLAY_PATH: "tuner"
volumes:
- ah4c_m3u:/opt/m3u
- ah4c_scripts:/opt/scripts

volumes:
ah4c_m3u:
ah4c_scripts:

The Active Container Log Error:
Attempting network tune for device http://192.168.1 192.168.1.32:5555 q6bWEVqhP8o
[EXECUTE] Running [./firetv/youtubetv/prebmitune.sh 192.168.1.32:5555 q6bWEVqhP8o]
[EXECUTE] Stdout: ''
[EXECUTE] Stderr: ''
[EXECUTE] Finished running ./firetv/youtubetv/prebmitune.sh in 473.315µs
[ERR] Failed to run pre script: fork/exec ./firetv/youtubetv/prebmitune.sh: no such file or directory 192.168.1.32:5555
[ERR] Failed to tune device(s) not available
[GIN-debug] Request: 192.168.1.152 GET /play/tuner/q6bWEVqhP8o, latency: 625.876µs, status: 500

The volume mounts are isolated inside native named Docker volumes. I have verified the pathing, but the fork/exec continues to fail. Any insights on what is preventing the binary engine from executing the shell script layout would be greatly appreciated. Thank you!

scripts/firetv/youtubetv

try that

also confirm your bind mounts are correct. it looks like you aren't using the recommended compose and .env

1 Like

Got my usb hdmi capture parameters corrected (it was a typing error) and everything works now. I have both ah4c and @Bobby_Vaughn's Windows ADB project running on the same machine (AMD Ryzen 5 3600 with an RX 580 video card, 16GB RAM). I'm happy they don't conflict with each other. I'm using this capture card, Amazon.com: Capture Card, 4K HDMI Video Capture Card, Game Capture Card, 1080P 60FPS Video Capture Device, HDMI to USB 3.0 Capture Card for Streaming, Work with Camera/Xbox/PS4/PS5/PC/OBS : Electronics, with a Fire stick.

I only have the Directv channels (satellite, not streaming) and both projects are very comparable to each other. Both fully tune ESPN HD in around 24 seconds (by fully tune, I mean to an actual video playing, not the DTV splash screen), and both are 1080p resolution. The ah4c project shows a framerate of 60 while the Windows project shows 30. I'm quite satisfied with the PQ of both. GPU usage was around 75% for either app. I might try moving the setup to an Intel machine to see if there are any major differences, but we'll see.

So IMHO, I would say if you're not comfortable with Docker for Windows, use the Windows ADB Project; if you like Docker containers, use ah4c. I don't think you'll be dissatisfied with either one.

Definitely not the correct Docker Compose. I posted it recently here, plus it's in the usual master Docker Compose thread:

EDIT: Also, be aware nobody has created the necessary scripts to go in scripts/firetv/youtubetv. If your Bash scripting skills are reasonable, it shouldn't be difficult to create them. If not, you should probably look at the ADBTuner project.

hi again and thx for the reply. I'm stuck at this point now - I migrated my ah4c stack completely over to a Zorin PC bridge using the recommended Compose and .env properties layout with local bind mounts. The fork/exec path errors are completely gone, and the container is actively copying stream bytes back to Channels DVR.*

However, when tuning initiates, the Firestick opens the YouTube TV application (com.amazon.firetv.youtube.tv) but freezes entirely on the main YTTV home screen instead of loading the channel ID layout. What extra parameters or timing delays are required in the bmitune.sh file to get the Amazon Cobalt app wrapper to catch the deep-link stream intent?" thx!

Go ahead and post what you've written so far for prebmitune.sh, bmitune.sh and stopbmitune.sh. Also, post the M3U file you're using, and we'll see if we can nudge you in the right direction.

I used the prebmitune and stopbmitune from the /scripts/mecool/youtubetv and modified the bmitune from:
#!/bin/bash
#bmitune.sh for android/yttv
ADB_CMD="adb -s $2 shell"
CHANNEL=""$1""
APP_LAUNCH="com.google.android.youtube.tvunplugged"
APP_NAME="com.google.android.apps.youtube.tvunplugged.activity.MainActivity"

#Send the command
$ADB_CMD am start -a android.intent.action.VIEW -d https://tv.youtube.com/watch/$CHANNEL -n $APP_LAUNCH/$APP_NAME

To:

#!/bin/bash
#bmitune.sh for android/yttv
ADB_CMD="adb -s $2 shell"
CHANNEL=""$1""
APP_LAUNCH="com.amazon.firetv.youtube.tv"
APP_NAME="dev.cobalt.app.MainActivity"

#Send the command
$ADB_CMD am start -a android.intent.action.VIEW -d https://tv.youtube.com/watch/$CHANNEL -n $APP_LAUNCH/$APP_NAME