Tuesday, December 8, 2009

Youtube 2 mp3 shell script... :)

Hi All,

This below is a small shell script to convert a youtube video to a mp3 file. There are many restrictions to this script and you may take this as a template and proceed from there further... Suggestions welcome and would be posted as comments or if too good - as a separate Post altogether... Cheers :)

#change dir to your home folder's desktop
cd /home/ananth/Desktop/
#enter your proxy below in the form: http:\\username:password@proxyaddress:port
export http_proxy=http:\\
#using the package youtube-dl. It downloads the video from youtube to flv #format.. Change the http_address in this below line
youtube-dl youtube_file_http_address
#list the downloaded flv file
ls *.flv
#using the package ffmpeg. Make sure that you have only 1 flv file in your #folder every time. or rewrite the script to input the flv file u want. make #it interactive.
ffmpeg -i *.flv your_file_name.mp3
#finally check if the file is playing fine or not. Use mplayer package.
mplayer *.mp3
#Enjoy... :)


Copy from the first # to the last # line to a file and rename it to .sh extension. A # line is a comment line in a shell script.

Enjoy.... :)

Thanks & Take care,
Ananth Gouri

No comments:

Post a Comment