mkvinfo --summary "$f" | head -10 \
| perl -nle 'if ( /^Track (\d+): subtitles, codec ID: ([A-Z_]+).*extract track ID: (\d+)(?:, language: (\S+))?/ ) {
warn "$_=$1: type=$2, xtrack=$3, lang=$4\n"; print "$2 $3 $4" }' \
| while read type t lang; do d=$(dirname "$f"); b=$(basename "$f");
echo "#Run this:# mkvextract tracks \"\$f\" $t:'$d/$b-$lang-$t.$type'"; done
Track 3: subtitles, codec ID: S_TEXT/UTF8, mkvmerge/mkvextract track ID: 2, language: por = 3: type=S_TEXT, xtrack=2, lang=por
Track 4: subtitles, codec ID: S_TEXT/UTF8, mkvmerge/mkvextract track ID: 3, language: eng = 4: type=S_TEXT, xtrack=3, lang=eng
...
# mkvextract tracks "$f" 2:'./2-Death.to.2020.2020.720p.WEBRip.800MB.x264-GalaxyRG.mkv-por.S_TEXT'
# mkvextract tracks "$f" 3:'./3-Death.to.2020.2020.720p.WEBRip.800MB.x264-GalaxyRG.mkv-eng.S_TEXT'
...
mkvextract chapters -s $mkvfile | tee $mkvile-chapters.txt
mkvextract chapters $mkvfile | tee $mkvile-chapters.xml
mkvpropedit $mkvfile --chapters $mkvile-chapters.txt
perl -ne 'BEGIN{$fps=24}; $c=sprintf("CHAPTER%02d", $n++);
($tc, $name)=split(/\t/);
$tc =~ s!:(\d\d)$!sprintf(".%03d",$1*1000/$fps)!e;
print "$c=$tc\n",
"${c}NAME=$name"' $My_ChaptersList_File