Skip to content

Instantly share code, notes, and snippets.

@Dreyer
Last active January 5, 2017 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dreyer/24335128294f10a1d23ce64960a25abf to your computer and use it in GitHub Desktop.
Save Dreyer/24335128294f10a1d23ce64960a25abf to your computer and use it in GitHub Desktop.
Batch edit the properties of Matroska files.
#!/bin/bash
#
# Iterate through every .MKV file in the current directory and use the
# filename base as the title while assigning the second subtitle track
# as the default and the second audio track as the default.
#
# Requires mkvpropedit from MKVToolNix:
# https://github.com/mbunkus/mkvtoolnix
#
for file in *.mkv; do base=${file%.*}; mkvpropedit "${file}" --edit info --set "title=${base}" --edit track:s1 --set flag-default=0 --edit track:s2 --set flag-default=1 --edit track:a1 --set flag-default=0 --edit track:a2 --set flag-default=1; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment