Saturday, May 22, 2010

Extract Audio from FLV file and save as MP3 with FFmpeg

I had to extract MP3 from an flv video a few days back. Luckily i had FFmpeg. Since i had the command line version only, i had to dig deep to find the commands to get my task done.

The command that i used is : 

D:>ffmpeg.exe -i

This will process the video file and out put the audio at a rate of 64kbps. Although the flv contained audio at 128kbps, the result i got was only at 64kbps. 

In order to copy the sound channel directly and save it as mp3, we can use this

D:>ffmpeg.exe -i “D:\testVideo.flv” -acodec copy “D:\audio_from_video.mp3”

The option "-acodec copy" results in FFMPEG copying the audio stream present to the output file without processing it.

About FFmpeg

FFmpeg is a collection of software libraries that can record, convert and stream digital audio and video in numerous formats. It includes libavcodec, an audio/video codec library used by several other projects, and libavformat, an audio/video container mux and demux library. The name of the project comes from the MPEG video standards group, together with "FF" for "fast forward".

FFmpeg takes care of all the hard work of video processing by doing all the decoding, encoding, muxing and demuxing for you. This can make media applications much simpler to write. It's simple, written in C, fast, and can decode almost any codec you'll find in use today, as well as encode several other formats.

FFmpeg Website

No comments: