Download YouTube Videos For Offline Viewing On Linux

youtubeI have a confession to make. I’m a sucker for gadget reviews on YouTube. I can’t even remember the last time I actually looked at a normal review site for a gadget review.

Apart from reviews of the latest gadgets, YouTube is also a great place to watch, well, almost anything that moves!

The only thing that I don’t like is that I have to keep going back online to view videos. Also, I can’t email YouTube videos to my friends who have had YouTube blocked in their offices to save bandwidth or for other reasons.

I’ve seen software for Windows which let the user save videos from YouTube for offline viewing, but since I’m a staunch Linux supporter, I really wanted something similar for Linux and went searching for a YouTube video downloader online.

And I found the perfect utility for the job called youtube-dl. This is a command line utility so you’ll have to be familiar with the Linux command line to use it.

This isn’t that tough and if you’ve been using Linux for any length of time, you probably know how to fire up Terminal, gnome-terminal, konsole or any other Terminal application that you have for your flavour of Linux.

Downloading a video using youtube-dl couldn’t be easier. To download a video you just have to give the URL of the video to the youtube-dl script and then let it do its job. For example, to download the video with the url http://www.youtube.com/watch?v=B2FpDDEVWtk&feature=channel, I just need to use the command:

youtube-dl http://www.youtube.com/watch?v=B2FpDDEVWtk&feature=channel

youtube-dl

As you can see, the script figures out the actual video path by itself and then starts saving it to the local hard disk. When it has the complete video downloaded, it informs the user and tells you the name that is has saved it under.

The youtube-dl command also supports a couple of parameters which let you do things like saving the video file with the title of the video as the filename, or giving a completely different filename to the downloaded video.

Options:
-h, --help            print this help text and exit
-v, --version         print program version and exit
-u USERNAME, --username=USERNAME
account username
-p PASSWORD, --password=PASSWORD
account password
-o FILE, --output=FILE
output video file name
-q, --quiet           activates quiet mode
-s, --simulate        do not download video
-t, --title           use title in file name
-l, --literal         use literal title in file name
-n, --netrc           use .netrc authentication data
-g, --get-url         print final video URL only
-2, --title-too       used with -g, print title too
-f FORMAT, --format=FORMAT
append &fmt=FORMAT to the URL
-b, --best-quality    alias for -f 18

If you’re trying to download a video which requires you to enter a username and password on YouTube, you can enter that using the --u USERNAME and --p PASSWORD parameters as can be seen in the help menu above.

I’d love to hear about other tools that you guys use to download videos from online sites for offline viewing. Let us know about your favourite tools for the purpose in the comments.

Sharninder is a programmer, blogger and a geek making a living writing software to change the world. He also loves to travel. Read all about his exploits at his weblog - Geeky Ninja.

Tags: , , , ,

 

Enjoyed the article? Subscribe to Make Tech Easier today to get your daily updates of technology tutorials, tips and tricks.

Enter your email:

1 pingback/trackback (Click to open)

10 Responses

  • adamh says:

    get this add-on for firefox: http://www.downloadhelper.net/

    It is the thing you need.

    Reply

    Sharninder Reply:

    I agree adamh. But, I needed a simple command line utility for my purpose. I’ll take a look at the firefox extension also.

    Reply

  • Eric says:

    Or you can just add pwn to the beginning of “youtube” in the URL. Like this: http://www.PWNyoutube.com/watch?v=gZAnnvSOEmw

    There’s nothing to install, its easy, and it works from any browser.

    Reply

  • Bob says:

    Not sure why this was positioned as a Linux tool. I checked out the youtube-dl site and it mentions that it is platform independent and will work on Linux, Windows, and Mac OS X.

    Reply

  • Sharninder says:

    @Bob: Like I said, I’m a Linux user and needed a tool which would work on Linux and youtube-dl worked for me.

    I should have probably mentioned that youtube-dl is actually a python script and by virtue of that cross platform and work on windows and OS X also.

    Reply

  • Derrick says:

    all you have to do is go to the /tmp directory after watching the video and you will see the downloaded video there waiting for you. It will have a randomly generated hash-like name, but nautilus will detect it as a video and thumbnail it. You just copy it where you like and rename it to ‘movie.flv’. This works for most basic flash viewing sites. The file is deleted when you change pages.

    Reply

  • ucef says:

    hi
    i actually use downloadhelper or fast video download, 2 firefox extentions .. but its good to know about that fancy command tool :p

    my question is: is there a way to be able to watch the video online or offline but on youtube??
    i mean can we make youtube, mozilla, or our pc somehow save the video we re watching, and next time we open mozilla (with connection “on”) we ll be able to watch the same video without the need of waiting??

    (ps: my connection really sucks: 128 Kb/s; so is my english lol sorry for my bad eng)

    Reply

  • sradha sadu says:

    Here is a site that more use full than pwnyoutube.com download youtube videos on the fly,in any format http://youtubeddl.com dirict download from youtube server

    Reply

  • Beef says:

    All these tools are fine, but is there any way of downloading a whole channel or updating it with newly added content? I found many tools that handle separate videos or huge graphical things witch huge requirements, but no simple command line util.
    I think, it should not be so hard to make, so if it does not exist, I am going to make it eventualy…

    Reply

    Sharninder Reply:

    not that I know of. If you planning to make a tool for this purpose, that would be excellent. Let us know about it :-)

    Reply

Leave a Comment




 

Sign in with Twitter

Comment

Please Note: Comments maybe under moderation after you submit your comments so there is no need to resubmit your comment again