Sunday, June 23, 2013

Extract Audio from a Video File

ffmpeg can be used to extract audio from a video file. Install ffmpeg for the host OS (add it to the path if using Windows) and use the command as below.
ffmpeg -i video.mp4 -ac 2 -ar 44100 -vn audio.mp3
-i specify input file
-ac audio channels
-ar audio rate which is the sampling rate per second
-vn video none to not output video data
-ab audio bitrate for constant bitrate. -ab 320k means a bit rate of 320 kBit/sec.
Specifying a bit rate using -ab will produce audio file with constant bit rate (CBR). Leaving it out will give audio with variable bit rate (VBR). I recommend using VBR for better quality to size ratio.