Value In Brief – by Abanoub Hanna
All You Need To Know Explained In Brief

How can I convert MP4 video to MP3 audio with FFmpeg?

CLI Tips & Tricks Tutorials

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.

CommandTime Period
ffmpeg -i video.mp4 -vn audio.mp327.85 secs
ffmpeg -i x.mp4 y.mp328.17 secs
ffmpeg -i x.mp4 -b:a 192K -vn y.mp330.08 secs

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.

« [Fixed] curl: (56) LibreSSL SSL_read:... Qwik vs Astro : A Fair Comparison »