Taking YouTube Audio from Mono to Stereo
You might not know this, but YouTube audio is mono. Of course, many of us never noticed because I guess we were so thrilled to see and hear our favorite bands again. So then I wondered how to pull the audio stream out of the video, and I found several other people wondered that too and built scripts, websites, programs, or browser plugins to handle that.

That's fine and all, but then you're stuck with a mono MP3 file that sounds interesting but not quite there on your iPod. Wouldn't it be nice to convert that from mono into simulated stereo? And what if that simulated stereo was pretty darn good? Oddly, this seems to be a concept that not many people have tackled. So, combining some techniques, I figured it out. However, you're going to need to install Linux on a PC for it. This kind of cutting edge stuff isn't going to be on Windows Vista, and if it were, DRM would "call home" on you about it.
In general, there are 3 workhorse command line tools that are used. Wget -- this is used to get the file from the website. Ffmpeg -- this is used to pull out the audio. Ecasound -- this is used to simulate the stereo from a mono file. And when I say simulate stereo, I mean that it's pretty darn good. It's more than just splitting the sound into two separate channels. It splits it, shifts one channel, and does an ever-so-slight EQ change in each ear. It makes the YouTube audio sound fantastic.
So here's the Bash script to make it all come true for you on Linux. Sorry I haven't built a PyGTK GUI for it -- I don't have the time right now, but perhaps someone else has this time. This script prompts you for the URL path and this is all of the URL including the
?v=part but not the
&and beyond. Then, it asks you for the filename (except it doesn't need the file extension). After about 1.25 minutes, it drops a simulated stereo MP3 file in your home directory in an "mp3" folder.
Enjoy!
#!/bin/bash
bu="http://youtube.com/get_video.php?"
mkdir -p ~/mp3
cd ~/mp3
read -p "YouTube url? " ur
read -p "Name? " nv
echo;echo;
wget ${ur} -O /tmp/y1
uf=${bu}`grep player2.swf /tmp/y1 | cut -d? -f2 | cut -d\" -f1`
wget "${uf}" -O /tmp/y.flv
ffmpeg -i /tmp/y.flv -f mp3 -vn -acodec copy "/tmp/${nv}.mp3"
ecasound -i "/tmp/${nv}.mp3" -etf:8 -o "${nv}.mp3"
echo;echo;
rm -f "/tmp/${nv}.mp3"
echo "File is saved in your home directory in the 'mp3' folder. Press Enter to exit."
read

5 Comments:
At Sat Dec 30, 11:45:00 PM MST ,
supermike said...
It totally baffles me after many attempts to make this news mainstream that no one is caring. But that's okay -- perhaps that will keep YouTube from changing things around to bungle this script.
For those of you who don't see how fascinating this is -- realize that Limewire and other popular P2P networks often give you stuff that's got "call home" DRM watermarking or give you things that don't turn out to be what you thought they were or don't download at all. Plus, the selection is lacking. But with YouTube, you'd be surprised about how every song for instance that might have been as obscure as old Basso Nova to newer Glastonbury Festival concerts to Iceland rock bands -- YouTube has an amazing range.
Next, most people who rip songs from YouTube are getting them in mono, and I'm able to achieve simulated stereo that's so good it sounds store-purchased.
At Mon Jan 22, 11:16:00 AM MST ,
MoHo said...
I must say, as useful as this is, I imagine I wasn't the only one who was slightly put off your website in general by the huge post you devote to detailing exactly how racist and bigoted you are.
Whilst some of the best open-source names - going as high up as Linus Torvalds - are notoriously abrasive, at least they're fighting for just causes. Calling gays 'fudge-packing freaks', Muslims 'bomb-wearing towel-heads' and women incapable of making big decisions is unlikely to win you fans among the intellectual and liberal linux community.
In fact, I'd be surprised if anyone read past that entry - it shocks me that someone intelligent enough to write software (hell, intelligent enough to *write*) has such out-of-order views, and chooses to express them publicly.
Hopefully this goes some way to explaining 'no-one .. caring' - maybe they have principles and character more important than dodgy Youtube rips.
At Fri Jan 26, 12:04:00 AM MST ,
supermike said...
Um, dude. Have you been hacked? I was. I had to remove that entry and change my passwords to something really tough. Sorry you had to see it before I did.
At Sat Oct 27, 03:52:00 PM MST ,
L said...
HI,
I uploaded some stereo music my DH wrote to YouTube and you're right, it's mono. Is there any way to alter the mono audio on YouTube then reupload it so it "sounds" stereo on YouTube? Thanks!
At Sat Dec 22, 12:22:00 AM MST ,
johny radio said...
YouTube DOES support stereo tracks. Check this:
http://www.youtube.com/watch?v=mAMXgl_53uE
Post a Comment
Subscribe to Post Comments [Atom]
<< Home