First you need youtube-dl tool or ‘cclive’ to download the Youtube .FLV file.
Then, download the Youtube stream.
python youtube-dl http://www.youtube.com/watch?v=lee7a55401e
Alternatively, you can use ‘cclive’ to download the youtube stream.
After that, use ffmpeg to extract the audio and encode it to MP3
ffmpeg -i lee7a55401e.flv vn -acodec libmp3lame -ab 128000 -ar 44100 lee7a55401e.mp3
Note: You need to install the restricted codecs in order to extract MP3 audio files.
Thanks Mohammad Bahathir Hashim for the tip!
A friend from #fakap asks me to create a dead simple FLV to 3gp batch converter for him to port youtube clips to mobile phone.
As a result I complied, and created flvto3gp bash script for the job.
Using it is simple, just run this script inside a directory full of FLV (or any video files supported by ffmpeg) and execute it using this command :
sh flvto3gp.sh *
The script will convert all video files to 3gp file format one by one. The script requires
ffmpeg in order to run.
Ubuntu users might have to refer to this post before using this utility : Enable mp3 and amr support in ffmpeg ( Ubuntu )