How can I convert MP4 video to MP3 audio with FFmpeg?
Sometimes, you need to extract audio or music from a video. Or you need to convert a video into an audio file. The command is simple. Here is the command to convert MP4 to MP3 file.
ffmpeg -i video.mp4 audio.mp3
Alternative commands to convert MP4 to MP3 file
ffmpeg -i video.mp4 -b:a 192K -vn music.mp3
or use this faster command (see benchmarks below).
ffmpeg -i video.mp4 -vn audio.mp3
You can use all of the above three commands to convert mp4 into mp3 on Mac OS or any Linux based operating system, but not on Ubuntu. To use ffmpeg on Ubuntu, read on.
Convert MP4 to MP3 on Ubuntu OS
But if you are using Ubuntu OS, use
avconv instead of
ffmpeg because Ubuntu ships with a fork named libav. The command will be like this.
avconv -i video.mp4 audio.mp3
And the other command on Ubuntu will be. (just replace ffmpeg with avconv)
avconv -i video.mp4 -b:a 192K -vn music.mp3
And the faster command on Ubuntu will be.
avconv -i video.mp4 -vn audio.mp3
Benchmarks : Which command is faster?
Let’s benchmark those three commands, to know the fastest one.
So, the fastest command to convert MP4 video to MP3 audio file is
ffmpeg -i video.mp4 -vn audio.mp3.
I hope this helps you. You know someone will benefit from this, share it with him/her, a friend or colleage.