Viewing YouTube movies offline

youtube-dl

The classic youtube-dl [8], written in Python, is under active development – and at a very fast pace. If you cannot find the tool in your distribution's repositories, you can install the current version with the commands from Listing 1. To use the program, you only need to pass it a URL, and off you go.

Listing 1

Installing youtube-dl

$ sudo wget https://yt-dl.org/downloads/2013.11.20/youtube-dl -O /usr/local/bin/youtube-dl
$ sudo chmod a+x /usr/local/bin/youtube-dl

The online help, which you can view by typing youtube-dl --help, exposes the program as a functional monster: Using appropriate parameters, you can set up a download via a proxy server or change the string for the user agent. Youtube-dl downloads playlists completely or partially on request. For partial downloads, you either specify the number of videos, use regular expressions to select movies with a specific song, or to specify a date. The program cannot tap complete channels. On request, the script reduces the data rate, thus considerably saving network bandwidth.

Youtube-dl saves metadata, video descriptions, and subtitles in separate files on request. However, the software does not provide an option for defining the file name of the movies that you save. Like cclive, it only lets you specify parts of the name using wildcards. For example, the following command would save the MP4 video titled Big Buck Bunny in the ~/Videos as Big Buck Bunny.mp4:

$ youtube-dl -o '~/Videos/%(title)s.%(ext)s' http://www.youtube.com/watch?v=YE7VzlLtp-4

During the download, the script reveals the progress, the file size of the entire movie, the data rate, and the time remaining. Broken downloads can be continued later if needed. The program even automatically detects whether a canceled download exists and it then revives the process.

Youtube-dl can simultaneously download a movie in all formats offered by YouTube. If you are interested in only a particular format, you can first list the available formats (Figure 7). When starting the script, then enter the appropriate identification number. You even have the option of specifying preferences. If you need to log in to access a movie, the program helps you do so. It will also forward downloaded movies to another application, such as FFmpeg, on request.

Figure 7: Here, youtube-dl initially tries to download the video with a resolution of 144x176 pixels. If that does not work, it resorts to the version with a resolution of 240x320 pixels.

Conclusions

If you want an easy option for downloading a YouTube movie, you should go for a program with a graphical user interface. The 4K Video Downloader is very easy to handle but comes with annoying advertising and half-crippled functions.

ClipGrab launches quickly on 32-bit systems, but the search feature proved useless in our lab. Minitube plays the video but only downloads videos with a Creative Commons license in the current version. xVideoServiceThief is recommended for anybody who typically downloads many videos overnight.

In terms of command-line programs, youtube-dl's large feature set and update frequency speak in favor of this tool. Hot on its heels follows cclive, which offers very similar functions. Get-flash-videos failed to download any movies at all, at least in the version we tested (1.24), and is thus disqualified.

Thinking Outside the Box

In addition to the applications presented here, you can find numerous other download helpers. The Firefox add-on Video DownloadHelper [9] adds a new menu item to the browser with buttons that let you download the YouTube video you are currently viewing (Figure 8). You have the choice between formats provided by the platform, and the extension will even convert video to other formats after downloading, if so desired. Thus, Video DownloadHelper is ideal for users who often browse YouTube.

Figure 8: Video DownloadHelper even breaks into the YouTube site and offers its services there.

If you only occasionally download a video, the easiest way is to leave it up to a service on the Internet. For example, on the Clip Converters page [10], simply enter the URL for the video, choose a format and file name, and then download the movie (Figure 9).

Figure 9: Clip Converter converts the video to the desired format.

The Author

Tim Schürmann is a freelance computer scientist and author. Besides books, Tim has published various articles in magazines and on websites.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Minitube: Slimline YouTube Client

    Anyone wanting to watch just a short video on YouTube probably won't need Minitube, for those that want more, it's a must-have app.

  • YouTube Players

    YouTube offers more than just funny kitten movies; you will also find more than 60 million music videos. With a native YouTube client for Linux, you can use this online jukebox as conveniently as your local music collection.

  • New Boxee Beta Brings Streaming Movie Library to Your Desktop

    Home Theater PC program adds steaming movie library from YouTube, Hulu.

  • Movgrab

    Video portals such as YouTube or Vimeo offer a wealth of curious and entertaining short films. If you want to enjoy them offline, a small tool called Movgrab can help.

  • Tool Tips

    We tested Mtools 2.3, PasDoc 0.14.0, SMTube 15.8.0, Jq 1.5, Pen 0.30.0, and PingChecker 15.8.16.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News