mux-media

Crates.iomux-media
lib.rsmux-media
version0.16.2
created_at2025-07-15 17:53:55.617959+00
updated_at2026-01-20 23:19:04.689063+00
descriptionA CLI utility for muxing media (e.g. video, audio, subtitles).
homepage
repositoryhttps://github.com/nujievik/mux-media
max_upload_size
id1753660
size373,117
(nujievik)

documentation

README

mux-media

A CLI utility for muxing media (e.g. video, audio, subtitles).

Tests

Quick Start

  1. Download an archive for your system.

  2. Unpack it.

  3. Run the unpacked mux-media in a media directory.

Default Behaviour

  • Saves muxed files to the muxed subdirectory.
  • Muxes all media extension files in a CWD directory and 16 its subdirectories.
  • Muxes all files with a same filename prefix (eg., Death Note - 01.mkv and Death Note - 01.eng.aac) to single MKV-container.
  • Skips orphan files without an other same filename prefix file.
  • Attachs all founded *.OTF & *.TTF fonts to each output MKV.

Supported Extensions 📁

Input

File Type Extensions
Media 264 265 3GP AAC AC3 ASS AV1 AVC AVI CAF DTS DTSHD EAC3 EC3 F4V FLAC FLV H264 H265 HEVC IVF M2TS M2V M4A M4V MKA MKS MKV MLP MOV MP2 MP3 MP4 MPA MPEG MPG MPV OBU OGG OGM OGV OPUS RA SRT SSA SUB SUP THD TRUEHD TS TTA VC1 VTT WAV WEBA WEBM WMA WMV X264 X265
Font OTF TTF

Output

MKV container.

Advanced Use 🤓

Run mux-media -h to display help.

Description
I/O options:
-i, --input <dir> Top-level media directory
-o, --output <out[,put]> Output paths pattern: out{num}[put]
-r, --range <n[-m]> Number range of media-files
--skip <n[,m]...> Patterns of files to skip
--depth <n> Scan subdirectories up to this depth
--solo Process media without external tracks
Global options:
-l, --locale <lng> Locale language (for logging and sort)
-j, --jobs <n> Max parallel muxing
-v, --verbose... Increase logging
-q, --quiet Suppress logging
-e, --exit-on-err Skip muxing next files if error occurs
--load <json> Load config from JSON
--save-config Save config to JSON in the input directory
Auto flags:
-p, --pro Disable all auto below
--auto-defaults / --no-auto-defaults Auto set default flags
--auto-forceds / --no-auto-forceds Auto set forced flags
--auto-names / --no-auto-names Auto set stream names
--auto-langs / --no-auto-langs Auto set stream langs
--auto-encs / --no-auto-encs Auto set subs encodings
Save streams:
-a, --audio <[!]n[,m]...> [!]Save audio streams
-A, --no-audio Don't save any audio stream
-s, --subs <[!]n[,m]...> [!]Save subtitle streams
-S, --no-subs Don't save any subtitle stream
-d, --video <[!]n[,m]...> [!]Save video streams
-D, --no-video Don't save any video stream
-f, --fonts <[!]n[,m]...> [!]Save font attachments
-F, --no-fonts Don't save any font attachment
-m, --attachs <[!]n[,m]...> [!]Save other attachments
-M, --no-attachs Don't save any other attachment
Target options:
-t, --target <trg>... Set next options for target
--list-targets Show supported targets
--streams <[!]n[,m]...> [!]Save streams
--no-streams Don't save any stream
-C, --no-chapters Don't save chapters
--defaults <[n:]B[,m:B]...> Set default flags
--max-defaults <n> Max auto-enabled default
--forceds <[n:]B[,m:B]...> Set forced flags
--max-forceds <n> Max auto-enabled forced
--names <[n:]N[,m:N]...> Set stream names
--langs <[n:]L[,m:L]...> Set stream languages
Retiming options:
--parts <[!]n[,m]...> [!]Save parts for chapter names
--no-linked Remove matroska linked parts
Other options:
--list-langs Show supported language codes
-V, --version Show version
-h, --help Show help

Alternative CLI, you can configure a JSON file in a top-level media directory.

Manual Build 🤓

See examples in workflows.

Shared-ffmpeg Build

  1. Install Rust

  2. Configure ffmpeg-next build

  3. Clone the repo:

git clone https://github.com/nujievik/mux-media --depth 1
  1. Enter the project directory:
cd mux-media
  1. Build:
cargo build --release --locked

On success, the binary will be in target/release/mux-media.

Static-ffmpeg Build

Run steps 1-4 and then:

Unix

Use ffmpeg-build feature:

cargo build --release --locked --features ffmpeg-build

Windows

  1. Install static ffmpeg:
vcpkg install ffmpeg:x64-windows-static-md
  1. Set VCPKG_ROOT variable to vcpkg.exe directory.

  2. Set RUSTFLAGS:

set RUSTFLAGS=-l mfplat -l mf -l mfuuid -l strmiids -l ole32 -l uuid
  1. Use ffmpeg-static feature:
cargo build --release --locked --features ffmpeg-static

Alternative GUI Utilities

There are alternative utilities with user-friendly GUI interfaces, though they offer less automation:

Commit count: 118

cargo fmt