Kimiko-obasan ✨ @Kimiko_0@witches.town
Suivre

@Maverynthia Hmm, you could assume that the track number of the audio you want is the same for every video in a release, but it's not guaranteed the creators were consistent of course.

With that assumption, do the first line as before to find the track number, then change the other two lines to
> for f in *.mkv
> do
> bn=`basename "${f}" .mkv`
> ffmpeg -hide_banner -y -i "${f}" -vn -sn -map "♪" -c ac3 ♬.ac3
> mkvmerge --disable-track-statistics-tags -o "${bn}-new.mkv" -A "${f}" --language 0:jpn ♬.ac3
> done
And then you can clean up the old files.