In a past article, I went over how to use a command-line utility called
PACPL to extract audio from video files. Although the process was straight forward and effective back then, the program seems to be buggy at the time of writing and so I wanted to go over an alternative method. In this article we’ll be using the robust command-line program
ffmpeg to achieve this.
ffmpeg is a very fast video and audio converter that can also grab from a live audio/video source. It can also convert between arbitrary sample rates and resize video on the fly with a high quality polyphase filter. — FFMPEG manual
What you’ll need
- a working installation of
Most linux distributions ship with
ffmpeg already installed but if you don’t have it installed, open up your terminal and type:
sudo apt install ffmpeg
Converting mp4 to mp3
To extract audio from a video source, open up your terminal and type the command below:
ffmpeg -i input-video.mp4 output-audio.mp3 # the input-video here represents your video source file # and the output-audio is the name of the audio file you want to output to. # Rename accordingly.
In case you want to convert the vide to a lossless format such as
aac, simply replace the
mp3 extension with a format of choice.
Let the process run and you should be able to have some audio output at the end of the conversion.