- Use mkvmerge -i or ffprobe to list tracks.
- Parse output to construct mkvextract or ffmpeg commands.
- Preserve naming conventions: filename_tracktype_language.ext (e.g., movie_audio_en.ac3).
- Log metadata (track IDs, language, codec) to a CSV alongside extracted files.
Example (bash pseudo-steps):
for f in *.mkv; do mkvmerge -i "$f" > "$f.info" # parse the info and run mkvextract accordingly done
Remuxing after editing
If you edit or replace streams, remux with mkvmerge to reassemble:
mkvmerge -o new.mkv --language 0:eng --track-name 0:"Main Video" video.h264 --language 0:eng audio.ac3 --language 0:rus subtitle.ass
Keep metadata (default/forced flags, chapter files, attachments) in mind and reapply as needed.
Quality assurance: testing and verification
- Play new files in multiple players (MPV, VLC) to check A/V sync and subtitle rendering.
- Use ffprobe or mkvinfo to confirm stream count, codecs, and metadata.
- Compare checksums of unchanged streams (if possible) to ensure lossless extraction.
Example workflows (concise)
- Quick extract for editing: mkvextract tracks -> import into NLE -> edit -> export -> remux with mkvmerge.
- Subtitle translation: mkvextract subtitles -> edit in Aegisub -> convert/clean -> remux or distribute as SRT.
- Archive: extract all tracks + attachments -> store with metadata file -> delete or compress originals.
Final tips
- Prefer mkvtoolnix for Matroska-specific tasks; use ffmpeg for format conversions.
- Preserve attachments (fonts) if subtitles use custom styles.
- Test remuxed output in the intended playback environment.
- Automate repetitive tasks but keep logs to avoid mistakes.
If you want, I can provide ready-to-run scripts (bash/PowerShell) to batch demux all streams from a folder of MKV files and generate a CSV manifest.
Leave a Reply