How to: Extract Audio from Video with FFmpeg

Extracting audio from a video is a fairly simple process with FFmpeg. There are several ways to do this, and you may find that one method suits over another. Let's take a look.

8 months ago   •   1 min read

By Tom O'Brien
💡
If you need help installing FFmpeg on your system, check out this earlier post which will walk you through the process.

A couple of things to note for the examples below:

  • your_video_file.mp4 refers to the file name of your video, so change this appropriately.
  • Each method will create a file called audio.mp3. You can change this file name to whatever you like.

Without encoding

This method will simply extract the audio in its original state from the video file.

ffmpeg -i your_video_file.mp4 -vn audio.mp3

With encoding

This next method will allow you to re-encode the audio from the video file with a different codec to the original one. Below you'll find conversions with libmp3lame, AAC and Opus codecs.

ffmpeg -i your_video_file.mp4 -vn -acodec libmp3lame audio.mp3
ffmpeg -i your_video_file.mp4 -vn -acodec aac audio.mp3
ffmpeg -i your_video_file.mp4 -vn -acodec opus audio.mp3

Need some help with online video delivery, storage and processing? Get in touch with us using the button below and we'll be happy to help you out.

Spread the word

Keep reading