HOWTO Dump audio streams from a video file
ffmpeg can dump the audio track from video files to as good as any audio format. Dumping to the files original audio format gives the best results.
A valid ffmpeg command will generally require the parameters
-i inputfile.mp4 followed by conversion parameters followed by an output file. We will also want to add a parameter called
map for telling ffmpeg to just use the audio track. This is done by
The first thing you want to do before dumping audio from a video file is to use the ffmpeg utility
ffprobe to find out what audio format is in the video file you want to dump from. The reason is that dumping to the original files format produces the best result.
For example, running
ffprobe myvideo.mp4 on a video with H264 video and AAC audio will produce output with a line like this:
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 87 kb/s (default)
The above tells you that it's AAC audio.
Audio can be copied with the ffmpeg parameter
-c:a copy and an output file using the m4a or other container which can store that audio. The
-map a parameter must be included if you just want the audio to ensure that ffmpeg does not try to do anything with the video. Thus, this fine command works:
ffmpeg -i myvideo.mp4 -map a -c:a copy myoutput.m4a
-c:a copy if you want to convert to another format instead of copying the audio. Change
-c:a copy to
-c:a mp3 if you want audio to be converted to mp3 instead of being copied:
ffmpeg -i myvideo.mp4 -map a -c:a mp3 myoutput.mp3
ffmpeg can convert to most known audio formats. Run
ffmpeg -encoders for a very long list of the available options (this will include video codecs).
Questions?[edit | edit source]