Youtube to mp3 linux perl script

I’m new to perl. This script uses youtube-dl to get the flv/mp4 from a youtube url, ffmpeg then converts it to wav, and lame converts that to mp3 with the song metadata.


#	Jakash3
#	July 4, 2012
#	Extracts mp3 audio from a youtube video.
#	Requires youtube-dl, ffmpeg, and lame commands

print 'Youtube URL: ';
chomp ($url = readline);
print 'Song name: ';
chomp ($name = readline);
print 'Artist: ';
chomp ($artist = readline);
print 'Album: ';
chomp ($album = readline);
print 'Genre: ';
chomp ($genre = readline);
print "\nRunning youtube-dl...\n";
system "youtube-dl -o tmp $url";
print "\nRunning ffmpeg...\n";
system "ffmpeg -i tmp \"${name}.wav\"";
unlink 'tmp';
print "\nRunning lame...\n";
	"lame -h -b 320".
	" --tt \"$name\"".
	" --ta \"$artist\"".
	" --tl \"$album\"".
	" --tg \"$genre\"".
	" \"${name}.wav\" \"${name}.mp3\"";
unlink "${name}.wav";

8 thoughts on “Youtube to mp3 linux perl script

  1. I am curious why you use ffmpeg to turn it into a wav and then lame to turn that into an mp3. When I did something similar with youtube-dl, I just used ffmpeg to convert it straight to mp3.

  2. I have learn a few just right stuff here. Certainly worth bookmarking for revisiting.
    I wonder how so much effort you put to make one of these great informative website.

  3. Background check market in examination simply because profits climb jump manual review (Leif) Rent Ideal Job Background Check History Verification how to jump higher ( Tips
    on how to complete a online criminal record check American These days jump manual

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: