Alex Balgavy

Just some stuff about me.

Here's my dotfiles repository.

Check out my blog.

My keys: PGP, SSH

My crypto wallets (BTC, XMR)

ffmpeg how to extract audio from a video

Written by John Riselvato - original link

At times, you may have a video that you wish to extract the audio from. This is easily done by simply converting the video into an audio format. For example:

 $ ffmpeg -i input.mp4 -vn -acodec copy output.mp3

A new argument -vn (no video) is used to ensure the encoded mp3 is only an audio file. FFMPEG is smart enough that this argument is optional in most cases. Here we also copy the input audio codec and use the same one in the output mp3.

If for any reason a conversion of a video to audio format results in a broken mp3, setting the mp3 codec to libmp3lame may fix the issue.

 $ ffmpeg -i input.mp4 -vn -acodec libmp3lame output.mp3

FFMPEG does support just about any audio format you required including WAV, AIFF, FLAC, ALAC, ACC, WMA, etc. For a full list check out these other articles: