Download YouTube Videos : The Linux Way !
January, 2007
In this article I will outline a few methods to download YouTube Videos to your system and getting them to play in your favorite player. We will go in a step-wise way :
A. Getting the Video
1. Online Tools</p>
There are some sites like [KeepVid.com](http://keepvid.com) which
allow users to input a YouTube link and they would give you the
download link. So get the download link from this site and download
the <span style="font-weight:bold;">flv</span> file.
<p>
</span>
-
Firefox Plugin
There is a firefox [extension](https://addons.mozilla.org/firefox/2390/)which allows you to download YouTube videos as you watch them. I haven't tried this.
-
Command Line Tools
This is the safest and best way (for CLI junkies :-D). Download the script [YouTube-dl](http://bitbucket.org/rg3/youtube-dl/) (thanks to Ricardo Garcia Gonzalez for this nice script). Just put that script in your `~/bin or /usr/bin` directories or somewhere in the application path.To download the flv video do this :
youtube-dl
e.g : youtube-dl http://www.youtube.com/watch?v=D1R-jKKp3NA
</p>
- Get <span style="font-weight:bold;">ffmpeg</span> for your
system. SuSE users can get it
[here](http://packman.links2linux.de/package/ffmpeg).
- Convert the <span style="font-weight:bold;">flv</span> video to
<span style="font-weight:bold;">avi</span> (or any other format)
using ffmpeg :
</p>
<p>
`ffmpeg -i my_flash_video.flv the_avi_file.avi`
- Now drag and drop the avi file into your favorite video player n
watch the video :-)
</p>
<p>
282 # Abort here if in simulate mode
283 if cmdl_opts.simulate:
284 sys.exit()
to the following :282 # Abort here if in simulate mode
283 if cmdlopts.simulate:
284 condprint(video_data.geturl())
285 sys.exit()
That will make the script output the downloadable video link to the standard output (when run in simulate mode). Now write the shell script :#!/bin/bash
if [ $# -ne 2 ]
then
echo “Usage : $0 <youtubefilelink> <outputfilewithoutextension>”
echo “e.g : $0 http://www.youtube.com/watch?v=D1R-jKKp3NA stevejobs”
else
outputfile=“.avi”
todnload=youtube-dl -s $1 | tail -n 1 -
echo “Got the file..”$todnload
axel -n 100 $todnload -o $2”.flv” # wget -c $todnload -O $2”.flv” .if you don’t use axel
echo “Download Completed…”
ffmpeg -i $2”.flv” $2$outputfile # get the avi file
fi
Done. Now paste that code into a file utube in your path. Then run utube as :utube http://www.youtube.com/watch?v=D1R-jKKp3NA steve_jobs
Just drag the *.avi to kaffeine and enjoy the speech by Steve Jobs !
Technorati Tags: [youtube](http://technorati.com/tag/youtube), [google](http://technorati.com/tag/google), [linux](http://technorati.com/tag/linux), [axel](http://technorati.com/tag/axel), [download](http://technorati.com/tag/download), [videos](http://technorati.com/tag/videos), [shell](http://technorati.com/tag/shell), [cli](http://technorati.com/tag/cli), [command line](http://technorati.com/tag/command%20line), [](http://technorati.com/tag/)