Go to the directory where your files are.
Make sure ffmpeg is installed.
Use the following command to process the files.
1localhost ~$ for x in *.mkv; do ffmpeg -i "$x" -map 0:v -map 0:a:0 -map 0:s -c copy -c:a ac3 -b:a 640k "ac3-$x"; doneshell
Explanation: this command finds all .mkv files in the current direcory and converts the first audiostream to ac3 with a bitrate of 640k. The files are renamed with an “ac3-” prefix, so you can compare the result.
Remove the old files after you have checked if the audio is still correct and synced to the video. Enjoy your video files.