Downloading
I used a small python script youtube-dl for downloading the video data.
- It is available in the Ubuntu repositories
sudo apt-get install youtube-dl
- If you encounter some problems you also could do a source checkout from BitBucket (requires that Mercurial is installed):
hg clone http://bitbucket.org/rg3/youtube-dl/
- Download the video from a terminal:
youtube-dl http://www.tube.com/watch?v=videoid
- After the download you will find a videoid.flv in your folder
Getting the audio data
For extracting the audio data I used ffmpeg.
- If you haven’t installed it already:
sudo apt-get install ffmpeg
- We will extract the audio data to a simple wave file. This file is gonna be large, so make sure you delete it afterwards.
ffmpeg -i videoid.flv output.wav
Converting to MP3
For converting the wav file to a mp3 file I used lame.
- Run (the “-b” arguments sets the bitrate of the mp3):
lame -b 192 -h output.wav output.mp3
Notes
- There a lot of other ways to get the data. Instead of lame you could use mplayer, but this way I alway ended with broken mp3 files.
- Instead of converting to wave file you also could create a mpeg video and then create the mp3 file directly from this video.
- Lame and also ffmpeg have tons of options available from the command line, which could increase speed and quality of the conversation.