The great thing about using Linux is that you have a number of command line tools that can accomplish tasks and are generally faster than GUI-based alternatives.
The format for an ffmpeg command is
$ ffmpeg <input_file_options> -i <input_file> <output_file_options> <output_file>
-i is used to specify the input file.
In general, both the input and output files are video files. To extract the audio portion, we can simply specify an audio file for the output file.
For example, to extract audio into an .mp3 file:
$ ffmpeg -i input.mp4 output.mp3
We can also use some output options to convert to an .ogg file:/samp>
$ ffmpeg -i input.mp4 -vn -acodec libvorbis output.ogg
-vn is the option to disable the video. -acodec libvorbis forces ffmpeg to use the libvorbis codec, which is what gets us an .ogg file.
We can also use the -ar option to adjust the sampling rate. For example, if we wanted to change the audio sampling rate to 22050 Hz, we could use:
$ ffmpeg -i input.mp4 -ar 22050 output.mp3
We can adjust the sampling rate of an .ogg file as well:
$ ffmpeg -i input.mp4 -vn -acodec libvorbis -ar 22050 output.ogg
The ffmpeg command also supports file types such as avi, mkv, and mov as input files. You can even extract audio into a .wav file, which is uncompressed, unlike .mp3 and .ogg.
As you can see, it’s pretty easy to extract audio using the command line if you know just a few simple commands.