|Elis Axelsson 5b90a2f12d Added tested environment info||3 years ago|
|LICENSE||3 years ago|
|README.md||3 years ago|
|mkvtrackcleaner||3 years ago|
Tool to bulk-remux mkv-files from tracks of unwanted languages.
It will go through all files in a given directory or work on a single file. Then it will identify all tracks in that file and remove all tracks marked with a language that isn’t in the list of wanted languages.
und as a language. Lots of files out there with only one
audio or subtitle track got it’s only track marked as
language, so you probably always want to have
und in your list of
If the script filter away all audio tracks, it will choose to not touch them at all. Instead it will keep all the audio tracks.
The script will also disable the default-track flag from all audio-tracks to let the player decide which track to play. This may be based on order of the tracks or the language of the track. It differs from player to player.
This script may remove all subtitle tracks if there’s no tracks matching the wanted languages list. So you may end up without subtitles.
This script will also disable the default-track flag from all subtitles to let it be up to the player to decide which one to use, based on order or language tag of the track. It differs from player to player.
Either edit the
WANTED_LANGS array at the top of the script or create
a config-file to alter the same variable to define which languages you
want to keep, then run the script like this:
or like this:
The config is a simple bash-script that the script sources, it allows you to override some variables.
Put the configfile in
$XDG_CONFIG_DIR/mkvtrackcleaner.conf which by
So, for example if you want to extend the
WANTED_LANGS list you could
have a file that looks like this (to add norwegian):
WANTED_LANGS+=( "nor" )
Or you can just override the entire list and roll your own:
WANTED_LANGS=( "und" "eng" )
Variables that’s possible to alter includes:
$WANTED_LANGS-- Array with wanted languages in three letter codes.
$MKVMERGE-- Path to the
$PRINTF-- Path to the
$FIND-- Path to the
$GREP-- Path to the
$SED-- Path to the
$CUT-- Path to the
$WC-- Path to the
$GREP_MATCH_AUDIO-- Regex to match audio tracks.
$GREP_MATCH_SUBS-- Regex to match subtitle tracks.
$SED_EXTRACT_INFO-- Regex to extract info about a track.