Skip to content

Instantly share code, notes, and snippets.

@jfeilbach
Last active May 4, 2019 17:02
Show Gist options
  • Select an option

  • Save jfeilbach/a9909a8fc62a3376ff58dc683d561987 to your computer and use it in GitHub Desktop.

Select an option

Save jfeilbach/a9909a8fc62a3376ff58dc683d561987 to your computer and use it in GitHub Desktop.
strip all non english audio tracks and all subtitles from mkv
#!/bin/bash
# keep only audio track 1
# keep no subtitle tracks
# or use -map 0:m:language:eng
LOGLEVEL='warn'
OPTS='-hide_banner -loglevel ${LOGLEVEL}'
for x in *.mkv ; do
echo ${x}
ffmpeg ${OPTS} -i "${x}" -map 0:v -map 0:a:0 -map -0:s -c copy "new-${x}"
# ffmpeg -hide_banner -loglevel info -i "${x}" -map 0:v -map 0:m:language:eng -map -0:s -c copy "new-${x}"
done
rm -fv !(new-*.mkv)
for n in new-*.mmkv ; do
mv -v "$n" "$(echo "$n" | sed s/new-//)"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment