Tutorial: YouTube videos to MP3 with ffmpeg

The machines we love to hate

Moderator: Wiz Feinberg

User avatar
John Cipriano
Posts: 449
Joined: 13 Jun 2008 8:23 pm
Location: San Francisco
State/Province: -
Country: United States

Tutorial: YouTube videos to MP3 with ffmpeg

Post by John Cipriano »

There are a lot of pieces of software that you can use to get music out of a video file, but it all boils down to two ways: you either grab the audio portion of the file and reencode it, or you play the video and record the output of your sound card. There's really no advantage to the second method...it takes longer and it can add sound card noise depending on how you do it. But that's about it. So here's one method for doing it without recording anything.

Installation
1. First, go here: http://tripp.arrozcru.org and where it says in bold, "you just want an FFmpeg executable, get this one", get that one, which is the latest build of ffmpeg.

2. Next go here: http://avanti.arrozcru.com and click download at the top and then download the latest version of Avanti.

Avanti and ffmpeg are stored in the 7z format. If you cannot open these already you will need 7-Zip. I highly recommend 7-Zip anyway. It's free and it does everything WinRAR, WinZip etc can do.

3. So go here: http://www.7-zip.org and get the appropriate build for your system, either 32-bit or 64-bit. If you are unsure, just get 32-bit.

4. Install 7-Zip. When it's done installing, find it in your start menu and open it. Then in the 7-Zip menu bar, find Tools and then Options.... The first tab is called System. Check off any filetypes you want 7-Zip to open, with .7z at the minimum. Here's mine:
Image

5. Open the avanti-039.7z file you downloaded earlier. It's 039 as of this writing, that number may be larger in the future. Unzip that wherever you'd like. C:\Program Files\avanti-039\ will work fine.

6. Next open the ffmpeg zip file. Copy ffmpeg.exe and SDL.dll to the existing folder called "ffmpeg" within the Avanti folder. For instance, C:\Program Files\avanti-039\ffmpeg\.

7. Since Avanti does not have an installer program, you may want to create a desktop shortcut for the exe. You can do this by right clicking the Avanti ("G") icon and hitting copy and then right clicking the desktop and hitting "paste shortcut".


Operation
Now you're ready to start. Go to YouTube, find a video. Copy the URL from your address bar. Then go to http://keepvid.com and paste it where it says URL. Keepvid will typically give you two options, a high and low quality. The audio should be about the same in both files, but I have had problems in the past with the high-quality files not converting completely. Download one and note where you saved it to.

Here's Avanti:
Image
(you may notice that I hadn't put ffmpeg.exe in the right folder before I took the picture :D )

Click the little folder icon all the way to the right of Source 1 and in the dialog that pops up, locate and click on the downloaded .flv file.
Put whatever you want in the box to the right of Destination, I think the easiest thing to do is copy and paste what's in Source 1 and change the file extension.
Where it says Destination Audio Settings, pick mp3 (Lib). You can put what you want for the bitrate. 128 is default, I like 192.
Where it says Destination Video Settings, uncheck Enable.
Finally, click Start process.

There are other ways of doing this, but the basic procedure is to get some software that will decode the FLV and encode the audio stream as an MP3. If you want to edit the file, encode as WAV, make your edits and then use an MP3 encoder (LAME is the standard one) to make the MP3.

I hope somebody finds this useful. Let me know how it works.
Chip Fossa
Posts: 4366
Joined: 17 Sep 1998 12:01 am
Location: Monson, MA, USA (deceased)
State/Province: -
Country: United States

Post by Chip Fossa »

John,

I just tried downloading all 3 of your links.

The only one that came through was 7-zip.org.

Both TRIPP & AVANTI left an icon that said: Windows can not open this file. Go look around on the web for a program to open it (basically).

This audio capture system may be faster, but I still want to listen all the way through every song, to be sure it's 'clean' and that the fidelity is acceptable. So as I'm listening, for the first time, the song is being recorded. If a glitch occurs, I shutdown recording, stop the video, and go look for another prospective; then repeat until I'm satisfied.
Chip
Williams U-12 8X5; Keyless; Natural Blonde Laquer.
User avatar
John Cipriano
Posts: 449
Joined: 13 Jun 2008 8:23 pm
Location: San Francisco
State/Province: -
Country: United States

Post by John Cipriano »

Yeah, that's normal. The files are zipped in the 7z format so it's necessary to first install 7-zip and then configure it as shown in step 4.

I personally think it's better to transcode using a program and then listen afterward but however you like to do it is fine.

I should add that my intent is to introduce people to encoding software and not to facilitate any copyright infringement. I used to tape the occasional song off the radio and consider this to be the digital analog. Don't share the files you make! :P

And if you want a really high quality copy of a particular song, iTunes and Amazon have almost everything and most of it's 99 cents a song.
Chip Fossa
Posts: 4366
Joined: 17 Sep 1998 12:01 am
Location: Monson, MA, USA (deceased)
State/Province: -
Country: United States

Post by Chip Fossa »

I've used Amazon on many occaisions.

They have most everything. But not everything.

I'm fine with the quality off YouTube; most of the time. Even though some songs glitched-out within Nero, the fidelity of the songs was OK by me. I don't see how it could get much better.
I've had a few songs where I just couldn't get a good quality sound, so that's usually when I go to Amazon.

BTW - I happen to like the needle 'sounds' in some songs. It really wouldn't be a true oldie without some needle sounds.
We all grew up with that.

John, is there any reason in 7-Zip you didn't just check-off all the listed files? Are there pros & cons to being selective?

I do want to learn this, however. I know nothing about encoding. I'll try to follow directions more carefully. :P
Chip
Williams U-12 8X5; Keyless; Natural Blonde Laquer.
Chip Fossa
Posts: 4366
Joined: 17 Sep 1998 12:01 am
Location: Monson, MA, USA (deceased)
State/Province: -
Country: United States

Post by Chip Fossa »

John,

I was able to download a YouTube file to my desktop, via KEEPVID.COM.
Both video & audio appeared when played through Winamp.

But, a couple of things.

Those 2 files (ffmpeg.exe & SDL.dll) were rejected by the existing Avanti ffmpeg file/folder. Could not put them in there; so I just put them in Avanti, anyway.

To make a long story short, I opened keepvid.com, then went to YouTube, picked out "Fun, Fun, Fun", copyied/pasted it into keepvid, and VOILA! That was easy as pie (apple).

What I don't get, is where does 7-Zip, ffmeg, and Avanti fit into all this? Seems like all you gotta do is just open up KEEPVID.COM and YouTube and copy/paste.

Winamp plays .flv files, too.
Chip
Williams U-12 8X5; Keyless; Natural Blonde Laquer.
Mitch Drumm
Posts: 2663
Joined: 4 Aug 1998 11:00 pm
Location: Frostbite Falls, hard by Veronica Lake
State/Province: -
Country: United States

Post by Mitch Drumm »

Chip:

7-Zip is a free archiving program and can be used to compress or uncompress files, much like the Winzip that you paid $50 for.

You can use it on virtually any compressed file that needs to be "unpacked", such as ZIP files, RAR files, etc. It is probably the most popular application of its type.

I'm guessing John recommended it to you as a way to "unzip" aka "uncompress" some application you had downloaded.

There is such a thing as a 7z file extension, and it may be that 7-Zip is the ONLY program that will open them.

It's very handy and can replace Winzip or whatever else you have been using for the purpose.
Chip Fossa
Posts: 4366
Joined: 17 Sep 1998 12:01 am
Location: Monson, MA, USA (deceased)
State/Province: -
Country: United States

Post by Chip Fossa »

Thanks Mitch,

I got 7-Zip now on my PC. I'm gonna leave it.

Actually I haven't come across much need, lately, to unzip anything; and if I did haff-to, I just use the Windows unzip default program.

But my question is still, 7-zip and Keepvid.com seem unrelated. Maybe John can explain it better.

I appreciate the link to 7-Zip; and Keepvid, too.

But I just don't see how they are connected to download a YouTube video/audio file. I did, independently, of 7-zip, ffmeg, and Avanti.

Confusing, brother.
Chip
Williams U-12 8X5; Keyless; Natural Blonde Laquer.
User avatar
John Cipriano
Posts: 449
Joined: 13 Jun 2008 8:23 pm
Location: San Francisco
State/Province: -
Country: United States

Post by John Cipriano »

7-Zip is just for doing step 5 and 6. You could even uninstall it after. I just like it as a Windows unzipping program. Alternately, if you paid for WinZip, upgrade to version 12 and you can use it to open 7z files.

There's no reason why I didn't check all of the filetypes off. Just habit. Most of those formats you only need on linux, and you wouldn't use 7-Zip to open them.

Does anyone else have an easier way of going from FLV to MP3 on Windows? Like I said, I generally use ffmpegx, which is similar but for Mac. I don't have a problem with it. For Windows this was the closest thing I could find. I guess only Chip was brave enough to try it though. :D

Chip, you can actually put ffmpeg.exe anywhere you want as long as you tell Avanti where it is (by right clicking on the Start Process button and browsing to the location of ffmpeg.exe.
Chip Fossa
Posts: 4366
Joined: 17 Sep 1998 12:01 am
Location: Monson, MA, USA (deceased)
State/Province: -
Country: United States

Post by Chip Fossa »

Thanks John,

I get it now (I think). I am slow. Avanti/ffmpeg is simply to convert .flv to .mp3? Is this because many media players don't recognize .flv?
When I saw 'Fun,Fun,Fun' was saved as .flv, I figured this isn't going to play in Winamp (my main playback source).

But it did.

However, I would much rather convert .flv to mp3, just so I can use the file anywhere.

I'm gonna play around more with this stuff later today; especially Avanti.

This does look like a better way to go. And like you said, if the file turns out to have 'problems', you just delete and go back and try again; that's what I've been doing anyway, with Total Recorder.

I got to start reading things more carefully. :\
Chip
Williams U-12 8X5; Keyless; Natural Blonde Laquer.
Mitch Drumm
Posts: 2663
Joined: 4 Aug 1998 11:00 pm
Location: Frostbite Falls, hard by Veronica Lake
State/Province: -
Country: United States

Post by Mitch Drumm »

Chip:

As I understand it, the point of John's tutorial is to enable people to capture the audio portion of a VIDEO file--in this case an FLV file.

I'd think that in the vast majority of cases in Youtube or the Internet generally, you are trying to capture the audio portion of an AUDIO file--video would have nothing to do with it at all. FLV would have nothing to do with it since it is a video format.

In which case you would capture the audio in Total Recorder as it played--which is what I had assumed you were trying to do. There are thousands of audio only files on Youtube.

So you wouldn't normally have to "transcode", which is lingo for converting an audio or video file from one format to another--such as WAV audio to MP3 audio or WMV video to AVI video.
Chip Fossa
Posts: 4366
Joined: 17 Sep 1998 12:01 am
Location: Monson, MA, USA (deceased)
State/Province: -
Country: United States

Post by Chip Fossa »

Mitch,

When I dragged "F,F,F"(.flv) in Winamp, the audio played, but then the Winamp video window popped up and - well, there was NO video; just one of the Beach Boy's album covers - probably the album that "F,F,F" was on. Once again, I don't know.

Also, this morning I quickly clicked on "G"(Avanti-GUI.exe) and a quick little flag appeared and then disappeared. Avanti did not open. I tried opening ffmpeg.exe, too, and it didn't open either. Where did I mess up?

I was trying to get to the screen that John presented up above - the .flv conversion to .mp3.

Well, I didn't get to any screen.

BTW, I went to Nero's website and found an update for Nero 7.0 (the version I have). I updated Nero, but left to go to work, and have not opened up the new version yet. I'm anxious to see if the update will take care of the glitches I'm having with Nero.

I'll keep all interested parties, posted.
Chip
Williams U-12 8X5; Keyless; Natural Blonde Laquer.
Chip Fossa
Posts: 4366
Joined: 17 Sep 1998 12:01 am
Location: Monson, MA, USA (deceased)
State/Province: -
Country: United States

Post by Chip Fossa »

Nope.

Nero update did not resolve the glitches.
Chip
Williams U-12 8X5; Keyless; Natural Blonde Laquer.
Mitch Drumm
Posts: 2663
Joined: 4 Aug 1998 11:00 pm
Location: Frostbite Falls, hard by Veronica Lake
State/Province: -
Country: United States

Post by Mitch Drumm »

Chip:


I remain confused.

Why even use ffmpeg and Avanti when you can get the audio portion of a video track with an audio recording application such as Total Recorder or Audacity alone??

Start recording with Total Recorder or Audacity, and play the video on Youtube and you end up with an AUDIO file (mp3, WAV, whatever)? I have done exactly that.

No FLV file, no Avanti, no FFMPEG.

As for Nero, it has been problematic for some tasks for years. I completely gave up on it 3 or 4 years ago and have replaced it with free alternatives.
Chip Fossa
Posts: 4366
Joined: 17 Sep 1998 12:01 am
Location: Monson, MA, USA (deceased)
State/Province: -
Country: United States

Post by Chip Fossa »

Good question.

I don't know, Mitch.

I think TR works great. I'm OK with it. I ain't that fussy.

Then JC comes along and suggests another way.

I respect all you guys and your knowledge; so I'm willing to go along and try stuff. How else are you gonna learn this computer?

I'm a dummy here; with all this "new" stuff.

I'm so friggin' confused and addled now, what with Ubuntu, Avanti, Linux - I'm not that swift. The past 3 weeks or so, have completely overwhelmed me.

I really don't know which end is up right now. :?
Chip
Williams U-12 8X5; Keyless; Natural Blonde Laquer.
Mitch Drumm
Posts: 2663
Joined: 4 Aug 1998 11:00 pm
Location: Frostbite Falls, hard by Veronica Lake
State/Province: -
Country: United States

Post by Mitch Drumm »

Chip:

I understand that---you are doing fine considering what has been talked about in the last few weeks.

Just gnaw on it steadily, a little at a time--that's all you can do. That's how everyone learns about computers.

You have around 6 weeks to fiddle with Linux before you have to come to grips with Windows 7--the first things to consider there are:

Clean install or "in place" upgrade?

Partitioning scheme--all personal data on C partition, or split data off to another partition?

I don't see any reason not to put Windows on your original HD, which now has C/D/EISA partitions. Most likely, you would delete D and EISA and then resize C from its current 140 gigs--larger if you want to keep data on C and smaller if you want to put data on another partition on the same drive.
Chip Fossa
Posts: 4366
Joined: 17 Sep 1998 12:01 am
Location: Monson, MA, USA (deceased)
State/Province: -
Country: United States

Post by Chip Fossa »

Mitch,

Thanks for the words of enncouragement.

I think I may put all personal data on Mybook [L:].

Between the 2 Mybooks, L: opens quicker than K:(Acronis). And shuts off immediately on pushing the green button. K:, on the other hand, has always been pokey on boot-up. And sometimes it just will not shut off. The green button LED keeps blinking off and on. I've had to simply pull the power plug on the unit to get it to shut down.

I think I'll just put Win7 on top of Vista. Can you have both Vista & Win7 on the same PC (partitioned, I know)? Is there any advantage of having both?
For me, again, the simpler the better.
Chip
Williams U-12 8X5; Keyless; Natural Blonde Laquer.
Mitch Drumm
Posts: 2663
Joined: 4 Aug 1998 11:00 pm
Location: Frostbite Falls, hard by Veronica Lake
State/Province: -
Country: United States

Post by Mitch Drumm »

Chip:

Yes, you could keep both Vista and Win 7 on the same PC in different partitions and "dual boot", choosing whichever you want to use.

But I cannot think of any reason why you would want to do that. Win 7 is a significant improvement and I wouldn't think there are any reasons to keep Vista around.

Do you have genuine Microsoft Vista installation discs or do you have only some type of Acer "recovery discs"--or neither? I would hope you had the former, but kinda doubt it.

I would encourage you to keep your original data on an internal partition--either C or a separate D. And then use your external drives as backup locations for the originals. Internal drives are much faster because they don't rely on that USB connection and it always make sense to have at least 2 copies of data.

I have never installed an operating system on top of another, but I guess it generally works out OK.
User avatar
John Cipriano
Posts: 449
Joined: 13 Jun 2008 8:23 pm
Location: San Francisco
State/Province: -
Country: United States

Post by John Cipriano »

The tutorial wasn't specifically for Chip, although I do appreciate you trying it out Chip. I don't know about the issues you're having with it but I guess we can leave it at that. Luckily ffmpeg and Avanti don't even require an uninstall, just put them in the recycle bin if you're done with them.

The reason I suggest it is that the decoding and re-encoding steps get done no matter what. The first one by your flash player and the latter by whatever program that saves in MP3. The point of using ffmpeg is to eliminate the step where you're re-recording audio. It's not a bad solution, it's just unnecessary and skipping it can save you a lot of time. If the song is 5 minutes, you have to wait those 5 minutes to tape it, when it will take maybe 30 seconds to convert it directly.

Don't unplug your disks unless they're fully ejected! Sometimes you'll have no choice, but always go into the Safely Remove Hardware dialog to see what can be ejected.
Chip Fossa
Posts: 4366
Joined: 17 Sep 1998 12:01 am
Location: Monson, MA, USA (deceased)
State/Province: -
Country: United States

Post by Chip Fossa »

I guess I didn't mean to put Win7 on top of Vista. However Win7 is installed (and getting rid of Vista at the same time) is what I meant.

I wouldn't want two MS systems. Heck, I'm trying to get away from MS altogether with Linux (some day).

You're right, Mitch, I have recovery CDs for ACER. No Windows Vista CD, itself, came with this PC.

Oh, when I save anything, it's ALWAYS a copy (duplicate of any original)

John, when you said 'disk'and 'eject', you weren't talking about a CD in the drawer were you?

I was referring to one of my external HDDs. Your terms confused me, there.
Chip
Williams U-12 8X5; Keyless; Natural Blonde Laquer.