Convert Video Audio to MP3 with FFmpeg

To rip the audio from a video file and encode it to mp3:

ffmpeg -i MOVIE.webm -vn -q:a 0 AUDIO.mp3

The -q: sets fixed quality scale (VBR) to the selected stream, which is a (all audio streams), and passes 0 to the audio codec (LAME) which interprets it as "highest quality". 9 would be "lowest quality".

The -vn option makes sure that only the audio is processed and not the video, which speeds up things a lot.

Encoding into mp3 will cause loss audio quality. Another option is to encode it to lossless flac:

ffmpeg -i MOVIE.webm -vn AUDIO.flac

But some people like to reserve flac for audio that is of high quality and it could be that the source movie does not have that.

A third option is not to re-encode anything at all and just copy the stream directly. See the last source below for more information on that.

Sources