ffmpeg: Extract audio from .MKV to .MP3 6


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: Greek


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

6 thoughts on “ffmpeg: Extract audio from .MKV to .MP3