Based off of this article.

Assuming you have ffmpeg and lame installed, run the following command:

ffmpeg -i input.mp4 -vn -acodec libmp3lame -ac 2 -ab 160k -ar 48000 output.mp3

Here’s a breakdown of each instruction from the article:

  • -i input.mp4 specifies the input file
  • -vn disables the video stream (we only want audio)
  • -acodec libmp3lame forces the LAME MP3 encoder
  • -ac 2 sets stereo output (2 channels)
  • -ab 160k sets the bitrate to 160kbps (good balance of quality and size)
  • -ar 48000 sets the sample rate to 48kHz