How To Snarf Songs from Youtube with ffmpeg

Ingredients:

  • a YouTube video that you want to steal the music from for your collection. For example, the MC Rove rap. Who doesn’t want to listen to that again and again? Not to be missed!
  • a means of downloading the video, for example DownloadHelper for Firefox, or one of the zillion online youtube video downloaders.
  • ffmpeg, an open source video manipulation program. I checked mine out from Subversion and compiled my own, but there may be easier ways to get ahold of it.
  • a command line to run ffmpeg on. This ain’t no gui, baby. Sorry.

Anyway — download the flv file.

See what you’ve got, like this:

ffmpeg -i Rapping_Rove.flv

You’ll get back a bunch of stuff, hopefully including something like this:

Input #0, flv, from ‘Rapping_Rove.flv’:
Duration: 00:01:55.7, start: 0.000000, bitrate: 64 kb/s
Stream #0.0: Video: flv, yuv420p, 320×240, 29.97 fps(r)
Stream #0.1: Audio: mp3, 22050 Hz, mono, 64 kb/s

Hey, there’s an mp3 in there, trying to get out! Score! Let’s help it. Here’s the magic command:

ffmpeg -i Rapping_Rove.flv -vn -acodec copy Rapping_Rove.mp3

And now you’ve got the file Rapping_Rove.mp3, ready to slurp into iTunes and put on infinite loop. It’s that easy!

Thanks to this posting on some mailing list which helped me figure out the magic command in the absence of comprehensible documentation for ffmpeg. :)

If all this is a little too much, the vixy.net guys have an interface to do it for you on the web. I am not sure however whether it actually extracts the mp3 out of the flv itself, or else pulls the audio out of the flv and re-encodes it as an mp3, possibly losing precious sound quality! But it’s probably a better bet than this ffmpeg voodoo for 99% of people.

Nice wma to mp3 converter: Sneetchalizer

sneetchalizer | code | unix stuff | badcomputer:
The sneetchalizer is a Ruby script which converts between several different audio file formats and tries to preserve meta tags if they exist or create them if they don’t.

I’m using this to turn a bunch of spiff wma’s that Dave gave me (Seal, Cake, Cracker, Primus, etc) into mp3’s so that I can play them in iTunes with the rest of my music.

War With Iran Planned for April 6?

The War is Coming to Iran – April 6th at 4 am – US has Warned Financial Interests in the Area and the Media Crews are Deployed | Government Dirt:

US Central Command 5th Fleet officers headquartered at Manama spoke of security tension, a hint at an approaching war with Iran. Arab sources report the positioning of a Patriot anti-missile battery in Bahrain this week; they say occupancy at emirate hotels has soared past 90% due mostly to the influx of US military personnel. They also report Western media crews normally employed in military coverage are arriving in packs. Thursday, March 29, General Khaled al-‘Absi, Bahrain’s chief of air defense operations disclosed that new alarm networks had been installed and air defense systems upgraded to handle chemical, biological and radioactive attacks.

Moscow sources have predicting that a US strike against Iranian nuclear installations codenamed Operation Bite has been scheduled for April 6 at 4 AM until 4 PM local time. Friday is a holiday in Iran. In the course of the attack, about 20 targets are marked for bombing; the list includes uranium enrichment facilities, research centers, and laboratories. Missiles and air raids will conduct strikes designed to be devastating enough to set Tehran’s nuclear program back several years. The US attack plan reportedly calls for the Iranian air defense system to be degraded, for numerous Iranian warships to be sunk in the Persian Gulf, and for the most important headquarters of the Iranian armed forces to be wiped out. Massive air attacks with the goal of annihilating Iran’s capacity for military resistance, the centers of administration, the key economic assets, and quite possibly the Iranian political leadership, or at least part of it.

This attack is sanctioned by the Democratic leadership of the House of Representatives because they removed language from the just-passed Iraq supplemental military appropriations bill that would have demanded that Bush come to Congress before launching an attack on Iran.

Uh… I hope this is wrong.

More from Daily Kos.…

Hatch Act? What’s the Hatch Act?

Think Progress » Rove’s PowerPoint Presentation Revealed During Oversight Hearing:

Holy crap. As you might hope would be the case, it is illegal for government officials to engage in partisan campaign activities on Federal property (so says the Hatch Act). Thanks to the subpoenaed emails for the attorney-firing scandal, the House is in possession of a powerpoint presentation given by Karl Rove at a national videoconference convened by Lurita Doan, House General Services Administration chief. The presentation reads like a GOP smoke-filled-room planning session, with headings like “2008 House Targets: Top 20” (there follows a listing of vulnerable seats held by Democrats) and “2008 House GOP Defense” and “Battle for the Senate 2008”.

The House Oversight Committee interviewed Doan under oath, and man, that was an uncomfortable interview. It’s like she suddenly contracted a wicked case of Alzheimer’s and couldn’t remember a damn thing.

Recommended watching.

It’s kind of fun seeing America in general and Washington in particular wake up to the sheer evil of the Bush Administration after all these years. Would have been nice if it hadn’t taken this long.

Futz of the Weekend: mouseHole

mouseHole is a spiffy project. It’s a little web proxy that lives on your desktop and can rewrite html that passes through it in arbitrary ways using a powerful html parsing library called Hpricot.

Tres spiff. I had a hard time installing it until I realized the current version depends on libraries which depend on a newer version of Ruby than is shipped with the mac. I eventually found I could install everything I needed with MacPorts and RubyGems.

When I finally got it all working, I discovered there has just been a major, major version jump — the new 2.0 version is supposedly much better than the old — and there are very few scripts written for the new version.

No prob, the fun is making your own, right?

I tried, and while some things worked, I kept hitting errors that looked like this:

Sun Mar 25 23:13:11 -0400 2007: ERROR: execution expired

which hosed things up until I restarted the proxy.

That sort of thing can put a real cramp in your browsing style, so I’m gonna call this one a “keep an eye on it” project for now. It would be really cool to have a greasemonkey-like scripting engine that worked no matter what browser you were using, wouldn’t it? Forget your firefox extensions, you could have mousehole apps which were easier to read, write, and understand (they are), and which you could use with Safari as easily as with Firefox. It’s a beautiful dream.

But right now the dream requires more effort than I can give, despite the screeching of the futzmonkey.

For the record, here’s the easiest way to get mousehole installed and working on OS X:

Install MacPorts.

Install the ports ‘ruby’ and ‘rb-rubygems’ (and any dependencies), to get the latest version of ruby.

sudo gem source -a http://code.whytheluckystiff.net/

sudo gem install mousehole

Say yes to all dependencies and kick back.

Overall though, sadly, the time I’ve spent on this this weekend falls in the what the hell is wrong with me category.