TrackRemux is a powerful Terminal User Interface (TUI) tool designed to help you clean up your video library. It allows you to interactively specify audio and subtitle tracks from your video files and remux them into clean, optimized containers without re-encoding the video stream.
This whole project was vibe coded on a Friday evening out of necessity while organizing the media library on my NAS.
Tip
Check out the CHANGELOG to see what's new in the latest version!
Modern media often comes with a bloat of unnecessary tracks - commentary audio, multiple languages you don't speak, or dozens of subtitle formats. TrackRemux simplifies the process of removing this clutter.
This not only saves significant disk space but also prevents the confusion and inconvenience of managing tracks in media players (like those on Smart TVs or mobile devices) where selecting the right audio or subtitle stream can be cumbersome or even impossible.
Instead of wrestling with complex ffmpeg command-line arguments for every single file, TrackRemux provides a visual interface to:
- Scan directories for video files.
- Select exactly which tracks you want to keep.
- Remux the file efficiently (Direct Stream Copy).
- Interactive TUI: Built with
cursesfor a fast, keyboard-centric workflow. - Batch Processing: Automatically detects and processes TV shows/series/collections sequentially.
- Smart Detection: Recognizes series patterns (S01E01, 1x01, Ep01) and groups by season.
- Strict Structural Fingerprinting: Safely groups files based on an identical layout of tracks, strictly enforcing matching track counts, languages, codecs, and channel layouts (e.g., separating WebDL AAC 2.0 files from Blu-Ray DTS-HD 5.1 files).
- Unified Editing: Edit one file, and automatically apply the same track selections and logical reordering (e.g., move Japanese audio to bottom) across the entire batch regardless of internal stream ID numbering.
- Seamless Workflow: Returning from a batch conversion automatically refreshes the selector view with updated metadata, allowing for a continuous "process next batch" rhythm.
- Rich Meta-data Explorer:
- Displays file sizes, track counts, and audio languages at a glance.
- Visual Status Indicators: Instantly spot files that have already been converted (Green size) or are currently processing (Dim Yellow).
- Folder Navigation: Browse nested directory structures (
Enterto open,Escto go back).
- Deep Track Inspection:
- Track Reordering: Move tracks up/down with
Shift+Arrowkeys to set their index in the final file. - External Tracks: Automatically detects and integrates external audio/subtitle files (even in
Audio/orSubs/subfolders). - Language Management: Guesses 30+ language formats or supports manual setting via the
[L]key. - Smart Language Inference: Automatically recovers missing track languages from stream titles (e.g. "Russian") during scansβperfect for legacy AVI collections where language tags are often missing.
- Metadata Persistence Bridge: When you manually set a language for an AVI track, it's also saved into the stream title, ensuring the setting "sticks" and survives re-probes.
- Donor Audio Track Import: Press
[D]to import fully synced, dubbed audio tracks directly from alternative movie releases sitting elsewhere in your library (Hybrid Remuxing). Built-in bulkebur128deep analysis computes sub-millisecond sync offsets instantly without guesswork.
- Track Reordering: Move tracks up/down with
- Intelligent Output Management:
- Three Output Modes: Choose between
[O]verwrite(atomic in-place replacement),[L]ocal (saveconverted_*to CWD), or[R]emote (saveconverted_*next to source files). - Smart Batch Output: Batch conversions automatically create a
converted_<directory>/folder with original filenames preserved, instead of prefixing every file. - NAS-Safe Atomic Swaps: Overwrites are safely processed in a hidden
.trackremux_staging/directory and shifted via instantaneous atomic swaps to avoid media server race conditions, keeping original files safely in.trackremux_trash/for recovery. - Read-Only Detection: Automatically warns when the source filesystem is read-only, preventing failed Overwrite/Remote saves.
- Three Output Modes: Choose between
- Intelligent HD Audio Fallbacks (THD/DTS β EAC3/AC3):
- Automatically transcode high-bitrate incompatible formats (DTS-HD MA, TrueHD, DTS) down to universally compatible
EAC3 5.1(1024kbps) orAC3 640kvia the[C]hotkey. - Features a robust encoding safety net: if your version of
ffmpegencounters layout limitations (e.g. failing to encode 7.1 to EAC3), it automatically catches the failure and falls back to the next-best conversion format without breaking the batch. - Features dynamic
THD,DTS, orPCMbadges directly inside the Explorer file list, includingDTS>AC3etc. tracking conditionally encoded streams. - Added
[D]hotkey to explicitly filter media list views exclusively to files with high-definition audio formats (TrueHD, DTS, PCM).
- Automatically transcode high-bitrate incompatible formats (DTS-HD MA, TrueHD, DTS) down to universally compatible
- Smart Configurations & Profiles:
- Build and utilize default setting profiles (
keep_langs,discard_langs,ac3preference overrides). - Interactive profile editor overlay via
[P]β Enter to edit fields, cursor navigation, Enter to confirm and auto-save, Escape to discard changes. - Profiles can be intelligently evaluated and interactively applied with
[A]across matches to dramatically accelerate repetitive multi-file adjustments.
- Build and utilize default setting profiles (
- Safe Conversion:
- Uses
ffmpegfor robust processing. - Identifies edited assets automatically tracking changes reliably even across format shifts with its own
.mkvmetadata tag system:trackremux_id. - Real-time accurate progress tracking based on frame ratios rather than arbitrary byte streams, complete with dynamically recalculated size reduction estimates during audio transcoding.
- Uses
Scan any folder to instantly see track counts and sizes.

Pick exactly what you need. Audio previews help distinguish between different dubs or commentaries.

TrackRemux finds external subtitle/audio files automatically. You can also manually correct missing language tags.

Watch the progress in real-time as ffmpeg remuxes your file at disk-IO speeds.

Press [S]ave to instantly queue files. The background worker remuxes them sequentially while you continue browsing and queuing more content. Press [V] to monitor the queue and view detailed stats for each task. The queue is fully multi-instance safe and supports auto-recoveryβif your SSH session drops or your Mac restarts, simply open TrackRemux again and it will instantly adopt and resume any abandoned tasks.

Final sizes and success messages are displayed directly in the TUI upon completion.

Remuxing is lossless and fast. You can see the significant size savings in your directory listing without any quality loss.

- Python 3.10+
- FFmpeg must be installed and accessible in your system PATH.
- macOS:
brew install ffmpeg
- macOS:
The easiest way to use TrackRemux is to install it globally using uv:
uv tool install trackremuxOnce installed, you can simply run trackremux from any directory.
If you prefer to run it directly from the repository:
-
Clone the repository:
git clone https://github.com/antimirov/trackremux.git cd trackremux -
Run using the wrapper:
python3 trackremux.py /path/to/media
-
Run as a module:
python3 -m trackremux /path/to/media
-
Using
uv(for development):uv sync uv run trackremux /path/to/media
You can point TrackRemux to a directory (Explorer Mode) or a specific video file (Editor Mode).
Browse and process your entire library:
trackremux /path/to/your/moviesJump straight into the track editor for a specific file:
trackremux "My Movie.mkv"| Key | Action |
|---|---|
| β / β | Navigate file list |
| PgUp / PgDn | Scroll pages |
| Enter | Open selected file in Editor |
| B | Open Batch Selector (when batches detected) |
| D | Toggle Filter: All / HD Audio only |
| M | Toggle Mouse Support |
| V | Open Background Task Queue |
| R | Force re-scan current directory |
| N / S / T / A | Sort by Name, Size, Tracks, Audio Size |
| Q / Esc | Quit Application |
| Ctrl+C | Force Quit instantly |
| Key | Action |
|---|---|
| Space | Toggle Track (Keep/Discard) |
| Enter | Preview Track (Audio only) |
| β / β | Seek in preview |
| β / β | Navigate Tracks |
| Shift+β / β | Move selected track UP / DOWN |
| L | Set Language (manual edit) |
| C | Toggle HD Audio conditioning (THD/DTS β EAC3/AC3) |
| P | Open Profile editor (keep/discard languages, AC3 preference) |
| A | Apply saved profile to current file |
| M | Toggle Mouse Support |
| S | Save β Select output mode ([O]verwrite / [L]ocal / [R]emote) and enqueue |
| Esc / Q | Back to Explorer |
See ROADMAP.md for the full feature roadmap. Highlights:
- β Batch Processing β Completed in v0.6.0
- β In-Place Saving β Overwrite / Local / Remote output modes β Completed in v0.7.0
- β Audio Conditioning β Flatten DTS-HD / TrueHD to AC3 for universal playback β Completed in v0.7.0
- β Smart Defaults β Auto-select tracks based on language config profiles β Completed in v0.7.0
- β
Hybrid Remuxing β Donor Track Import with automatic
ebur128sync detection β Completed in v0.9.0 - β‘ Track Metadata β Edit titles, set default/forced disposition flags
- π€ Subtitle Sync β Shift subtitle tracks Β±N ms directly in the TUI before muxing
- π₯ Library Health Checks β Detect corrupted bitstreams across large libraries
- π§ Dry Run / Export β Generate
.shscripts for remote NAS execution
MIT License. See LICENSE for more details.

