Saturday, November 7, 2009

Uploading mp3 files to youtube

After a long search did I find a way to convert an mp3 to avi format which is upload-able on youtube. I wanted to upload this beautiful ghazal by Mehdi Hassan, "Woh ke har ahd-e-muhabbat". Here's a nice script I found to do it. It can convert mp3 to avi which can be then uploaded to youtube.

# Starts here
input=$1
output=$2

background=/tmp/bng-black.jpg
convert -size 320x240 xc:black $background
duration=`ffmpeg -i $input 2>&1 | grep Duration | cut -f1 -d, | cut -f2,3,4,5 -d:`
ffmpeg -loop_input -i $background -i $input -vcodec mpeg4 -acodec copy -t $duration $output
# Ends here

You need to install ffmpeg, libavcodec-extra-52 to make it work.

Here's the video:



Woh ke har *ahd-e-mohabbat se mukartaa jaaye
Dil wo zaalim ke usi shaks pe martaa jaaye

Mere pehloo mein wo aaya bhi to khushboo ki tarah
Mein use jitna samentoon vo bikhartaa jaaye

Khulte jaayen jo tere band-e-kabaa zulf ke saath
Rang-e-*pairaahan-e-shab aur nikhartaa jaaye

Ishq ki narm nigaahi se hina ho *rukhsaar
Husn wo husn jo dekhe se nikhartaa jaaye

Kyon na hum usko dil-o-jaan se chaahen 'Tashna'
Woh jo ek dushman-e-jaan pyaar bhi kartaa jaaye

-Alam Tab 'Tashna'

ahd means promise
pairaahan means dress,robes
rukhsaar means cheeks