View Full Version : [ubuntu] HOWTO: Download / convert youtube video to music

March 30th, 2010, 11:32 PM
These are the instructions for streaming a youtube video with ffmpeg and converting it to mp3 without physically downloading it to your hard disk.

#1 Download and install latest youtube-dl


#2 Download and install ffmpeg

sudo apt-get install -y ffmpeg

#3 Enter one command

ffmpeg -i `youtube-dl -b -g $YOUTUBE_URL` -f mp3 -ab 160k -ar 44100 -ac 2 $FILENAME.mp3

ffmpeg -i `youtube-dl -b -g http://www.youtube.com/watch?v=H0DTm_bWEjs` -f mp3 -ab 160k -ar 44100 -ac 2 Scooter_vs_Status_QUO-Jump_that_rock.mp3

#4 To only download the movie with no conversion:

youtube-dl -b http://www.youtube.com/watch?v=H0DTm_bWEjs

Simple Script

# requires ffmpeg / youtube-dl
# simple gui for:
# ffmpeg -i `youtube-dl -b -g http://www.youtube.com/watch?v=H0DTm_bWEjs` # -f mp3 -ab 160k -ar 44100 -ac 2 asdf.mp3


echo "
Enter full youtube video URL here
EX: http://www.youtube.com/watch?v=H0DTm_bWEjs
echo -n "> "
read URL
echo "
Enter name of file
EX: Scooter vs Status QUO -Jump that rock
echo -n "> "
read FN

echo "
Ok so we are downloading
from: $URL and converting
to: $FN.mp3
echo "
This may take a while, be patient....
ffmpeg -i `youtube-dl -b -g "$URL"` -f mp3 -ab 160k -ar 44100 -ac 2 "$FN".mp3

echo "
All Done

sleep 5

March 31st, 2010, 12:15 AM
There are several threads being locked because downloading YouTube videos is against their EULA. I would advice reporting your own thread to a moderator and asking for review.