To extract audio from a video using FFmpeg, you can use the -vn
(no video) and -acodec
options to specify the audio codec. Here’s the command you can use:
ffmpeg -i input.mp4 -vn -acodec copy output.mp3
Let’s break down the options used:
-i input.mp4
: Specifies the input video file.-vn
: Disables video recording, ensuring only the audio is processed.-acodec copy
: Copies the audio stream from the input file to the output file without re-encoding it.output.mp3
: Specifies the output audio file in MP3 format.
Make sure you have FFmpeg installed on your system before running this command. After executing the command, FFmpeg will extract the audio from the video file and save it as an MP3 file with the specified output name.
If you want to convert the audio to a different format or apply any audio-specific settings, you can change the -acodec
option accordingly. For example, to convert the audio to AAC format, you can use -acodec aac
instead of -acodec copy
.