ffmpeg – Re-encode audio using qaac.exe (Multiple Audio Streams)

I have tried the script below posted on another question but how do i amend this script to convert all audio streams to AAC using the qaac encoder? The script below is only converting the first audio stream. I would also like to keep the video and all subtitles streams the same and also keep the original audio stream names the same as the original file.

(FFMPEG) Re-encode audio using qaac.exe

@ echo off

for %%a in (*.mkv) do ("ffmpeg" -i "%%~na.mkv" -f wav - | qaac -a 160 - -o "%%~na.m4a" --threading)

for %%a in (*.mkv) do (ffmpeg -i "%%~na.mkv" -i "%%~na.m4a" -c:v copy -c:a copy -map 0:0 -map 1:0 "%%~na_.mkv")

Read more here: Source link