Sunday, February 07, 2010

Extracting the audio from an flv file and creating a new flv with only audio

As a part of my studies I wanted to extract out only the audio from the flv file into a new flv file.

Here is what I did
$ffmpeg -i input.flv -f flv -vn -acodec copy output.flv

I also wanted to convert all the files while taking a copy of the original file
$find . -name *.flv -exec cp '{}' '{}'.`date +%d.%m.%y`.original \; -exec ffmpeg -i '{}' -y -f flv -vn -acodec copy '{}' \;

The above command didnt exactly work since, it was overwriting the old file as it was being converted, so I used this one

$find . -name *.flv -exec cp '{}' '{}'.original \; -exec ffmpeg -i '{}'.original -y -f flv -vn -acodec copy '{}' \;

ffmpeg man pages: