Some rants about technology, PHP, people, tools, web etc from a developers perspective. Feel free to copy ideas, code or anything from here.

Tuesday, November 07, 2006

Converting Youtube flash videos to MPEG and extracting audio

No comments
Recently i was asked (rather commanded ;) ) by my friend to search for her favorite song. Well this song is by Jennifer Paige ("beautiful" OST Autumn in New York). I searched realy hard but could not find it. Then Finally i found a video on Youtube. Apparently this song was used as the background score of that video. So my mission was to get the audio-track from this video.

First of all you need to grab the video from youtube. Make sure you save it with .FLV extension. Now you are ready to go.
  1. Convert this flash video to mpeg format.
    ffmpeg -i video.flv -ab 56 -ar 22050 -b 500 -s 320x240 test.mpg (check out google for more options)
  2. Extract Audio from this MPEG video
    ffmpeg -i test.mpg -vn test.wav
  3. Convert this WAV(PCM audio) to MP3 format
    toolame test.wav test.mp3

A few notes about the above command. I have Xubuntu and i have ffmpeg and toolame encoders installed. You should use appropriate package managers to install them for you. Also i haven't had the time to play around with quality settings, i think it could have been done even better. So if you know a better process please do let me know.

No comments :