Photobucket

Sunday, September 25, 2011

Getting music out of your fav Youtube videos

So, again this is like a ready reference for me so that whenever I need to extract and convert music out of a video I can just come here and look at this post. Long long ago, I had done this once. I used ffmpeg to extract music out of a video and then convert it to some specific format. I remember reading that instead of using some one click tools which are readily available, using ffmpeg will help in maintaining the sound quality. Find below the detailed steps.

1) Install ffmpeg: I had initially thought that installing just ffmpeg would be sufficient but apparently it wasn't. I needed some extras too. So, to install everything that is needed, do this


Code:
sudo apt-get install ffmpeg libavcodec-extra-52


2) Extracting music: Next we need to check what kind of audio does my file have 


Code:
ffmpeg -i inputvideofile.flv

This will tell me what kind of audio does the file have. So I know what will my output be. Next I use the following command to get the music

Code:
ffmpeg -i inputvideofile.flv -acodec copy output.aac
3) Now I realize that an app in my phone ( Ringdroid) does not recognize this format. So I decide to convert .aac to .mp3
Code:
ffmpeg -i input.aac -ar 44100 -ab 115 -map_meta_data output.mp3:input.aac output.mp3

If you don't want to map metadata then you can just have
Code:
ffmpeg -i input.aac -ar 44100 -ab 115 output.mp3

The values 44100 and 115, I get them from ffmpeg -i inputfile.mp3 command 

No comments:

Post a Comment