How to: Extract Audio From Video Using ffmpeg

So, you want to extract some audio from a video ey? Sure! No problem! You can do just that using ffmpeg, here’s the command string.

In this example, i’ll extract the whole audio track to a mp3 file, with a 320k bit (constant) rate and 44100hz audio rate (high quality mp3):

ffmpeg -i “whatever.format” -vn -ac 2 -ar 44100 -ab 320k -f mp3 output.mp3

Here’s a short explanation on what every parameter does:

  • -i “input file”
  • -vn “skip the video part”
  • -ac “audio channels”
  • -ar “audio rate”
  • -ab “audio bit-rate
  • -f “file format to use”
  • (the end if the string) “output file”

NOTE: I am not responsible for any copyrighted material (ex, music videos) that get’s converted to audio using this method.

10 responses to “How to: Extract Audio From Video Using ffmpeg”

    • I am aware of such websites Jack, though I prefer to do it myself. If you use ffmpeg on your local client, you have more control in what kind if parameters you want to use. Such as bit-rate and audio-rate.

  1. I recommend using this Video Downloader, a free program for downloading and converting YouTube videos.
    The program enables you to download a video from any site and convert it to any format, including MP3, Avi, QuickTime, iPod, iPhone, etc.

  2. ffmpeg -i input.mkv -acodec copy -o output.m4a wouldn’t re-encode the audio (if it was AAC). You can see the formats of the audio streams with ffmpeg -i input.mkv.

  3. short, sweet and works, thanks. I use ‘wav’ as output type. Just for those who same as me: i.e. don’t know where to get info from orig file, do: ffmpeg -i input_video, and look for, something like this:

    Stream #0.1: Audio: libspeex, 16000 Hz, 1 channels, s16, 27 kb/s

    Then the command is

    ffmpeg -i input_video -vn -ar 16000 -ac 1 -ab 27 -f wav output_audio.wav

  4. No need to convert man, the title says “extract”, you should update your post with Lauri suggestion, because you rank high on google when searching for this

Leave a Reply

Your email address will not be published. Required fields are marked *