Skip to content

Instantly share code, notes, and snippets.

@alimbada
Last active April 29, 2022 07:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alimbada/98505cfdd8a55f1e05ce066f82f37265 to your computer and use it in GitHub Desktop.
Save alimbada/98505cfdd8a55f1e05ce066f82f37265 to your computer and use it in GitHub Desktop.
Use mkvextract to extract subtitles from a directory of MKV files into SRT files
# Subtitle track number is usually the same for a whole series and usually for all encodes from a specific place
# Use this first to ascertain the track number
# find . -iname '*.mkv' -maxdepth 1 -exec sh -c "ffprobe -hide_banner -i '{}' 2>&1 | grep Subtitle | cut -d':' -f2 | cut -d'(' -f1 " \;
find . -iname '*.mkv' -maxdepth 1 -exec basename {} .mkv \; | xargs -I {} mkvextract tracks '{}.mkv' ${SUBTITLE_TRACK_NUMBER}:'{}.srt'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment