EXPERT SPECS

Deep-dive technical documentation detailing thread execution queues, FFmpeg bitstream multiplexing, automated fallback mechanics, and metadata isolation flags.

FFmpeg Command Architecture

Master Remux Tool uses high-performance FFmpeg flags optimized for non-destructive bitstream copy operations with strict no-overwrite enforcement (-n).

Pass 1: Full-Stream Bitexact Remuxing

ffmpeg -hide_banner -loglevel error -i "%filepath%" -map 0 -c copy -map_metadata 0 -map_metadata:s:v 0:s:v -map_metadata:s:a 0:s:a -fflags +bitexact %meta_flags% -metadata encoder="" -metadata compatible_brands="" -metadata major_brand="" -metadata minor_version="" -metadata rating="" "%out%" -n
Parameter Flag Technical Purpose
-hide_banner -loglevel error Suppresses build configuration output and restricts stderr streams purely to fatal execution errors.
-map 0 -c copy Maps all streams (video, audio, subtitles, attachments) and forces direct stream-copy mode without video/audio transcoding.
-map_metadata 0 Preserves global container metadata headers (title, artist, album, commentary).
-map_metadata:s:v 0:s:v Maps video stream specific metadata tags, preserving HDR info, color space tags, and cover artwork metadata.
-map_metadata:s:a 0:s:a Maps individual audio channel descriptors, language ISO tags, and track numbering.
-fflags +bitexact Disables writing Lavf/Lavc build timestamp tags to ensure reproducible bitexact output files.
-movflags +faststart Relocates MOOV atom header to the start of file on MP4/M4A/MOV outputs for fast web streaming and scrubbing.
-metadata encoder="" Purges non-standard default encoder strings (e.g., Lavf60.16.100) for pristine clean header output.
-n Strict no-overwrite flag ensuring destination output files are never overwritten if they already exist.

Pass 2: Audio-Only Fallback Routine

If container specs (such as extracting audio to .m4a or .mp3) reject video streams, cover art attachments, or complex subtitle tracks during Pass 1, the engine cleans up corrupt partial output files and automatically executes Pass 2:

ffmpeg -hide_banner -loglevel error -i "%filepath%" -map 0:a -c copy -map_metadata 0 -map_metadata:s:a 0:s:a -fflags +bitexact %meta_flags% -metadata encoder="" -metadata compatible_brands="" -metadata major_brand="" -metadata minor_version="" -metadata rating="" "%out%" -n

Pass 2 isolates -map 0:a (audio streams only), guaranteeing successful extraction even when demuxing audio out of heavily tagged MKV/MP4 video containers.

Auto-Detect Codec Probe Mapping

When selecting Menu Option 0 (AUTO-DETECT), the script queries stream 0's native audio format via FFprobe:

ffprobe -v error -select_streams a:0 -show_entries stream=codec_name -of default=noprint_wrappers=1:nokey=1 "%filepath%"

The resulting codec string is dynamically translated into a compatible native audio container file extension:

Detected Audio Codec Mapped Extension Container Format
aac, alac .m4a MPEG-4 Audio Container
vorbis .ogg Ogg Vorbis Audio Container
pcm_s16le, pcm_s24le, pcm_* .wav Waveform Audio File Format
flac .flac Free Lossless Audio Codec
ac3, eac3 .ac3 Dolby Digital Stream
opus .opus Opus Audio File
mp3 .mp3 MPEG Layer III Audio

Queue Processing Architecture

[01]
CP 65001 Enforcer

Forces Windows code page to UTF-8 (chcp 65001), enabling error-free processing of foreign file paths, Asian characters, and emoji tags.

[02]
Collision-Proof Temp Queue

Constructs a randomized lock queue file in %temp%\remux_q_%random%%random%.txt using custom delimiters (TYPE|FOLDER|PATH) for collision-proof iteration.

[03]
Recursive Folder Mirroring

Scans nested subdirectories (dir /b /s /a-d), automatically cloning input folder hierarchies inside the target Converted\ destination.

[04]
Input Sanitization Guard

Sanitizes custom extensions against illegal NTFS characters (\ / : * ? " < > | .) with automated empty-string rejection guards.