Skip to content

Instantly share code, notes, and snippets.

@Diftraku
Created March 24, 2020 19:13
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 Diftraku/b3b759f12402ede3c93aeb81b4583799 to your computer and use it in GitHub Desktop.
Save Diftraku/b3b759f12402ede3c93aeb81b4583799 to your computer and use it in GitHub Desktop.
Dump specific subtitle tracks from MKV files to appropriate .srt files
#!/bin/bash
SUB_TRACKS="2:jpn 3:eng"
find . -type f -iname "*.mkv" -print0 | while IFS= read -r -d '' file; do
TITLE=$(basename "${file}" .mkv)
echo $TITLE
for track in $SUB_TRACKS; do
TRACK_ID=$(echo $track | cut -d':' -f1)
TRACK_LANG=$(echo $track | cut -d':' -f2)
mkvextract tracks "${file}" "${TRACK_ID}:${TITLE}.${TRACK_LANG}.srt"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment