To extract audio from a video file and convert it to an MP3 format in Linux, you can use a tool like FFmpeg.
Here’s an example command that will convert a video file named “video.mp4” to an MP3 file named “audio.mp3”:
ffmpeg -i video.mp4 -vn -acodec libmp3lame -ac 2 -ab 160k -ar 48000 audio.mp3
The -i
option specifies the input file, -vn
disables video output, -acodec
sets the audio codec to MP3, -ac
sets the number of audio channels, -ab
sets the bitrate, and -ar
sets the sample rate.
You can use similar commands to extract audio from other video file formats and convert it to MP3 or other audio formats.