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

Absolutely!

There are a couple of issues to address with ah4c. The first is the View & control window isn't working with my virtual encoders. It works initially (for maybe a second), but then goes gray with a spinning circle. The virtual encoder URL looks like this:

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

The second is that our attempt at changing tuner numbers from starting with 0 to starting with 1 is a bit of a bust, as if you want to target a specific tuner (for testing or whatever), it's done by /play/tunerx/. And, as you might imagine, it's a bit confusing when looking at Activity-Tuners. Apparently changing the way the tuners are referenced, internal to the program, is no small task. I propose we revert this.

I'm happy to take a look at these issues myself, but if you'd prefer to dig into them, that's great too.

No problem. I'll see if I can make any inroads on either issue tomorrow. View & control seem the most pressing, so I'll look at that first.

1 Like

That's exactly my thought as well!

looks like everything worked good for me this last week unsupervised. :slight_smile: :camping:
i'll wait till another day to try any updates.

this does make since, and i'm capable of opting out.

I was worried about that and hesitated even saying something, i think its fine if everything starts at zero, just wanted the env and gui to match. :wink:

So you got my curiosity going and I tried ah4c outside of FC and tune time was around 20 seconds to the video actually starting. I tried tuning to Fail Army to make sure it wasn't a network subscription thing. Below is the ah4c log file;

2026/09/08 14:13:31 [EXECUTE] Stderr: '+ streamerIP=192.168.88.113:5555

+ streamerNoPort=192.168.88.113

+ adbTarget='adb -s 192.168.88.113:5555'

+ packageName=com.att.tv

+ mkdir -p 192.168.88.113

+ trap finish EXIT

+ main

+ adbConnect

+ adb connect 192.168.88.113:5555

+ local -i adbMaxRetries=2

+ local -i adbCounter=0

+ true

+ adb -s 192.168.88.113:5555 shell input keyevent KEYCODE_WAKEUP

+ local adbEventSuccess=0

+ [[ 0 -eq 0 ]]

+ break

+ forceStopApp

+ adb -s 192.168.88.113:5555 shell am force-stop com.att.tv

+ finish

+ echo 'prebmitune.sh is exiting for 192.168.88.113:5555 with exit code 0'

'

2026/09/08 14:13:31 [EXECUTE] Finished running ./scripts/firetv/dtvstreamdeeplinks/prebmitune.sh in 2.195112575s

2026/09/08 14:13:31 [EXECUTE] Running [./scripts/firetv/dtvstreamdeeplinks/bmitune.sh FLARMY~5b2cc61c-32c8-42db-8c2e-ec527e55f1fa 192.168.88.113:5555]

2026/09/08 14:13:31 [EXECUTE] Stdout: 'Current PID for this script is 281

Starting: Intent { act=android.intent.action.VIEW (has data) cmp=com.att.tv/com.clientapp.MainActivity }

bmitune.sh is exiting for 192.168.88.113:5555 with exit code 0

'

2026/09/08 14:13:31 [EXECUTE] Stderr: '++ echo FLARMY~5b2cc61c-32c8-42db-8c2e-ec527e55f1fa

++ awk -F~ '{print $2}'

+ channelID=5b2cc61c-32c8-42db-8c2e-ec527e55f1fa

++ echo FLARMY~5b2cc61c-32c8-42db-8c2e-ec527e55f1fa

++ awk -F~ '{print $1}'

+ channelName=FLARMY

+ streamerIP=192.168.88.113:5555

+ streamerNoPort=192.168.88.113

+ adbTarget='adb -s 192.168.88.113:5555'

+ packageName=com.att.tv

+ packageAction=com.clientapp.MainActivity

+ trap finish EXIT

+ main

+ updateReferenceFiles

+ mkdir -p 192.168.88.113

+ [[ -f 192.168.88.113/stream_stopped ]]

+ [[ -f 192.168.88.113/last_channel ]]

+ echo 281

+ echo 'Current PID for this script is 281'

+ tuneChannel

+ adb -s 192.168.88.113:5555 shell am start -n com.att.tv/com.clientapp.MainActivity dtvnow://deeplink.directvnow.com/play/channel/FLARMY/5b2cc61c-32c8-42db-8c2e-ec527e55f1fa

+ finish

+ echo 'bmitune.sh is exiting for 192.168.88.113:5555 with exit code 0'

'

2026/09/08 14:13:31 [EXECUTE] Finished running ./scripts/firetv/dtvstreamdeeplinks/bmitune.sh in 433.260841ms

2026/09/08 14:14:02 Tuner 0 is active - skipping

2026/09/08 14:14:02 [ERR] Failed to tune device(s) not available

2026/09/08 14:14:02 [GIN-debug] Request: 172.27.0.1 GET /play/tuner/FLARMY~5b2cc61c-32c8-42db-8c2e-ec527e55f1fa, latency: 314.372µs, status: 500

2026/09/08 14:14:02 [IO] io.Copy: write tcp 172.27.0.2:7654->172.27.0.1:49982: write: broken pipe

2026/09/08 14:14:02 [IOINFO] Successfully copied 25697752 bytes

2026/09/08 14:14:02 [IOINFO] Transfer speed: 6.555588450881878 Mbits/second

2026/09/08 14:14:02 Performing Close() for 192.168.88.113:5555

2026/09/08 14:14:02 [EXECUTE] Running [./scripts/firetv/dtvstreamdeeplinks/stopbmitune.sh 192.168.88.113:5555 FLARMY~5b2cc61c-32c8-42db-8c2e-ec527e55f1fa]

2026/09/08 14:14:09 [EXECUTE] Stdout: 'Streaming stopped for 192.168.88.113:5555

Sleep initiated for 192.168.88.113:5555

192.168.88.113/stream_stopped written with epoch stop time

'

2026/09/08 14:14:09 [EXECUTE] Stderr: '+ streamerIP=192.168.88.113:5555

+ streamerNoPort=192.168.88.113

+ adbTarget='adb -s 192.168.88.113:5555'

+ packageName=com.att.tv

+ main

+ bmituneDone

+ bmitunePID=281

+ ps -p 281

+ adbStop

+ stop='input keyevent KEYCODE_BACK; input keyevent KEYCODE_HOME'

+ adb -s 192.168.88.113:5555 shell input keyevent 'KEYCODE_BACK;' input keyevent KEYCODE_HOME

+ sleep 2

+ echo 'Streaming stopped for 192.168.88.113:5555'

+ adbSleep

+ sleep='input keyevent KEYCODE_SLEEP'

+ adb -s 192.168.88.113:5555 shell input keyevent KEYCODE_SLEEP

+ echo 'Sleep initiated for 192.168.88.113:5555'

+ date +%s

+ echo '192.168.88.113/stream_stopped written with epoch stop time'

'

2026/09/08 14:14:09 [EXECUTE] Finished running ./scripts/firetv/dtvstreamdeeplinks/stopbmitune.sh in 6.894563499s

2026/09/08 14:14:09 [GIN-debug] Request: 172.27.0.1 GET /play/tuner/FLARMY~5b2cc61c-32c8-42db-8c2e-ec527e55f1fa, latency: 40.464696268s, status: 200

FastChannels/ah4c integration is working really, really well. If your provider is DTV, Sling or Philo it'd be well worth your time to migrate over (not including those with Ospreys). Here's are few recent screenshots and details:

When you setup the FastChannels ah4c bridge, you'll see there's a button to install the FC Player. It's all pretty easy.

EDIT: You don't need to bother with downloading scripts/firetv/fastchannels from FastChannels. Those same script will be installed automatically in ah4c when you use that as a STREAMER_APP value. Also, don't forget to set the new FASTCHANNELS_URL env var.

1 Like

not sure it's the latest pushed, but using ah4c v2026.08.28.1306 since released and have had no problems (no heartbeat, only cc) but caught this messup today. (the 356 did not take and cdvr recorded 30mins of accuweather)


I have 2 identical passes with different padding and channel #'s so the tuner is switched every half hour. the only thing ah4c has been recording all day is ch# 356, I actually have not tuned to 361 for weeks. I'm not sure how the osprey got set on 361, and my logs only seem to go back 1.5hr.

edit. closest thing I can think of is the 2 channels in my m3u are 60.356 and 61.356 and this was the 61.356 . that is the only way I can see how a 61 got in there. still doesn't make sense, but :person_shrugging:

whatever came with 08.28.

no wigging out. just something told the box to tune to 361 apparently right before trying to tune to 356.

I'm guessing this (blindly) as I also have insertion off

USER_SCRIPT=
NULL_FRAME_INSERTION=false
PLAYBACK_DETECTION=false
PLAYBACK_STATIC_TIMEOUT=
PLAYBACK_DELAY=
PREROLL_FILE=
ENCODER_CODEC=h265
HEARTBEAT_INTERVAL=0
NVIDIA_VISIBLE_DEVICES=
NVIDIA_DRIVER_CAPABILITIES=
HOST_DIR=/data

also for what it's worth I found a mistake in my m3u (but it's been there 2 weeks and no other issues)
was
tvc-guide-tags="MSNow, News",MSNOW60
now
tvc-guide-tags="MSNow News",MSNOW60

edit2 according to Channels Support - Add Custom Channels with M3U Playlists tvc-guide-tags: guide item tags. comma delimited. example: "HDTV, Live"

so I had it right, but ah4c was misreading somehow

when tuning is done they sleep

no, I'm using and really liking the CC now that I have my n100 running at an appropriate wattage :wink: thanks again! game changer, and this winter I will be marking all my recordings prior to sept to not recorded so they can be replaced with embeded cc :+1:

been there! :upside_down_face:

I went back in my stack logs and could find no reason for my box getting on 261 :man_shrugging: it's toggling between both usb captures on 2 C71KW-200's every half hour 16hrs a day so I do kinda expect a hiccup now and again, just be nice if i could see the ospreys' logs

I just got my linkpi and tested a lot of deep links I don't have access to directv login only my logged in acct on Android fromy ex most channels I found on this server load deep links. I also have uverse apk I have modded to run on Ethernet and work on other android devices ..it also has deep link functionality . There is so many setup options I am totally lost. Can anyone help me if I pay for some support? I can venmo

Some posts back, I laid out how to implement an approach to supporting multiple providers in a single ah4c container:

This has been formalized now through the WebUI. If you want your ah4c instance to be able to tune using multiple different apps, requiring multiple sets of scripts and a combined M3U -- it can all be done very easily by first creating an "all.m3u", and then setting STREAMER_APP=scripts/all/all.

Using the new Create all.m3u menu item, you can select the M3Us you want to combine, using which set of scripts:

Your CDVR Custom Channels Source will just need to reference this all.m3u (or whatever you chose to call it), and the correct set of scripts will be used for tuning.

1 Like

I'm vibe coding a uverse backup for DirecTV and a m3u8 that does baton handoff so that if both DirecTV and uverse are watching a channel it will use prismcast to tune

I figured out the hls deeplinks for most channels. I will post them later with my uverse modded apk with deeplinks.

I am also incorporating with prismcast+ a-i-o. I have the newsmix and sportsmix working as well and I am making some channels have a fallback and black screen baton so streams don't end, if something goes down or is unresponsive it will go to the other source.

1 Like

Just put that dude in the ignore list. Hes a lost cause. He always spam the forums with nonsense.

Im surprised the mods haven't sent him on his way yet

1 Like

We have a new beta (bnhf/ah4c:beta), for anyone to try who's interested. This is another excellent effort by @anon38303228, including a new in-app settings option (env vars continue to work, and take precedence), along with lots of other new features through the WebUI.

If you'd like to continue to use the "full" Docker Compose (which will require no new configuration on your part), here's the updated version:

services:
  # 2026.09.16
  # GitHub home for this project with setup instructions: https://github.com/sullrich/ah4c
  # Docker Hub home for this project: https://hub.docker.com/repository/docker/bnhf/ah4c
  ah4c: # This docker-compose typically requires no editing. Use the Environment variables section of Portainer to set your values.
    image: bnhf/ah4c:${TAG:-latest}
    container_name: ${CONTAINER_NAME:-ah4c}
    hostname: ${HOSTNAME:-ah4c}
    dns_search: ${DOMAIN:-localdomain} # Specify the name of your LAN's domain, usually local or localdomain
    runtime: ${DOCKER_RUNTIME:-runc} # Closed captions only. Set DOCKER_RUNTIME=nvidia for an NVIDIA GPU with the CUDA engine build. Requires the NVIDIA container toolkit.
    devices:
      - ${GPU_DEVICE:-/dev/null} # Closed captions only. Set GPU_DEVICE=/dev/dri to let the Vulkan engine build use an Intel or AMD GPU. Left at the default it passes /dev/null, which always exists and does nothing.
    ports:
      - ${HOST_PORT:-7654}:7654 # Port used by this ah4c proxy
    environment:
      - AH4C_COMPOSE=2026.09.16 # Compose file date stamp - do not change. The startup log flags it when out of date.
      # ── Proxy identity ──────────────────────────────────────────────────────
      - IPADDRESS=${IPADDRESS} # Hostname or IP address of this ah4c extension to be used in M3U file (also add port number if not in M3U)
      - SETUP_WIZARD=${SETUP_WIZARD:-false} # Full environment-managed installs skip the web setup wizard. Set to true to allow it.
      # ── Tuners ──────────────────────────────────────────────────────────────
      # One trio per tuner: TUNERn_IP is the box to tune; video comes from CMDn if set, otherwise ENCODERn_URL.
      - NUMBER_TUNERS=${NUMBER_TUNERS} # Number of tuners you'd like defined - add a matching TUNERn_IP, ENCODERn_URL and CMDn trio below for each beyond 9
      - TUNER1_IP=${TUNER1_IP} # Streaming device #1 with adb port in the form hostname:port or ip:port
      - ENCODER1_URL=${ENCODER1_URL} # Tuner #1 source URL (http://hostname/stream). Streamed directly when CMD1 is blank; otherwise referenced by CMD1 as ${ENCODER1_URL}.
      - CMD1=${CMD1} # Optional tuner #1 command; ah4c streams its stdout (end it with "-f mpegts -") instead of fetching ENCODER1_URL. No shell.
      - TUNER2_IP=${TUNER2_IP} # Streaming device #2 with adb port in the form hostname:port or ip:port
      - ENCODER2_URL=${ENCODER2_URL} # Tuner #2 source URL. Streamed directly when CMD2 is blank; otherwise referenced by CMD2 as ${ENCODER2_URL}.
      - CMD2=${CMD2} # Optional tuner #2 command; ah4c streams its stdout instead of fetching ENCODER2_URL. See CMD1.
      - TUNER3_IP=${TUNER3_IP} # Streaming device #3 with adb port in the form hostname:port or ip:port
      - ENCODER3_URL=${ENCODER3_URL} # Tuner #3 source URL. Streamed directly when CMD3 is blank; otherwise referenced by CMD3 as ${ENCODER3_URL}.
      - CMD3=${CMD3} # Optional tuner #3 command; ah4c streams its stdout instead of fetching ENCODER3_URL. See CMD1.
      - TUNER4_IP=${TUNER4_IP} # Streaming device #4 with adb port in the form hostname:port or ip:port
      - ENCODER4_URL=${ENCODER4_URL} # Tuner #4 source URL. Streamed directly when CMD4 is blank; otherwise referenced by CMD4 as ${ENCODER4_URL}.
      - CMD4=${CMD4} # Optional tuner #4 command; ah4c streams its stdout instead of fetching ENCODER4_URL. See CMD1.
      - TUNER5_IP=${TUNER5_IP} # Streaming device #5 with adb port in the form hostname:port or ip:port
      - ENCODER5_URL=${ENCODER5_URL} # Tuner #5 source URL. Streamed directly when CMD5 is blank; otherwise referenced by CMD5 as ${ENCODER5_URL}.
      - CMD5=${CMD5} # Optional tuner #5 command; ah4c streams its stdout instead of fetching ENCODER5_URL. See CMD1.
      - TUNER6_IP=${TUNER6_IP} # Streaming device #6 with adb port in the form hostname:port or ip:port
      - ENCODER6_URL=${ENCODER6_URL} # Tuner #6 source URL. Streamed directly when CMD6 is blank; otherwise referenced by CMD6 as ${ENCODER6_URL}.
      - CMD6=${CMD6} # Optional tuner #6 command; ah4c streams its stdout instead of fetching ENCODER6_URL. See CMD1.
      - TUNER7_IP=${TUNER7_IP} # Streaming device #7 with adb port in the form hostname:port or ip:port
      - ENCODER7_URL=${ENCODER7_URL} # Tuner #7 source URL. Streamed directly when CMD7 is blank; otherwise referenced by CMD7 as ${ENCODER7_URL}.
      - CMD7=${CMD7} # Optional tuner #7 command; ah4c streams its stdout instead of fetching ENCODER7_URL. See CMD1.
      - TUNER8_IP=${TUNER8_IP} # Streaming device #8 with adb port in the form hostname:port or ip:port
      - ENCODER8_URL=${ENCODER8_URL} # Tuner #8 source URL. Streamed directly when CMD8 is blank; otherwise referenced by CMD8 as ${ENCODER8_URL}.
      - CMD8=${CMD8} # Optional tuner #8 command; ah4c streams its stdout instead of fetching ENCODER8_URL. See CMD1.
      - TUNER9_IP=${TUNER9_IP} # Streaming device #9 with adb port in the form hostname:port or ip:port
      - ENCODER9_URL=${ENCODER9_URL} # Tuner #9 source URL. Streamed directly when CMD9 is blank; otherwise referenced by CMD9 as ${ENCODER9_URL}.
      - CMD9=${CMD9} # Optional tuner #9 command; ah4c streams its stdout instead of fetching ENCODER9_URL. See CMD1.
      # ── Streaming app and DVR ───────────────────────────────────────────────
      - 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)
      - PYATV=${PYATV:-false} # Set to TRUE to run docker-start-pyatv.sh at container start for Apple TV tuners via pyatv, instead of the default docker-start.sh used for adb-based tuners. Case-insensitive; anything else runs the default.
      - CHANNELSIP=${CHANNELSIP} # Hostname or IP address of the Channels DVR server itself
      - FASTCHANNELS_URL=${FASTCHANNELS_URL} # Base URL of your FastChannels container, so the firetv/fastchannels scripts can use its built-in ah4c integration to tune. A URL pre-filled into an exported script overrides this.
      # ── Failure alerts ──────────────────────────────────────────────────────
      # Email via SMTP and/or a webhook GET, sent when a tune fails. Leave blank to disable.
      - ALERT_SMTP_SERVER=${ALERT_SMTP_SERVER} # The domainname:port of the SMTP server you'll be using like smtp.gmail.com:587. This is for sending ah4c alerts if tuning fails.
      - ALERT_AUTH_SERVER=${ALERT_AUTH_SERVER} # The auth server for the e-mail you'll be using like smtp.gmail.com
      - ALERT_EMAIL_FROM=${ALERT_EMAIL_FROM} # The e-mail address you'd like your ah4c failure alert e-mails to show as being from.
      - ALERT_EMAIL_PASS=${ALERT_EMAIL_PASS} # Gmail and Yahoo both support the creation of app-specific e-mail passwords, and this is the way to go! It's NOT recommended to use your everyday e-mail password.
      - ALERT_EMAIL_TO=${ALERT_EMAIL_TO} # The e-mail address you'd like your alert e-mails sent to.
      - ALERT_WEBHOOK_URL=${ALERT_WEBHOOK_URL} # URL to GET when an alert fires (same failures that trigger the e-mail); put $reason in the URL and it's replaced with the URL-encoded message. Blank disables it.
      # ── Guide tuning and content updates ────────────────────────────────────
      - LIVETV_ATTEMPTS=${LIVETV_ATTEMPTS} # For FireTV Live Guide tuning only, set maximum number of attempts at finding the desired channel
      - CREATE_M3US=${CREATE_M3US:-false} # Set to true to create device-specific M3Us for use with Amazon Prime Premium channels -- requires a FireTV device
      - UPDATE_SCRIPTS=${UPDATE_SCRIPTS:-true} # Set to true if you'd like the sample scripts and STREAMER_APP scripts updated whether they exist or not
      - UPDATE_M3US=${UPDATE_M3US:-true} # Set to true if you'd like the sample m3us updated whether they exist or not
      # ── Timezone and session handling ───────────────────────────────────────
      - TZ=${TZ} # Your local timezone in Linux "tz" format
      - SPEED_MODE=${SPEED_MODE:-false} # Set to false if you'd like the target streaming app to be closed after each tuning cycle (limited script support).
      - KEEP_WATCHING=${KEEP_WATCHING} # In supported scripts, set the delay before resending a tuning deeplink to prevent "Are you still watching?" type messages. Examples: Use 4h for 4 hours or 240m for 240 minutes.
      # ── Autocrop (LinkPi encoders only) ─────────────────────────────────────
      - AUTOCROP_CHANNELS=${AUTOCROP_CHANNELS} # Space separated list of channels (by number) with black borders on 4 sides to autocrop while maintaining aspect ratio. Requires LinkPi Encoder!
      - LINKPI_HOSTNAME=${LINKPI_HOSTNAME} # Hostname or IP of the LinkPi Encoder's web API. Required for AUTOCROP_CHANNELS.
      - LINKPI_USERNAME=${LINKPI_USERNAME} # Username for the LinkPi Encoder's web API. Required for AUTOCROP_CHANNELS.
      - LINKPI_PASSWORD=${LINKPI_PASSWORD} # Password for the LinkPi Encoder's web API. Required for AUTOCROP_CHANNELS; not currently read by the bundled scripts, which log in with the LinkPi default password instead.
      # ── Custom startup script ───────────────────────────────────────────────
      - USER_SCRIPT=${USER_SCRIPT} # Path to a custom script to run alongside ah4c at container startup. Blank runs nothing extra.
      # ── Recording continuity and playback timing ────────────────────────────
      # Keep recordings starting on the program and free of gaps within the DVR's 30s tune window.
      - NULL_FRAME_INSERTION=${NULL_FRAME_INSERTION:-false} # Set to TRUE to fill encoder stalls with MPEG-TS NULL packets (PID 0x1FFF) so the DVR never sees a zero-byte gap mid-recording. Case-insensitive (true/True/TRUE all work); anything else, including 1/yes, leaves the feature off.
      - PLAYBACK_DETECTION=${PLAYBACK_DETECTION:-false} # Set to TRUE to hold the stream until the device reports audio playing and the picture moving, then start on a keyframe, so recording begins on the program, not the loading screen. Requires adb; network tuners only. Case-insensitive; anything but true leaves it off.
      - PLAYBACK_STATIC_TIMEOUT=${PLAYBACK_STATIC_TIMEOUT} # Only used with PLAYBACK_DETECTION=TRUE. Seconds the box may keep its prior player/session before the check falls back to gating on motion alone. Default 2 suits Ospreys; apps like DirecTV that hold one player across channel changes need more. 0 or unset uses the default.
      - PLAYBACK_DELAY=${PLAYBACK_DELAY} # Hold every tune this long before handing the DVR the program, so a slow-starting app still records within the DVR's 30s window. Black or a mounted pre-roll fills the wait; the box's own video is never passed through. Accepts a bare number (seconds) or a duration like 30s/1m, capped at 10m. Network tuners only. Empty or 0 disables it.
      - ENCODER_CODEC=${ENCODER_CODEC:-h264} # The video codec your encoder outputs: h264 (default) or h265. Filler black/pre-roll must match it, or playback won't cross to the program at hand-off. Pre-roll video is converted to match; an existing H.265 stream is copied. Leave at h264 unless your encoder is H.265. Case-insensitive; h265/hevc both work.
      - HEARTBEAT_INTERVAL=${HEARTBEAT_INTERVAL:-180} # In supported scripts (currently osprey), seconds between keepalive keyevents sent during playback to stop the app's UI inactivity timer from resetting the stream. Default 180; set to 0 to disable.
      # ── NVIDIA GPU ──────────────────────────────────────────────────────────
      # Used by the CUDA caption engine and any CMDn calling h264_nvenc/hevc_nvenc. Needs the NVIDIA container toolkit.
      - NVIDIA_VISIBLE_DEVICES=${NVIDIA_VISIBLE_DEVICES} # For the CUDA caption engine and/or an NVENC CMDn. Set to all alongside DOCKER_RUNTIME=nvidia to expose an NVIDIA GPU. Empty means no GPU and is the default.
      - NVIDIA_DRIVER_CAPABILITIES=${NVIDIA_DRIVER_CAPABILITIES} # Set to compute,utility for the CUDA caption engine. A CMDn using h264_nvenc/hevc_nvenc also needs video - use compute,utility,video (or all).
    volumes:
      - ${HOST_DIR:-/data}/ah4c/config:/opt/config # Settings saved from the web interface
      - ${HOST_DIR:-/data}/ah4c/scripts:/opt/scripts # pre/stop/bmitune.sh scripts will be stored in this bound host directory under streamer/app
      - ${HOST_DIR:-/data}/ah4c/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
      - ${HOST_DIR:-/data}/ah4c/adb:/root/.android # Persistent data directory for adb keys
      - ${HOST_DIR:-/data}/ah4c/captions:/opt/captions # Closed caption settings, and the speech model, engine and any GPU driver downloaded from the Closed Captions page. Stays empty unless you turn captions on
      - ${PREROLL_FILE:-${HOST_DIR:-/data}/ah4c/preroll}:/opt/preroll # A video or still image shown to the DVR instead of NULL packets, during a PLAYBACK_DELAY/PLAYBACK_DETECTION hold or a NULL_FRAME_INSERTION stall. Set PREROLL_FILE to a host path, or drop the file into this directory. Anything ffmpeg reads; prepared once at startup, loops until the real stream is ready
    restart: unless-stopped

If you'd like to have as many options exposed as possible through the new Settings page, then you're going to want to use a more minimal Docker Compose (going this route will require you to set things up through the WebUI that were previously done through env vars).

Here's a recommended Docker Compose for that new minimal route. The Compose itself still requires no editing, but it has a much smaller set of potential env var overrides:

services:
  # 2026.09.16
  # GitHub home for this project with setup instructions: https://github.com/sullrich/ah4c
  # Docker Hub home for this project: https://hub.docker.com/repository/docker/bnhf/ah4c
  ah4c: # This docker-compose typically requires no editing. Use the Environment variables section of Portainer to set your values.
    image: bnhf/ah4c:${TAG:-latest}
    container_name: ${CONTAINER_NAME:-ah4c}
    hostname: ${HOSTNAME:-ah4c}
    dns_search: ${DOMAIN:-localdomain} # Specify the name of your LAN's domain, usually local or localdomain
    runtime: ${DOCKER_RUNTIME:-runc} # Closed captions only. Set DOCKER_RUNTIME=nvidia for an NVIDIA GPU with the CUDA engine build. Requires the NVIDIA container toolkit.
    devices:
      - ${GPU_DEVICE:-/dev/null} # Closed captions only. Set GPU_DEVICE=/dev/dri to let the Vulkan engine build use an Intel or AMD GPU. Left at the default it passes /dev/null, which always exists and does nothing.
    ports:
      - ${HOST_PORT:-7654}:7654 # Port used by this ah4c proxy
    environment:
      - AH4C_COMPOSE=2026.09.16 # Compose file date stamp - do not change. The startup log flags it when out of date.
      - NVIDIA_VISIBLE_DEVICES=${NVIDIA_VISIBLE_DEVICES} # For the CUDA caption engine and/or an NVENC CMDn. Set to all alongside DOCKER_RUNTIME=nvidia to expose an NVIDIA GPU. Empty means no GPU and is the default.
      - NVIDIA_DRIVER_CAPABILITIES=${NVIDIA_DRIVER_CAPABILITIES} # Set to compute,utility for the CUDA caption engine. A CMDn using h264_nvenc/hevc_nvenc also needs video - use compute,utility,video (or all).
    volumes:
      - ${HOST_DIR:-/data}/ah4c/config:/opt/config # Settings saved from the web interface
      - ${HOST_DIR:-/data}/ah4c/scripts:/opt/scripts # pre/stop/bmitune.sh scripts will be stored in this bound host directory under streamer/app
      - ${HOST_DIR:-/data}/ah4c/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
      - ${HOST_DIR:-/data}/ah4c/adb:/root/.android # Persistent data directory for adb keys
      - ${HOST_DIR:-/data}/ah4c/captions:/opt/captions # Closed caption settings, and the speech model, engine and any GPU driver downloaded from the Closed Captions page. Stays empty unless you turn captions on
      - ${HOST_DIR:-/data}/ah4c/preroll:/opt/preroll # A video or still image shown to the DVR instead of NULL packets, during a PLAYBACK_DELAY/PLAYBACK_DETECTION hold or a NULL_FRAME_INSERTION stall. Set PREROLL_FILE to a host path, or drop the file into this directory. Anything ffmpeg reads; prepared once at startup, loops until the real stream is ready
    restart: unless-stopped

And, here's a sample set of overrides for the minimal Compose:

TAG=beta
GPU_DEVICE=
HOST_DIR=/data

Here's what the new Settings page looks like:

Many thanks to @anon38303228, and I'm sure he'll add a post expanding on all the new features available through this beta.

2 Likes

so I've about had it with docker for windows. same old problems with reboots not starting portainer. an now tonight after windows update and docker update I'm getting this

failed to deploy a stack: compose up operation failed: Error response from daemon: ports are not available: exposing port TCP 0.0.0.0:7654 -> 127.0.0.1:0: /forwards/expose returned unexpected status: 500

I got that on my previously working stack, new stack, beta stack.. no ah4c for me

@Shaggylive I had a similar issue this morning with my Immich server port. Follow these steps and I bet it will fix it (use your port number not mine from the example)

Run this in an elevated PowerShell prompt on win11pc:
"PowerShell

netsh interface ipv4 show excludedportrange protocol=tcp"

Verification: Look through the start/end ranges. If 2283 falls inside any listed range, Windows has locked that port for system/hypervisor services.

  1. Release the Port Block ImmediatelyIn your Administrator PowerShell window, run:
"PowerShell

net stop winnat"

Run the check again to verify the block cleared:

"PowerShell

netsh interface ipv4 show excludedportrange protocol=tcp"

Permanent Fix: Lock 2283 Out of Dynamic Exclusions
Windows recalculates these dynamic pools on reboot, so port 2283 could get swallowed again down the road. You can prevent Windows from ever claiming it by adding an administered exclusion for Immich:

  ```"PowerShell

net stop winnat
netsh int ipv4 add excludedportrange protocol=tcp startport=2283 numberofports=1
net start winnat"
then deploy the stack in Portainer.

This was the first time I had ever seen this happen myself.