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

C:\Windows\System32>docker logs f166 --details --since=15m
2024-01-22 22:46:53.714 - server - Setting unique m3u id: 46857547987720174055886310626649471755
2024-01-22 22:46:53.740 - uvicorn.access - 172.17.0.1:43058 - "POST /admin/channel HTTP/1.1" 303
2024-01-22 22:46:53.747 - uvicorn.access - 172.17.0.1:43058 - "GET / HTTP/1.1" 200
2024-01-22 22:46:53.758 - uvicorn.access - 172.17.0.1:43058 - "GET /css/style.css?t=1705963613 HTTP/1.1" 200
2024-01-22 22:46:53.759 - uvicorn.access - 172.17.0.1:43062 - "GET /js/main.js?t=1705963613 HTTP/1.1" 200
2024-01-22 22:46:53.797 - lib.adb - ADB: Connecting to device (attempt 1).
2024-01-22 22:46:53.801 - lib.adb - ADB: Connecting to device (attempt 1).
2024-01-22 22:46:53.953 - lib.adb - ADB: Connected.
2024-01-22 22:46:53.954 - lib.adb - ADB: 192.168.42.157 - dumpsys display
2024-01-22 22:46:53.956 - lib.adb - ADB: Connected.
2024-01-22 22:46:53.956 - lib.adb - ADB: 192.168.42.157 - pm list packages -3
2024-01-22 22:46:54.014 - lib.adb - ADB: 192.168.42.157 - getprop ro.build.version.release
2024-01-22 22:46:54.034 - uvicorn.access - 172.17.0.1:43078 - "GET /admin/tuner/installed-packages?=1705963613772 HTTP/1.1" 200
2024-01-22 22:46:54.047 - lib.adb - ADB: Android Version: 9.0.
2024-01-22 22:46:54.063 - httpx - HTTP Request: GET http://192.168.42.189/live/stream0 "HTTP/1.1 301 Moved Permanently"
2024-01-22 22:46:54.064 - uvicorn.access - 172.17.0.1:43062 - "GET /admin/tuner/metadata?
=1705963613770 HTTP/1.1" 200
2024-01-22 22:47:25.921 - uvicorn.access - 172.17.0.1:35924 - "GET /channels.m3u HTTP/1.1" 200
2024-01-22 22:51:02.441 - server - Reserved tuner 1
2024-01-22 22:51:02.441 - server - Using tuner id: 1
2024-01-22 22:51:02.441 - uvicorn.access - 172.17.0.1:53880 - "GET /stream/3 HTTP/1.1" 307
2024-01-22 22:51:02.445 - server - Tuner: Tuning to AXSTV on Sling-Tuner1
2024-01-22 22:51:02.446 - lib.adb - ADB: Connecting to device (attempt 1).
2024-01-22 22:51:02.562 - lib.adb - ADB: Connected.
2024-01-22 22:51:02.562 - lib.adb - ADB: 192.168.42.157 - dumpsys display
2024-01-22 22:51:02.629 - lib.adb - ADB: 192.168.42.157 - getprop ro.build.version.release
2024-01-22 22:51:02.660 - lib.adb - ADB: Android Version: 9.0.
2024-01-22 22:51:02.660 - lib.adb - ADB: 192.168.42.157 - pm list packages -3
2024-01-22 22:51:02.760 - lib.adb - ADB: 192.168.42.157 - pidof com.sling
2024-01-22 22:51:02.811 - lib.adb - ADB: Stopping media playback.
2024-01-22 22:51:02.811 - lib.adb - ADB: 192.168.42.157 - input keyevent KEYCODE_MEDIA_STOP
2024-01-22 22:51:03.574 - lib.adb - ADB: 192.168.42.157 - am start -a android.intent.action.VIEW -d "Stream Live TV Now | Get Started" com.sling
2024-01-22 22:51:05.273 - server - Tuner: Waiting for playback start. Status: unknown
2024-01-22 22:51:07.652 - server - Tuner: Waiting for playback start. Status: unknown
2024-01-22 22:51:08.712 - server - Tuner: Tuning completed in 6.27 seconds. Display was on, application (com.sling) was running.
2024-01-22 22:51:08.712 - lib.adb - ADB: Closing connection - 192.168.42.157
2024-01-22 22:51:08.713 - uvicorn.access - 172.17.0.1:53880 - "GET /stream/1/3 HTTP/1.1" 200
2024-01-22 22:51:08.724 - root - Tuner: Stream open (attempt 1).
2024-01-22 22:51:08.733 - httpx - HTTP Request: GET http://192.168.42.189/live/stream0 "HTTP/1.1 301 Moved Permanently"
2024-01-22 22:51:08.736 - server - Tuner: Playback failed.
2024-01-22 22:51:08.737 - lib.adb - ADB: Connecting to device (attempt 1).
2024-01-22 22:51:08.783 - lib.adb - ADB: Connected.
2024-01-22 22:51:08.783 - lib.adb - ADB: Stopping media playback.
2024-01-22 22:51:08.783 - lib.adb - ADB: 192.168.42.157 - input keyevent KEYCODE_MEDIA_STOP
2024-01-22 22:51:10.048 - lib.adb - ADB: 192.168.42.157 - input keyevent KEYCODE_MEDIA_PAUSE
2024-01-22 22:51:11.090 - lib.adb - ADB: Closing connection - 192.168.42.157
2024-01-22 22:51:11.090 - server - Released tuner 1
2024-01-22 22:51:11.091 - server - Tuner: Cleanup complete. Sling-Tuner1 (AXSTV)
2024-01-22 22:51:11.091 - server - http disconnect
2024-01-22 22:51:12.137 - server - Reserved tuner 1
2024-01-22 22:51:12.137 - server - Using tuner id: 1
2024-01-22 22:51:12.138 - uvicorn.access - 172.17.0.1:53880 - "GET /stream/3 HTTP/1.1" 307
2024-01-22 22:51:12.140 - server - Tuner: Tuning to AXSTV on Sling-Tuner1
2024-01-22 22:51:12.141 - lib.adb - ADB: Connecting to device (attempt 1).
2024-01-22 22:51:12.183 - lib.adb - ADB: Connected.
2024-01-22 22:51:12.184 - lib.adb - ADB: 192.168.42.157 - dumpsys display
2024-01-22 22:51:12.240 - lib.adb - ADB: 192.168.42.157 - getprop ro.build.version.release
2024-01-22 22:51:12.273 - lib.adb - ADB: Android Version: 9.0.
2024-01-22 22:51:12.273 - lib.adb - ADB: 192.168.42.157 - pm list packages -3
2024-01-22 22:51:12.364 - lib.adb - ADB: 192.168.42.157 - pidof com.sling
2024-01-22 22:51:12.450 - lib.adb - ADB: Stopping media playback.
2024-01-22 22:51:12.450 - lib.adb - ADB: 192.168.42.157 - input keyevent KEYCODE_MEDIA_STOP
2024-01-22 22:51:13.261 - lib.adb - ADB: 192.168.42.157 - am start -a android.intent.action.VIEW -d "Stream Live TV Now | Get Started" com.sling
2024-01-22 22:51:14.898 - server - Tuner: Waiting for playback start. Status: unknown
2024-01-22 22:51:15.104 - server - Tuner: Tuning completed in 2.96 seconds. Display was on, application (com.sling) was running.
2024-01-22 22:51:15.104 - lib.adb - ADB: Closing connection - 192.168.42.157
2024-01-22 22:51:15.105 - uvicorn.access - 172.17.0.1:53880 - "GET /stream/1/3 HTTP/1.1" 200
2024-01-22 22:51:15.111 - root - Tuner: Stream open (attempt 1).
2024-01-22 22:51:15.117 - httpx - HTTP Request: GET http://192.168.42.189/live/stream0 "HTTP/1.1 301 Moved Permanently"
2024-01-22 22:51:15.121 - server - Tuner: Playback failed.

1 Like

Ok so it looks like you aren’t using the new build that follows redirects. You are going to have install that or figure out what it’s redirecting to and use that as the streaming endpoint URL.

This would normally be:

http://192.168.42.189:8090/stream0

but check your port settings on the linkpi device (options -> system) that the http port is set to 8090

Or just run curl -I http://192.168.42.189/live/stream0 from a computer on the same network (presuming cURL is installed). This will output the redirect path.

2 Likes

C:\Windows\System32>docker pull turtletank99/adbtuner
Using default tag: latest
latest: Pulling from turtletank99/adbtuner
Digest: sha256:3dd4e0cd0ac96136e9011fa604bad8c8301887e88bef317b4ab44c965615a658
Status: Image is up to date for turtletank99/adbtuner:latest
docker.io/turtletank99/adbtuner:latest
docker stop adbtuner
docker rm adbtuner
C:\Windows\System32>docker run -d --restart unless-stopped --init -p 5592:5592 --name adbtuner -v adbtuner_config:/app/.config turtletank99/adbtuner
e2d731c2db7b2db4f30d524719612591f39908c534664f17748ba71f5dbed83e

So I should have the latest version...did a test...same issue happens

Hey @laughsbrightly, welcome to Club LinkPi.

So your LinkPi config looks good. I looked at your screenshot of your ADBT Config, and the logs you posted. Just want to make sure, the box for Streaming Endpoint you have configured is:

Along with this error in the log:

2024-01-22 22:51:15.117 - httpx - HTTP Request: GET http://192.168.42.189/live/stream0 "HTTP/1.1 301 Moved Permanently"

I had this issue. The streaming links with "/live/streamX" is just a redirect for the actual streaming link. In your case, the following is the actual URL for the your HTTP (TS) Stream 0:

http://192.168.42.189:8090/stream0

Replace the link above in the Streaming Endpoint setting in ADBT (red box in picture) and let me know if works.

Happy Encoding!

Thanks for that. The issue I was having was that ADB would NOT accept that link. (and VLC would not play the stream). Posted here as a PSA for others trying this. If you have the issues I did - POWER CYCLE. After powering off both devices, bringing the encoder up first, and then the Fire stick, everything just worked. VLC started playing the stream, ADB took the 8090 port, and my one recording test has been perfect.
I will do more testing tomorrow, but I think I'm good.

Thank you for clarifying. Glad the device is working well. Been running multiple Link Pi devices since November. Ping me if you have any questions or jump into the LinkPi thread:

1 Like

Ok I'm having no luck. I haver restarted, reinstalled, etc, but I'm still unable to get a video stream from the encoder in Channels. Here are some facts that may help find the issue.

I can see the video stream with VLC at http://10.10.11.43/live/stream0 and also at http://10.10.11.43:8090/stream0 - I've tried with both in ADBTuner, same results.

I add a channel and the resulting m3u at http://10.10.11.16:5592/channels.m3u is:

#EXTM3U
#EXTINF:-1 channel-id="27081777265462926658171838050863796401" channel-number="8000",HDMI Encoder
http://10.10.11.16:5592/stream/1

I created a Custom Channel pointing at that m3u:

When I play the channel, ADBTuner opens the app in Fire TV and triggers the right live stream, but in Channels I get this error:

2024/01/23 05:41:48.490698 [ERR] Could not start stream for M3U-HDMIEncoder ch9001 HDMI Encoder: M3U: Tuner Unreachable: Timeout after 20.01s connecting to: http://10.10.11.16:5592/stream/1
2024/01/23 05:43:53.870987 [ERR] Could not start stream for M3U-HDMIEncoder ch9001 HDMI Encoder: M3U: Tuner Unreachable: Timeout after 20.01s connecting to: http://10.10.11.16:5592/stream/1
2024/01/23 05:47:46.402466 [ERR] Could not start stream for M3U-HDMIEncoder ch9001 HDMI Encoder: M3U: Tuner Unreachable: Timeout after 20.01s connecting to: http://10.10.11.16:5592/stream/1
2024/01/23 05:48:50.141267 [M3U] Refreshed lineup for HDMIEncoder with 2 channels
2024/01/23 05:49:16.175443 [ERR] Could not start stream for M3U-HDMIEncoder ch9001 HDMI Encoder: M3U: Tuner Unreachable: Timeout after 20s connecting to: http://10.10.11.16:5592/stream/1
2024/01/23 05:51:28.656158 [ERR] Could not start stream for M3U-HDMIEncoder ch9001 HDMI Encoder: M3U: Tuner Unreachable: Timeout after 20.02s connecting to: http://10.10.11.16:5592/stream/1

And in ADBTuner I get this logs:

2024-01-23 10:51:09.429 - server - Reserved tuner 1
2024-01-23 10:51:09.429 - server - Using tuner id: 1
2024-01-23 10:51:09.429 - uvicorn.access - 10.10.11.10:65382 - "GET /stream/1 HTTP/1.1" 307
2024-01-23 10:51:09.431 - server - Tuner: Tuning to HDMI Encoder on Fire TV HDMI Encoder
2024-01-23 10:51:09.432 - lib.adb - ADB: Connecting to device (attempt 1).
2024-01-23 10:51:09.497 - lib.adb - ADB: Connected.
2024-01-23 10:51:09.497 - lib.adb - ADB: 10.10.11.45 - dumpsys display
2024-01-23 10:51:09.557 - lib.adb - ADB: 10.10.11.45 - getprop ro.build.version.release
2024-01-23 10:51:09.596 - lib.adb - ADB: Android Version: 11.0.
2024-01-23 10:51:09.596 - lib.adb - ADB: 10.10.11.45 - pm list packages -3
2024-01-23 10:51:09.684 - lib.adb - ADB: 10.10.11.45 - pidof com.xfinity.cloudtvr.tenfoot
2024-01-23 10:51:09.743 - lib.adb - ADB: Stopping media playback.
2024-01-23 10:51:09.743 - lib.adb - ADB: 10.10.11.45 - input keyevent KEYCODE_MEDIA_STOP
2024-01-23 10:51:10.786 - lib.adb - ADB: 10.10.11.45 - am start -a android.intent.action.VIEW -d "https://www.xfinity.com/stream/live/19/5245992504835562105/TNND" com.xfinity.cloudtvr.tenfoot/com.xfinity.common.view.LaunchActivity
2024-01-23 10:51:12.524 - server - Tuner: Waiting for playback start. Status: unknown
2024-01-23 10:51:14.925 - server - Tuner: Waiting for playback start. Status: unknown
2024-01-23 10:51:17.242 - server - Tuner: Waiting for playback start. Status: unknown
2024-01-23 10:51:19.448 - server - Tuner: Waiting for playback start. Status: unknown
2024-01-23 10:51:21.693 - server - Tuner: Waiting for playback start. Status: unknown
2024-01-23 10:51:23.954 - server - Tuner: Waiting for playback start. Status: unknown
2024-01-23 10:51:26.260 - server - Tuner: Waiting for playback start. Status: unknown
2024-01-23 10:51:28.602 - server - Tuner: Waiting for playback start. Status: unknown
2024-01-23 10:51:30.862 - server - Tuner: Waiting for playback start. Status: unknown
2024-01-23 10:51:33.169 - server - Tuner: Waiting for playback start. Status: unknown
2024-01-23 10:51:35.540 - server - Tuner: Waiting for playback start. Status: unknown

My LinkPi encoder settings are exactly as shown a few posts above, and I can see the video preview in the dashboard, play the stream etc in VLC. I have to say my encoder is ENC1V3, the newest one (4K), but my firmware is 2.9.0 build 20231229_1900. I see others have 2.9.0 build 20231229_1901.

The only issue I see is this: for some reason I cannot select HTTP at the Overall Config screen:

But nonetheless everything works as expected.

Any help greatly appreciated. Also, anybody has a link to firmware downloads? Thanks.

And one more thing, Just for the sake of testing, if I point the Endpoint to a working HDHR channel (http://10.10.11.30:5004/auto/v4.1), ADBTuner is ok with that, but it never proxies the stream to Channels DVR, just like it happens with the LinkPi encoder. My guess here is there's some network issue at my ADBTuner sever that prevents hitting the endpoint video stream address...

1 Like

For that Xfinity app you will most likely have to enable Compatibility Mode for each channel in ADBTuner. Give that a shot.

That was it! It now works as expected. Can you briefly explain how does "Compatibility Mode" resolve this issue and when/why should I use it?

Thank you so much.

Compatibility mode does two things:

  1. Disables the video playback detection that is used to delay the video stream until the exact moment video playback starts. With this detection disabled you might see some of the loading process at the beginning of a recording (app opening, etc). This is necessary for some applications that use non-native video players as it's difficult to detect playback in that situation.

  2. Terminates the application process when the stream is closed. Some applications respond poorly to loading a URL when the app is already open. Some crash, or load the video in a paused state, etc. Doing this allows for a fresh start for each channel load. The downside being it might be a bit slower to tune.

1 Like

Well, I thought it was working.
I scheduled a recoding in Channels web interface. The recording starts and I can see it on the monitor via pass-through.
The Channels App then reports that the recording was interrupted.
When I go to watch the recording, I get "Connection Lost"
Meanwhile, Channels thinks it's still recording so I delete and trash the episode, and use the remote to kill the Sling app.
Edit channel to compatibility mode. Same thing.
Okay, schedule another recording. It starts. I touch nothing and every couple minutes the Sling app restarts. Wait a couple more, the Sling app restarts. Only, the restarts aren't as quick as before.
Edit: Power cycle of the Link Pi seems to have resolved it. I will keep an eye on it.

@turtletank
I got everything up n running .
But i cant get my swedish app ”Allente” to start or tune with adbtuner. I have choosen the name in droplist for Allente . Any other idea ?

One requst for non compatible app . Can you please make a option for adb to send number keys? In that way i can leave the app always on and have adb tuner to send key 1 for channel 1 and key 22 to channel 22. My goal is to use Tvheadend and kodi with your app . Thanks !

What you're requesting is exactly what the androidhdmi-for-channels (ah4c) project is all about. ADBTuner is designed for apps that support deep links. For those that don't, ah4c is the way to go.

2 Likes

Back in the USA now, so I was able to test this out. And, with a fully up-to-date FireStick 4K Max (2nd Gen), I had no problem connecting via Ethernet with ADB enabled. It worked with this stick 3 months ago before left, and it still works now.

I have 4 Firesticks attached to a switch using Ethernet with ADB enabled and plugged into my encoder.

Ok thanks . Can it be used with other apps like kodi , vlc etc without channels installed?

Yes, same with me.

The implication I was trying to address is that the "latest" FireSticks (which I assume to mean the 4K Max Gen 2 units) had the same failing as the onn 4K sticks as far as ADB and Ethernet being mutually exclusive. This is not the case, at least in my testing.

Are the sticks you mentioned above Gen 2?

1 Like

Those are 4K Max's I have a 4KMAX 2nd Gen hooked up to my TV with ethernet and ADB enabled ... which I also use for ADB command testing.

I don't see why not. I just tried one of the virtual channel URLs from my ah4c M3U in VLC, and it both tuned and played fine.

EDIT: Everything looks as per usual in the docker container log as well:

Attempting network tune for device http://encoder_48007/0.ts firestick-rack1:5555 8 
[EXECUTE] Running [./scripts/firetv/directv/prebmitune.sh firestick-rack1:5555]
[EXECUTE] Stdout: 'already connected to firestick-rack1:5555
Starting: Intent { cmp=com.att.tv/com.clientapp.MainActivity }
Starting com.att.tv on firestick-rack1:5555
prebmitune.sh is exiting for firestick-rack1:5555 with exit code 0
'
[EXECUTE] Stderr: '+ streamerIP=firestick-rack1:5555
+ streamerNoPort=firestick-rack1
+ adbTarget='adb -s firestick-rack1:5555'
+ mkdir -p firestick-rack1
+ trap finish EXIT
+ main

+ adbConnect
+ adb connect firestick-rack1:5555
+ local -i adbMaxRetries=25
+ local -i adbCounter=0
+ true
+ adb -s firestick-rack1:5555 shell input keyevent KEYCODE_WAKEUP
+ local adbEventSuccess=0
+ [[ 0 -eq 0 ]]
+ break

e
+ packageLaunch=com.clientapp.MainActivity
+ packageName=com.att.tv
++ adb -s firestick-rack1:5555 shell pidof com.att.tv
+ packagePID=
+ '[' '!' -z ']'
+ adb -s firestick-rack1:5555 shell input keyevent KEYCODE_WAKEUP
+ adb -s firestick-rack1:5555 shell am start -n com.att.tv/com.clientapp.MainActivity
+ echo 'Starting com.att.tv on firestick-rack1:5555'
+ finish
+ echo 'prebmitune.sh is exiting for firestick-rack1:5555 with exit code 0'
'
[EXECUTE] Finished running ./scripts/firetv/directv/prebmitune.sh in 2.346058621s
[EXECUTE] Running [./scripts/firetv/directv/bmitune.sh 8 firestick-rack1:5555]
[EXECUTE] Stdout: 'Current PID for this script is 1117
Not a special channel (exit nor reboot)
Current app in focus is mCurrentFocus=null
Active audio stream not yet detected -- loudness is -70.0 LUF. Continuing...
Active audio stream not yet detected -- loudness is -70.0 LUF. Continuing...
Active audio stream not yet detected -- loudness is -70.0 LUF. Continuing...
Active audio stream detected with -21.5 LUF.
Active audio stream detected with -20.3 LUF.
bmitune.sh is exiting for firestick-rack1:5555 with exit code 0
'
[EXECUTE] Stderr: '+ channelID='"8"'
+ specialID=8
+ streamerIP=firestick-rack1:5555
+ streamerNoPort=firestick-rack1
+ adbTarget='adb -s firestick-rack1:5555'
+ packageName=com.att.tv
+ m3uName=directv.m3u
+ trap finish EXIT
+ main
+ updateReferenceFiles
+ mkdir -p firestick-rack1
+ [[ -f firestick-rack1/stream_stopped ]]
+ [[ -f firestick-rack1/last_channel ]]
+ echo 1117
+ echo 'Current PID for this script is 1117'
+ matchEncoderURL
+ case "$streamerIP" in
+ encoderURL=http://encoder_48007/0.ts
+ specialChannels
+ '[' 8 = exit ']'
+ '[' 8 = reboot ']'
+ [[ -f firestick-rack1/adbCommunicationFail ]]
+ echo 'Not a special channel (exit nor reboot)'
++ adb -s firestick-rack1:5555 shell dumpsys window windows
++ grep -E mCurrentFocus
++ cut -d / -f1
++ sed 's/.* //g'
+ appFocus=mCurrentFocus=null
+ echo 'Current app in focus is mCurrentFocus=null'
+ launchDelay
+ local lastChannel
+ local lastAwake
+ local timeNow
+ local timeElapsed
+ local maxTime=14400
+ lastChannel=217
+ lastAwake=1706101203
++ date +%s
+ timeNow=1706138398
+ timeElapsed=37195
+ ((  217 == 8  ))
+ '[' -f firestick-rack1/adbAppRunning ']'
+ ((  37195 < 14400  ))
+ activeAudioCheck 42 true 0 1
++ date +%s
+ local startTime=1706138398
+ local maxDuration=42
+ local minimumLoudness=-50
+ local sleepBeforeAudioCheck=0
+ local sleepAfterAudioCheck=1
+ local preTuneAudioCheck=true
+ true

0
++ ffmpeg -t 1 -i http://encoder_48007/0.ts -filter:a ebur128 -map 0:a -f null -hide_banner -
++ awk '/I:        /{print $2}'
+ checkLoudness=-70.0
++ date +%s
+ ((  1706138404 - 1706138398 > 42  ))
++ echo '-70.0 > -50'
++ bc -l
+ ((  0  ))
+ echo 'Active audio stream not yet detected -- loudness is -70.0 LUF. Continuing...'

1
+ true

0
++ ffmpeg -t 1 -i http://encoder_48007/0.ts -filter:a ebur128 -map 0:a -f null -hide_banner -
++ awk '/I:        /{print $2}'
+ checkLoudness=-70.0
++ date +%s
+ ((  1706138410 - 1706138398 > 42  ))
++ echo '-70.0 > -50'
++ bc -l
+ ((  0  ))
+ echo 'Active audio stream not yet detected -- loudness is -70.0 LUF. Continuing...'

1
+ true

0
++ ffmpeg -t 1 -i http://encoder_48007/0.ts -filter:a ebur128 -map 0:a -f null -hide_banner -
++ awk '/I:        /{print $2}'
+ checkLoudness=-70.0
++ date +%s
+ ((  1706138416 - 1706138398 > 42  ))
++ echo '-70.0 > -50'
++ bc -l
+ ((  0  ))
+ echo 'Active audio stream not yet detected -- loudness is -70.0 LUF. Continuing...'

1
+ true

0
++ ffmpeg -t 1 -i http://encoder_48007/0.ts -filter:a ebur128 -map 0:a -f null -hide_banner -
++ awk '/I:        /{print $2}'
+ checkLoudness=-21.5
++ date +%s
+ ((  1706138423 - 1706138398 > 42  ))
++ echo '-21.5 > -50'
++ bc -l
+ ((  1  ))
+ echo 'Active audio stream detected with -21.5 LUF.'
+ break
+ echo 8
+ tuneChannel
++ awk -F, '/channel-id="8"/ {print $2}' m3u/directv.m3u
+ channelName='KAET PBS 8'
++ echo KAET PBS 8
++ sed 's/^/"/;s/$/"/'
+ channelName='"KAET PBS 8"'
+ numberOfBackspaces=25

++ (( i=0 ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
++ echo -n ' KEYCODE_MEDIA_REWIND'

++ (( i++ ))
++ (( i<25 ))
+ clearSearchBackspaces=' KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND'
+ directvMenu='input keyevent KEYCODE_MENU; sleep 6'
+ directvSearch='input keyevent KEYCODE_DPAD_LEFT;                  input keyevent KEYCODE_DPAD_UP;                  input keyevent KEYCODE_DPAD_CENTER; sleep 1;                  input keyevent KEYCODE_DPAD_CENTER; sleep 1'
+ directvClearSearch='input keyevent KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND'
+ directvTune='input keyevent KEYCODE_MEDIA_PLAY_PAUSE; sleep 1;                input keyevent KEYCODE_DPAD_DOWN;                input keyevent KEYCODE_DPAD_DOWN;                input keyevent KEYCODE_DPAD_DOWN;                input keyevent KEYCODE_DPAD_CENTER'
+ adb -s firestick-rack1:5555 shell input keyevent 'KEYCODE_MENU;' sleep 6
+ adb -s firestick-rack1:5555 shell input keyevent 'KEYCODE_DPAD_LEFT;' input keyevent 'KEYCODE_DPAD_UP;' input keyevent 'KEYCODE_DPAD_CENTER;' sleep '1;' input keyevent 'KEYCODE_DPAD_CENTER;' sleep 1
+ adb -s firestick-rack1:5555 shell input keyevent KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND KEYCODE_MEDIA_REWIND
+ adb -s firestick-rack1:5555 shell input text '"KAET PBS 8"'
+ adb -s firestick-rack1:5555 shell input keyevent 'KEYCODE_MEDIA_PLAY_PAUSE;' sleep '1;' input keyevent 'KEYCODE_DPAD_DOWN;' input keyevent 'KEYCODE_DPAD_DOWN;' input keyevent 'KEYCODE_DPAD_DOWN;' input keyevent KEYCODE_DPAD_CENTER
+ activeAudioCheck 24 false 5 1
++ date +%s
+ local startTime=1706138445
+ local maxDuration=24
+ local minimumLoudness=-50
+ local sleepBeforeAudioCheck=5
+ local sleepAfterAudioCheck=1
+ local preTuneAudioCheck=false
+ true

5
++ ffmpeg -t 1 -i http://encoder_48007/0.ts -filter:a ebur128 -map 0:a -f null -hide_banner -
++ awk '/I:        /{print $2}'
+ checkLoudness=-20.3
++ date +%s
+ ((  1706138455 - 1706138445 > 24  ))
++ echo '-20.3 > -50'
++ bc -l
+ ((  1  ))
+ echo 'Active audio stream detected with -20.3 LUF.'
+ break
+ finish
+ echo 'bmitune.sh is exiting for firestick-rack1:5555 with exit code 0'
'
[EXECUTE] Finished running ./scripts/firetv/directv/bmitune.sh in 56.781617415s
[IO] io.Copy: write tcp 192.168.176.2:7654->192.168.176.1:56051: write: broken pipe
[IOINFO] Successfully copied 15006764 bytes
[IOINFO] Transfer speed: 1.5912688629305276 Mbits/second
Performing Close() for firestick-rack1:5555
[EXECUTE] Running [./scripts/firetv/directv/stopbmitune.sh firestick-rack1:5555]
[EXECUTE] Stdout: 'Streaming stopped for firestick-rack1:5555
Sleep initiated for firestick-rack1:5555
firestick-rack1/stream_stopped written with epoch stop time
'
[EXECUTE] Stderr: '+ streamerIP=firestick-rack1:5555
+ streamerNoPort=firestick-rack1
+ adbTarget='adb -s firestick-rack1:5555'
+ main
+ bmituneDone
+ bmitunePID=1117

+ ps -p 1117

p
+ stop='input keyevent KEYCODE_HOME'
+ adb -s firestick-rack1:5555 shell input keyevent KEYCODE_HOME

2
+ echo 'Streaming stopped for firestick-rack1:5555'
+ adbSleep
+ sleep='input keyevent KEYCODE_SLEEP'
+ adb -s firestick-rack1:5555 shell input keyevent KEYCODE_SLEEP
+ echo 'Sleep initiated for firestick-rack1:5555'
+ date +%s
+ echo 'firestick-rack1/stream_stopped written with epoch stop time'
'
[EXECUTE] Finished running ./scripts/firetv/directv/stopbmitune.sh in 3.668481385s
[GIN-debug] Request: 192.168.176.1 GET /play/tuner/8, latency: 1m21.5179651s, status: 200

EDIT2: @Bossmann If you want to discuss this further, let's move this discussion over to the hdmi for channels thread:

1 Like

I tried the ADBTUNER With EMBY Nextpvr and it worked on them ... great piece of software.