Results 1 to 10 of 126

Thread: HOWTO: Download YouTube Stereo MP3s

Threaded View

  1. #1
    Join Date
    Jul 2005
    Location
    Remote Desert, USA
    Beans
    683

    HOWTO: Download YouTube Stereo MP3s

    I'm editing this on Jan 3 2009. YouTube basically broke the API discussed here. Thread can be closed.

    YouTube provides videos for practically every band you've ever heard of, even obscure ones or one-hit-wonders on some TV show you saw. The video quality is moderate but effective, and works on most browsers without having to do anything special. In all your excitement of finding that favorite song of yours, you might not have noticed that it was in mono. You might not have also known that you can extract the sound from it. Unlike P2P networks like Limewire, these YouTube videos are often complete, often not fake, and 99.5% of them download properly on to your computer for playback in your browser.

    Well I'm about to change your perspective on YouTube. You are in for a treat.

    The following script makes an "mp3" folder in your home directory, downloads a YouTube video to it, extracts out a mono MP3 file, then feeds it through a sophisticated simulated stereo filter to create a fairly high quality stereo MP3 file.

    The simulated stereo filter puts an 8 microsecond delay on the right channel and then differs the EQ slightly in each channel. If the delay is increased, the first thing that happens is distortion. Then, it becomes a hollow or tinny sound, and then becomes just pure echo. But with an 8 microsecond delay, plus some EQ modification, it creates a cool stereo effect and no distortion or echo is present.

    I also noticed that some music videos are made up, such as with Asian Anime or kids goofing off in front of it, but the soundtrack is the real thing in some cases. By throwing away the video part, the MP3 sound, especially when converted to fake stereo, sounds great.

    REQUIREMENTS

    You first need to do this:

    Code:
    $ sudo su
    # apt-get update
    # apt-get install xulrunner
    # apt-get install ffmpeg
    # apt-get install lame
    # apt-get install mpg123
    # apt-get ecasound
    # exit
    Now surf with your browser to YouTube and try to play a video. If it asks to install
    Flash, do so because I think it updates your video codecs on your PC.

    Now surf with your browser to find an MPG file on the Internet and download it. Now
    try to open it. Ubuntu will ask you to choose some codecs to download and install.
    Do so.

    SCRIPT

    The following script can be placed as "ytr" in your /usr/bin folder and then made into an executable file with "sudo chmod a+x /usr/bin/ytr". In my case, I made a launcher for it, created my own YouTube icon, and then set the launcher to require a Terminal Window.

    Code:
    #!/bin/bash
    #
    # Bash script to convert YouTube Video to Simulated Stereo MP3
    #
    # Public Domain
    # Contributors: Supermike, Crouse, Kai Vehmanen, Chriss.Hi
    #
    bu="http://rd.cache.l.google.com/get_video?video_id="
    mkdir -p ~/mp3;cd ~/mp3
    read -p "YouTube url? " ur
    read -p "Name? " nv
    echo;echo;
    uf=`echo $ur | cut -d = -f 2`
    wget "${bu}${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."
    read
    IF YOU WANT A GUI VERSION
    I also whipped up a GUI version at:

    http://code.google.com/p/yt2mp3/

    UNINSTALLATION:
    Code:
    $ sudo apt-get --purge remove ecasound
    $ sudo rm -f /usr/bin/ytr
    Anything else that is removed could potentially disturb your ability to use MPEG audio and video on your PC, but this is what it would look like....

    Code:
    $ sudo apt-get --purge remove ffmpeg

    SOURCES:
    Crouse, admin from BashScripts.org
    Kai Vehmanen, one of the developers of the Ecasound tool
    Chriss.Hi, who showed me an interesting Google hack

    TESTED:
    Ubuntu Breezy Badger
    Ubuntu Feisty Fawn
    Last edited by SuperMike; January 3rd, 2009 at 08:29 PM. Reason: It's broke now
    SuperMike
    When in doubt, follow the penguins.
    Evil Kitty is watching you

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •