If you are on macOS and you need to extract audio from a video file, you just need ffmpeg and you are ready to go.
If you don’t have ffmpeg installed on your system, you can install it with Homebrew. Wait a second, you don’t have Homebrew? Ok, let’s go back..
Install Homebrew
Let’s install brew, a well known package manager for macOS, by going to https://brew.sh and copying the command you see right there on the home page:
paste the command in your terminal and run it. This will download brew and, if you don’t have them, Command Line Tools for Xcode. This process could take a while depending on your network speed.
If the process goes well, you have brew!
Install FFMpeg
Let’s install FFMpeg from our terminal with the following command:
brew install ffmpeg
At the end of the installation process you will have FFMpeg installed on your system,
Extract the audio
Let’s dive into the audio extraction process.
Let’s suppose that we have a video file input_video.mp4 and we want to extract the audio from it; depending on the audio type and quality we could run different commands:
- WAW Mono file @ 16000 samples:
- ffmpeg -i input_video.mp4 -acodec pcm_s16le -ac 1 -ar 16000 output.wav
- WAV Stereo file @48000 samples:
- ffmpeg -i input_video.mp4 -c:a pcm_s16le -ar 48000 output.wav
- MP3 Stereo file @ 192k:
- ffmpeg -i input_video.mp4 -c:a libmp3lame -b:a 192k output.mp3
If you want to use the audio file for audio transcription, the mono file is great, otherwise you could choose between WAV or MP3 formats.
That’s it! Simple as that, you don’t need any UI or specialized program to extract an audio from a video file.
You could see how it’s done on my video:
I used the ffmpeg command during the audio extraction process discussed in the following post: