HDMI for Channels

Maybe it depends on which encoder you purchase, but with the URayCoder H.265 I bought, I can monitor what's coming into to the encoder right from the same built-in webserver that's used for configuration.

Given the experimental nature of this Channels extension and active development going on, futzing around at this stage is unavoidable. There are really two aspects of a stream capture to consider, which are what streaming device do you want to use and what app do you want to run.

Capturing the output from a streaming device like the FireTV is the easy part, controlling a particular app for live tv with reliable channel changes is where the challenge lies. What app are you hoping to use?

Alrighty then, here's the latest update to the Docker container for this project!

Support has been added to pass the streaming device's adb hostname:port or ip:port to the scripts, so you'll no longer need individual scripts for each tuner.

Also, the scripts are being organized under /opt/scripts/streamer/app, where streamer/app is the type of streaming device followed by the streaming app name. For example onn/yttv, chromecast/hulu or firetv/directv. The current sample scripts will be under sample/yttv.

There are some new and changed environment variables, so make sure you update your compose in Portainer - Stacks accordingly when you pull the new image:

version: '3.9'
services:
  androidhdmi-for-channels:
    image: bnhf/androidhdmi-for-channels:latest
    container_name: androidhdmi-for-channels
    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 Channels androidhdmi-for-channels proxy
    environment:
#      - ADB_DEVICES=${ADB_DEVICES} # Space separated list of adb devices to control in the form hostname:port or ip:port
      - TUNERS=${TUNERS} # Number of tuners you'd like defined 1, 2, 3 or 4 supported
      - STREAMER1_HOST=${STREAMER1_HOST} # Streaming device #1 with adb port in the form hostname:port or ip:port
      - STREAMER2_HOST=${STREAMER2_HOST} # Streaming device #2 with adb port in the form hostname:port or ip:port
      - STREAMER3_HOST=${STREAMER3_HOST} # Streaming device #3 with adb port in the form hostname:port or ip:port
      - STREAMER4_HOST=${STREAMER4_HOST} # Streaming device #4 with adb port in the form hostname:port or ip:port
      - TUNER1_URL=${TUNER1_URL} # Full URL for tuner #1 in the form http://hostname/stream or http://ip/stream
      - TUNER2_URL=${TUNER2_URL} # Full URL for tuner #2 in the form http://hostname/stream or http://ip/stream
      - TUNER3_URL=${TUNER3_URL} # Full URL for tuner #3 in the form http://hostname/stream or http://ip/stream
      - TUNER4_URL=${TUNER4_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 streamer/app (use lowercase with slash between as shown)
    volumes:
      - /data/androidhdmi-for-channels:/opt/scripts # pre/stop/bmitune.sh scripts will be stored in this bound host directory under streamer/app
      - /data/adb:/root/.android # Persistent data directory for adb keys
    restart: unless-stopped

Your Portainer - Stacks should look similar to this:

You'll want to update your scripts to take advantage of "$1" in the pre/stop scripts, and "$2" in the start script. These are the STREAMERx_HOST values for each virtual tuner.

It'd be nice for those that are trying to get going with this extension to be able to start with script samples for whatever combination of streamer/app that you're using. So even if your script isn't perfect yet, by getting it bundled with the container it'll be a better starting point than the current samples.

EDIT: Added a bound directory for the adb data to make adb connections persistent across container deployments.

Can this be some how implimented using MY HDMI Encoder. My computer has a 2nd HDMI and would like to stream that output from the computer but impliment the URL's to the Browser. I I see is for androd but not by way of Windows Computer and Web Browser. I don't how to impliment the URL's to start the streams.

1 Like

Oh wow, this is very exciting. Thanks for this! I’m headed out for another trip but when I am back I will convert my setup (Chromecast+Onn, both using YTTV) to the docker. On my Mac mini that is running CDVR server I am using Docker Desktop. And on a Raspberry Pi 4+ I have Portainer, with Home Assistant and Scrypted. Would either one be better than the other for this? I’m leaning towards the Mac, but would appreciate your feedback. And thanks again for putting this together.

Good question. I guess the beauty of Docker is that it's super easy to spin-up a container on both, and see which you like better. Not sure how much horsepower is required for the ah4channels proxy, so that could factor in.

It definitely does. In the case of my FMUser encoders, there is a preview thumbnail but it relies on a VLC plugin that doesn’t seem to work in any browser I tried. On Mac, at least.

The FMuser boxes also don’t have any online support, no way to update firmware, etc. Then again, I wanted dual tuners and didn’t want to spend more, so I’m glad I was able to get these used ones for cheap.

I was able to power 4 Firesticks with the hub just have to get some right angle short usb cords ..The Firesticks were too close together so had to use the HDMI adapters that came with the Sticks.

@Edwin_Perez Thanks for letting me know the hub works with 4 sticks -- I'll be headed in that direction soon myself. :slight_smile: So it didn't work to have two sticks with right angle up adapters and two plugged straight in without extensions? Seems like there'd be room...

1 Like

Yeah you were right did not need the HDMI corded Adapters. I am also going to try that USB 5V to 12V adapter to see If I can avoid using the brick on the encoder.

If you haven't done so already, you could try contacting support and letting them know you're looking for the latest firmware for a specific unit. This is how I did it with the Uray encoder. Uray responded in less than 24 hours with a download link. I then proceeded to inquire about a special firmware with 5.1 channel support but was denied.

special 5.1 firmware? what do you know of this if you do not mind me asking?

Did you program the new firmware into the encoder? I also got a download link to the file "up.bin" but there's no version info. or release notes - I saved it but haven't used it yet. When I downloaded a backup of the current URaycoder firmware, Windows said it contained a virus - FYI.

Edit: I had firmware 1.71-L55M-U (with Virus) I scanned the new file and it was clean - I performed the update an am now at 1.74-L55M-U

Tonight we are landing some great improvements to my firetv-hulu-hdmi repo GitHub - sullrich/androidhdmi-for-channels: androidhdmi-for-channels :

  • When using multi tuners if the pre script fails it will continue to try the remaining tuners
  • Added a getting started guide that focuses on firetv-hulu-channels-hdmi

Question: would this be useful if I started a specific thread in hacks for firefly-hulu-channels-hdmi? This thread is getting a bit large?

Yes please. And thank you!

I am going to try USB ADB debugging using this HUB later on connected to my Channels DVR Server. To see how the response is Instead of wireless ADB debugging. Just curious to see if it even works ... I am a Tinkerer.

BTW that usb to 12 v Adapter powered my 4 Input Encoder so took off the brick.

I'm amazed. That hub has got to be delivering more than the USB3 standard 1.5 amps per port. Not complaining of course. What's the listed amp requirement of your encoder @ 12V?

12 V 2A

MY PC after a reboot picked the ADB devices Via USB .(serial #s) ... So I am going to setup USB ADB and not have to worry about IP's on my devices,

Just corrected the USB3 spec number to 1.5A, so that's 7.5W -- which is a long way from the 24W your encoder says it could need. Probably worth a test run to be sure encoding 4 simultaneous streams isn't going to ruin recordings you care about. PoE+ (30W) would be a safer bet, if you have it as an option.

EDIT: And to further muddy the waters, 1.5A is supposed to be for dedicated USB3 charging devices -- .9A was correct for standard devices, so 4.5W for certified products (which maybe this hub isn't given the language mix printed on it). I'll put a USB power meter on it when I get a chance.

Anyone in here using a hauppauge colossus 2 or hdpvr 2 in linux? I am trying to test something to get video feed into Channels. I made some headway but my scripting skill are limited to inelegant brute force.

I experimented a bit with a USB HDMI adapter on OSX.

The issue with most of those is they capture a raw stream which is huge, so you have to use ffmpeg to re-encode it. Here's a simple way to pipe that into Channels DVR:

#EXTM3U
#EXTINF:-1 channel-id="hdpvr2", HDPVR
udp://127.0.0.1:33444

Then run:

ffmpeg -i /dev/video0 -c:v h264 -b:v 8000k -f mpegts udp://127.0.0.1:33444

Which should pull the video feed from the capture device, encode the video at 8mbps, then send it to port 33444 where the DVR is listening for video data.

On Linux you can use /dev/videoX like above

On macOS the video capture happens via avfoundation, which ffmpeg also supports. To see a list of capture devices:

$ ffmpeg -hide_banner -f avfoundation -list_devices 1 -i /dev/null
[AVFoundation indev @ 0x14ee04e10] AVFoundation video devices:
[AVFoundation indev @ 0x14ee04e10] [0] Studio Display Camera
[AVFoundation indev @ 0x14ee04e10] [1] Elgato Virtual Camera
[AVFoundation indev @ 0x14ee04e10] [2] Cam Link 4K
[AVFoundation indev @ 0x14ee04e10] [3] iphone Camera
[AVFoundation indev @ 0x14ee04e10] [4] Capture screen 0

You can see "Cam Link 4K" is marked as [2]. You can use that as so:

ffmpeg -f avfoundation -framerate 60 -i "2" -c:v h264_videotoolbox -b:v 8000k udp://127.0.0.1:33444

1 Like