Skip to content

Plex audio default-compat fixer

Script: forge/scripts/forge_plex_default_audio_compat.sh Host: runs from Console, SSHes to plex host, operates on /mnt/storage/movies Tool dep: mkvtoolnix (mkvpropedit + mkvmerge), installed on plex 2026-05-03

Why this exists

Plex on Android TV (Google TV Streamer) and Apple TV stalls infinitely on UHD remuxes whose default audio track is TrueHD Atmos or DTS-HD MA. Root cause: clients can't bitstream lossless to typical AVR/soundbar, Plex tries to transcode lossless audio on the fly while the client direct-streams 60+ Mbps HEVC video, server falls behind, infinite buffer.

Symptom: file plays in VLC/file browser fine, but Plex spins forever. Other movies (smaller files OR same codec but with AC3/DTS as default) play instantly.

What it does

For every .mkv under /mnt/storage/movies: 1. Read tracks via mkvmerge -J 2. If default audio is already AC3/EAC3/AAC/etc, skip (already compat) 3. Else find first AC3/EAC3 track in the file 4. If found: clear default flag on lossless, set default flag on AC3 via mkvpropedit (instant, header-only, zero re-encode, zero risk) 5. If no AC3 alternative: flag for separate phase (re-encode pass to add AC3 sidecar track)

Idempotent. Re-running on already-fixed files is a no-op.

Usage

# Dry-run (default), shows what would change
/home/justinwieb/forge/scripts/forge_plex_default_audio_compat.sh

# Apply, no scan
/home/justinwieb/forge/scripts/forge_plex_default_audio_compat.sh --apply

# Apply + trigger Plex movies-library refresh
/home/justinwieb/forge/scripts/forge_plex_default_audio_compat.sh --apply --rescan-plex

2026-05-03 first-run results

  • 170 MKVs scanned in /mnt/storage/movies
  • 117 already had compat default (skipped)
  • 40 flipped (TrueHD/DTS-HD MA → AC3/EAC3 default)
  • 13 stragglers need re-encode (no AC3 alt). Includes LOTR trilogy, Interstellar, Parasite, Mad Max: Fury Road, Star Wars Ep II/V/Rogue One (NAHOM rips), No Country for Old Men, The Departed, Alien Director's Cut, Your Name, Pianist, Ex Machina, Donnie Darko, Spotlight, Killers of the Flower Moon, etc. Build a phase-2 script for these.

Phase 2: AC3 add pass

Script: forge/scripts/forge_plex_add_ac3_track.sh

For files with no AC3/EAC3 at all, transcodes the existing default audio (English-preferred, falls back to default flag, then first track) down to a new AC3 5.1 track inside the same MKV. Stream-copies video and all other tracks. ~2-4 min per file. Idempotent.

Source-audio picker priority: English+default → English → default → first. Avoids picking foreign-language tracks on multi-lang rips (Spotlight, NAHOM Star Wars Italian/English duals).

Same --apply / --rescan-plex flags as phase 1.

2026-05-03 first run: 48 files queued. ~2-2.5 hour batch on plex.

Permanent fix going forward

Configure Radarr custom format to penalize releases without AC3/EAC3 audio tracks, so new downloads don't reintroduce the problem. Not yet wired (TODO).

[Claude Code]