HDMI for Channels

Thanks for the ideas everybody, I'm trying again with a clearer head. Inching closer and closer to getting it working! I started over from scratch, edited all the files as discussed above, built the app again, and ran only the new one. Now I'm not getting that same "connection refused" error on CDVR client interface, it's actually tuning into the HDMI output (!)

But it's still not changing the channel to MSNBC :-/

I checked the file permissions (see screenshot, I also clicked the gear menu to "apply to enclosed items...") and also ran chmod +x on (all three) .sh files.

I can confirm the app is now referencing the proper location of the executable at /Volumes/Channels-DVR/androidhdmi-for-channels/prebmituneb.sh instead of /opt/opendct -- but it is still giving the error "Failed to run pre script: fork/exec /Volumes/Channels-DVR/androidhdmi-for-channels/prebmituneb.sh: no such file or directory"

Thanks, you may be on to something there. When I try that command I get this "not found" response. Even though androidhdmi-for-channels is definitely running, as I can see activity in the separate Terminal window when I try to tune in and out of MSNBCvia the CDVR client?

My M3U is:

#EXTM3U

#EXTINF:-1 channel-id="msnbc" channel-number="100.1" tvc-guide-placeholders="86400", MSNBC
http://10.0.1.21:7654/play/tuner/msnbc

and my bmitune.sh is this:

#!/bin/bash
HOME="input keyevent KEYCODE_HOME; sleep 1"
PRIME1="input keyevent 19 19 19 19; sleep 1; input keyevent 21 21 21; sleep 1; input keyevent 22; sleep 1; input keyevent 23; sleep 1"
PRIME2="input keyevent 19; sleep 1"
PRIME3="input keyevent --longpress 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67"
SEARCH1="input keyevent 66; sleep 2"
SEARCH2="input keyevent 66"

#MSNBC
if [ $1 = "136" ];then
adb shell $HOME
adb shell $PRIME1
adb shell $PRIME2
#adb shell $PRIME3 
adb shell input text "stream\ msnbc\ on\ YouTube\ TV"
adb shell $SEARCH1
adb shell $SEARCH2
fi

Any other guesses or clues appreciated.

change "tuneb.sh" to "tune.sh"

Not sure if these channel IDs are universal, per account, or if they change often, but this works for Hulu Live.

Tune ESPN on Hulu Live via adb

adb shell am start -a hulu.intent.action.PLAY_CONTENT -e content_id "espn-13978f5d-e315-41aa-97ad-040b890304bc" -n com.hulu.livingroomplus/.WKFactivity

Edit: See later post for issue with the player starting at the beginning of recorded programs instead of live. HDMI for Channels - #131 by turtletank

1 Like

OMG, good catch, can't believe I missed that. OK so I changed those. Quit and deleted the old app, rebuilt new app, tried again. Now, no more errors in Terminal, great! One step closer...

I added all of the NBCU channels into my bmitune.sh file, matching their channel numbers from my HDMI Custom Channel source. Unfortunately the macro / sequence of keystrokes didn't match up on this device's interface. So I re-read this thread and went back to try different methods to control this device. The search command didn't seem to work either. But the start -a android.intent.action.VIEW command did, after I edited each URL with the matching video_id from the desired channels. So here is what's working for me, on a HD Chromecast with GoogleTV dongle:

bmitune.sh:

#!/bin/bash
HOME="input keyevent KEYCODE_HOME; sleep 1"
PRIME1="input keyevent 19 19 19 19; sleep 1; input keyevent 21 21 21; sleep 1; input keyevent 22; sleep 1; input keyevent 23; sleep 1"
PRIME2="input keyevent 19; sleep 1"
PRIME3="input keyevent --longpress 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67"
SEARCH1="input keyevent 66; sleep 2"
SEARCH2="input keyevent 66"

#MSNBC
if [ $1 = "100" ];then
HOME="input keyevent KEYCODE_HOME; sleep 1"
adb shell am start -a android.intent.action.VIEW -d https://tv.youtube.com/watch/q6bWEVqhP8o?onboard=1 -n com.google.android.youtube.tvunplugged/com.google.android.apps.youtube.tvunplugged.activity.MainActivity
fi

#E!
if [ $1 = "101" ];then
HOME="input keyevent KEYCODE_HOME; sleep 1"
adb shell am start -a android.intent.action.VIEW -d https://tv.youtube.com/watch/ILTrUfLFrHI?onboard=1 -n com.google.android.youtube.tvunplugged/com.google.android.apps.youtube.tvunplugged.activity.MainActivity
fi

#Bravo
if [ $1 = "102" ];then
HOME="input keyevent KEYCODE_HOME; sleep 1"
adb shell am start -a android.intent.action.VIEW -d https://tv.youtube.com/watch/xNk2Sv4t4Tc?onboard=1 -n com.google.android.youtube.tvunplugged/com.google.android.apps.youtube.tvunplugged.activity.MainActivity
fi

#Oxygen
if [ $1 = "103" ];then
HOME="input keyevent KEYCODE_HOME; sleep 1"
adb shell am start -a android.intent.action.VIEW -d https://tv.youtube.com/watch/v4upAc0UExk?onboard=1 -n com.google.android.youtube.tvunplugged/com.google.android.apps.youtube.tvunplugged.activity.MainActivity
fi

#USA
if [ $1 = "104" ];then
HOME="input keyevent KEYCODE_HOME; sleep 1"
adb shell am start -a android.intent.action.VIEW -d https://tv.youtube.com/watch/DJ7m0fdLKEY?onboard=1 -n com.google.android.youtube.tvunplugged/com.google.android.apps.youtube.tvunplugged.activity.MainActivity
fi

#SYFY
if [ $1 = "105" ];then
HOME="input keyevent KEYCODE_HOME; sleep 1"
adb shell am start -a android.intent.action.VIEW -d https://tv.youtube.com/watch/2_WogcoZ1cY?onboard=1 -n com.google.android.youtube.tvunplugged/com.google.android.apps.youtube.tvunplugged.activity.MainActivity
fi

#CNBC
if [ $1 = "106" ];then
HOME="input keyevent KEYCODE_HOME; sleep 1"
adb shell am start -a android.intent.action.VIEW -d https://tv.youtube.com/watch/GIBoX-XF5i0?onboard=1 -n com.google.android.youtube.tvunplugged/com.google.android.apps.youtube.tvunplugged.activity.MainActivity
fi

#Golf
if [ $1 = "107" ];then
HOME="input keyevent KEYCODE_HOME; sleep 1"
adb shell am start -a android.intent.action.VIEW -d https://tv.youtube.com/watch/XK34g7QRvGk?onboard=1 -n com.google.android.youtube.tvunplugged/com.google.android.apps.youtube.tvunplugged.activity.MainActivity
fi

And I can confirm that I'm able to manually run ./bmitune.sh 100 through ./bmitune.sh 107 and I now see that it changes what's streaming via YTTV on the HDMI output over to the expected channel. This is excellent!

My last hurdle is how to link these particular channels properly in the M3U, because when I try to tune in via the guide in the Channels client, I get the error that "The connection to the HDHomeRun was lost. Press play to try again." What should this text be changed to, if anything?

I think I need to get the ./bmitune.sh msnbc command working, at least the same way the ./bmitune.sh 100 command works when I invoke it manually, but that's the final piece that's stumping me.

3 Likes

The $1 in bmitune.sh represents the last parameter in your m3u url.

Since you have MSNBC as [ $1 = "100" ] your url in the m3u file would need to be http://x.x.x.x:7654/play/tuner/100

I used readable strings in my config instead of numbers to make it easier to configure.

if [ $1 = "espn" ];then
...
fi
4 Likes

I will double check when I get home, but I think for each channel in you m3u you should be doing something like this for the link (with the appropriate numbers for each channel:

http://10.0.1.21/7654/play/tuner/101

What comes at the end of link is the call that the androidhdmi program makes to your bmitune.sh script. If you want to use the name of the channels (msnbc, usa, etc) you would have to change the input the script is looking for from the channels numbers you have to the name of the channels. So that bmitune.sh would have msnbc as follows:

if [ $ 1= "msnbc" ]; then
1 Like

Yep, that did it, thanks so much for filling in the missing piece. I'm tuning between these 7 channels now via the guide on my AppleTV and adb commands to YTTV on the AndroidTV dongle. And thanks to everyone else's feedback too! I'm really grateful to have gotten this going, with your help it's all making a lot more sense to me now.

This feels like a great option to deal with the loss of NBCU TVE. I have a 2nd HDMI encoder I'll probably bring into the mix in the next week or two. Of course that means I'll need a 2nd dongle now too... too bad I gave away the extra I had last year. lol

2 Likes

That works on my hulu live account, thought it is different from the conten_id on my account when I look at espn.
The content_id found by selecting the channel from within the guide and then copying it from the address bar, right?

1 Like

Yeah, that’s how I found the content id. That id has since changed multiple times for me. Perhaps it’s related to the content that is currently live? So far the original id still works though.

I ran into a very annoying issue. If the program that is currently live is also being recorded (via Hulu) it will start at the beginning. So far I haven’t found a great way to get the stream to “jump to live.”

I currently have the following in place. The UI is really slow so the script has to constantly pause to give the app enough time to get to the correct location.

The idea is to pause, click right, and then click the “Watch Live” button. However, if you are already live that button is disabled and clicking it does nothing. So I have to wait 30 seconds for the stream to fall behind the live broadcast before clicking the button.

Current working version (very slow):

CLOSE_HULU="input keyevent KEYCODE_HOME; am force-stop com.hulu.livingroomplus; sleep 5;"
GO_TO_LIVE="sleep 20; input keyevent 85; sleep 2; input keyevent 22; sleep 30; input keyevent 66"

if [ $1 = "espnhulu" ];then
adb shell $CLOSE_HULU
adb shell am start -a hulu.intent.action.PLAY_CONTENT -e content_id "espn-13978f5d-e315-41aa-97ad-040b890304bc" -n com.hulu.livingroomplus/.WKFactivity
adb shell $GO_TO_LIVE
fi

On this $20 onn brand streaming device I’m currently looking at a full minute to reliably tune the channel and fast forward to live. That’s not ok.

Hopefully we can find something better. Hulu has no voice commands for live tv so that’s out.

Side note: As of today, the onn brand 4k streamer from Walmart is limited to 30fps video in Hulu Live.

1 Like

I’ve been watching this thread with great interest, although as a non-programmer (but avid tinkerer) it is beyond my abilities. Does this look like it is headed in the direction where, some day, there will be a way for someone who is willing to tinker and to follow along with instructions (“buy this encoder, buy these streaming sticks, install this, configure it like this, etc.”) to get a functional setup working and feeding in Channels DVR?

3 Likes

This thread is only 10 days old. I’m not a programmer either, just a tinkerer, but I follow instructions well, and was successful. So I’d say the answer is yes.

2 Likes

I am not a programmer either. All I know “if then” commands. This is why the script is so basic. I am leaving it to the programmers to come up with things more elegant and efficient.

In other words just dive in and ask questions man.

4 Likes

I’m showing the Onn 4K linked as sold out in my area.

Anyone know if it needs to be Android TV or does Google TV work. Is it just a rebrand?

Would this one work?
https://www.walmart.com/ip/onn-Google-TV-4K-Streaming-Box-New-2023-4K-UHD-resolution/2835618394?athbdg=L1102&from=/search

1 Like

onn Google TV is the new version. It works the same

2 Likes

I've changed the bmitune.sh script for hulu live users. You can populate a contentid.txt file with the channelname and content_id of channel and the script will read it in when called with a http://ipaddress:7564/play/tuner/channelname

#!/bin/bash

content_file="contentid.txt"
content_id=""

# Read content_id from file
if [ -f "$content_file" ]; then
  content_id=$(grep -w "^$1" "$content_file" | cut -d " " -f 2)
fi

# Check if content_id is empty
if [ -z "$content_id" ]; then
  echo "Invalid option or content_id not found in $content_file"
  exit 1
fi

adb -s x.x.x.x shell am start -a hulu.intent.action.PLAY_CONTENT -e content_id "$content_id" -n com.hulu.livingroomplus/.WKFactivity

contentid.txt file would look like this:

syfy syfy-07fb8004-d9af-43fe-8f7c-811cf3b7e0b0
espn espn-13978f5d-e315-41aa-97ad-040b890304bc
motortrend motortrend-b41b0d7e-58e2-4a5e-bf1b-1f4d19eab44c

1 Like

Anybody have any recommendations for a HDMI encoder other than the FB100? I see other video encoders that are cheaper than the FB100 but I'm concerned that they will perform poorly as far as picture/audio quality.

I've been happy with this guy. Under 100 bucks with the coupon.
https://a.co/d/09eNPaP

2 Likes

This one (JTECH-ENCH4) has been working well for me:
https://www.amazon.com/dp/B0761X6L3C

I have a "LinkPi ENC1V2" device coming this week, I will share some info here afterwards. Based on the specs it looks really promising for ~$120.

Since I have a Cable card, I am using HDMI in to record DRM working great. Can also Capture CC if I turn them on the input device ... I'm using nextpvr thanks to nextpvr support as a backend to control Channel change on my 4 input capture device and supply the Stream through M3U. Sill a work in progress but is very stable.

1 Like

@Fofer thanks for posting you troubleshooting here. I just got my encoder up and running in Channels and your posts and the posts from @tmm1 @boukmandutty and @turtletank were a tremendous help.

Thanks all!

3 Likes