The following command will find all mkv files that are in the current directory and in all sub-folders and extract the audio to mp3 format.
find . -type f -name "*.mkv" -exec bash -c 'FILE="$1"; ffmpeg -i "${FILE}" -vn -c:a libmp3lame -y "${FILE%.mkv}.mp3";' _ '{}' \;
The filename of the audio file will be the same as the mkv video with the correct extension. The mkv extension will be removed and replaced by the mp3 extension e.g hi.mkv
will create a new file named hi.mp3
This post is also available in: Αγγλικα