Monday, August 10, 2009

extracting audio from video (.flv) files downloaded from Youtube - the Linux way!


I had downloaded some videos from Youtube and wanted to extract the soundtrack as an .mp3 file or .ogg file.
At first I tried the following command -
$ mplayer -dumpaudio my_file.flv -dumpfile my_file.mp3
Most of the times the audio was extracted perfectly. But some .flv files proved stubborn, and I was left with non-playable mp3s.
I found a solution at LinuxQuestions.org, where a knowledgeable member Ilgar provided the following solution
$ mplayer -quiet my_file.flv -ao pcm:fast:file=my_file.mp3 -vc dummy -vo null -channels 2
after which I was left with my_file.mp3 .
$ file my_file.mp3
revealed that it was a WAV file and not an mp3. It was still playable with mplayer. However when I downloaded it on my Samsung UltraTouch S8300 mobile, I was not able to play it.
I then converted it to .mp3 format using the app - SoundConverter.
Thanks Ilgar

No comments: