Skip to content

wpdevelopment11/mkvdefault

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

Change the default track in an MKV file

Suppose you want to watch an mkv file that contains multiple tracks in the same language. You want to select one of them. It's annoying to constantly switch the track to a desired one in your media player, if the default one is not the track you want.

Your media player chooses the track to play based on the default flag. If it's set to 1, the player selects it. Usually there is at least one default track of each type: one for audio, video and subtitles.

You can change the default track using mkvpropedit, but that is not convenient. You need to specify the new default track using its number, you can't use its name. Additionally, you need to remove the default flag from the previous default track manually, again, by specifying its number.

Thus, I present you a small wrapper over mkvpropedit that simplifies the process of changing default track in an MKV file. See examples below how to use it.

Prerequisite:

Install MKVToolNix and add it to your PATH.

Example

Replace movie.mkv in the examples below with a path to your MKV file.

To set the second audio track as a default, run:

./mkvdefault.py -p -t audio 2 movie.mkv

To set the default flag to the track which contains shows in its name, run:

./mkvdefault.py -p shows movie.mkv

To set the second audio track as a default in all MKV files in the current working directory, run:

./mkvdefault.py -t audio 2

Usage

mkvdefault.py [-h] [-p] [-s] [-t type] name|number [file ...]

Positional arguments:
  name|number           Name of the new default track or its number
  file                  An MKV file in which you want to change the default track. If not provided, the CWD is used to discover files with an .mkv extension

Options:
  -p, --print           Print the tracks before and after modification
  -s, --same-lang       Reset the previous default only if the language is the same
  -t, --default-type type
                        Type of the default track. Type can be audio, subtitles, or video
  -h, --help            Show this help message and exit

About

A Python script to quickly change the default track in an mkv file

Topics

Resources

License

Stars

Watchers

Forks

Languages