Extract audio from *.mkv to *mp3 with ffmpeg in PowerShell

ffmpeg.exe -i '.\inputfile.mkv' -vn -c:a libmp3lame -y outputfile.mp3

What’s happening?

  1. ffmpeg.exe: This is the executable file for FFmpeg. It is followed by a space.
  2. -i '.\inputfile.mkv': This part of the command specifies the input file. In this case, it’s an MKV video file named “inputfile.mkv” located in the current directory (indicated by .\). The -i option is used to specify the input file.
  3. -vn : This option tells FFmpeg to disable video processing. It instructs FFmpeg to ignore any video streams in the input file. Since you want to convert the audio, this option ensures that no video is included in the output.
  4. -c:a libmp3lame : This option specifies the audio codec to be used for the output. In this case, it’s “libmp3lame,” which is the LAME MP3 audio encoder. It’s a popular codec for encoding audio into the MP3 format.
  5. -y : This option is used to automatically overwrite the output file if it already exists without asking for confirmation. It’s useful when you want to run the command without being prompted to confirm overwriting.
  6. outputfile.mp3 : This is the name of the output file. In this case, it will be named “outputfile.mp3” and will contain the audio extracted from the input MKV video.