Como remover legendas:
mkvmerge -o output.mkv input.mkv -S # remove all subtitle tracks
mkvmerge -o output.mkv input.mkv -s 3,4 # remove tracks 3 and 4
mkvmerge -o output.mkv input.mkv -s '!3' # remove all subtitle tracks except 3
mkvmerge -i input.mkv # show track numbers
Adicionando legendas:
mkvmerge -o output.mkv input.mkv subs.srt
mkvmerge -o output.mkv input.mkv --language 0:ger --track-name 0:German subs.srt
Extraindo legendas:
mkvextract tracks input.mkv 3:subs.srt
for f in *.mkv; do
sub=$(mkvmerge -i "$f" | awk '$4=="subtitles"{print;exit}')
[[ $sub ]] || continue
[[ $sub =~ S_TEXT/ASS ]] && ext=ass || ext=srt
track=$(awk -F '[ :]' '{print $3}' <<< "$sub")
mkvextract tracks "$f" "$track:${f%mkv}$ext"
done
O mkvmerge e o mkvextract podem ser instalados com brew install mkvtoolnix
.