This repository provides a Python-based command-line tool to batch process .mkv files within a specified directory. It allows you to remove specific language audio tracks and set a desired language as the default.
- Traverse a specified directory to identify
.mkvfiles. - Remove unwanted language audio tracks (e.g., Russian, Spanish).
- Set a specific language audio track (e.g., English) as the default.
- Supports both overwrite mode and duplicate mode to maintain original files.
- Generates detailed logs for each operation.
- Python 3.6 or newer.
- The following utilities must be installed:
- mkvmerge and mkvpropedit from MKVToolNix suite.
- For users on Ubuntu:
sudo apt-get install mkvtoolnix
- For users with Chocolatey on Windows:
choco install mkvtoolnix
- For manual installation, visit the MKVToolNix download page.
- Install Python (if not already installed).
- Install MKVToolNix.
- Clone this repository:
git clone https://github.com/FREQ-EE/mkv-audio-track-processor.git cd mkv-audio-track-processor
- Run the script to process
.mkvfiles within a specified directory:python mkv_audio_track_processor.py
- During runtime, the script will prompt for the following inputs:
- Directory Path: Specify the path to the directory containing
.mkvfiles to be processed. - Languages to Remove: Provide the languages you wish to remove, separated by commas (e.g.,
ru, es, it). - Default Language: Specify which language should be set as the default (e.g.,
en).
- Directory Path: Specify the path to the directory containing
The script will then proceed to process each .mkv file in the directory. A summary log will be saved in the logs folder, including information about the files examined, updated, and those that had no track for the specified default language.
Note: If multiple tracks for the desired default language are found, the first occurrence will be set as the default.
- Overwrite Mode (Default): The original
.mkvfile is modified directly. - Duplicate Mode: Creates a new file with a
_processedsuffix, retaining the original file.- To enable this mode, change
modein the script to1:mode = 1
- To enable this mode, change
Logs are created for each session under the logs/ directory, providing summaries such as:
- Root directory traversed.
- Number of
.mkvfiles examined. - Number of files updated with the default language.
- Files without the specified default language.
This project is licensed under the MIT License - see the LICENSE file for details.