Thursday, July 12, 2012

Downloading files from YouTube in Ubuntu

There are a lot of nice videos in YouTube from tops for kids to machine learning. Some of these videos are so interesting, feel like viewing them again and again. When you find this pattern, it's better to download the videos. Not only does this allow for offline view, but also save the bandwidth. Bandwidth cap makes this even more useful.

`youtube-dl` is a very useful command to download files from YouTube in Ubuntu. `youtube-dl`has got a lot of nice options, here are some of the options I use

youtube-dl -c -t -f 5 --batch-file=files.txt

-c -> resume partially downloaded file
-t -> Use the title of the video in the file name used to download the video
-f -> Specify the video format (quality) in which to download the video.
--batch-file -> Specify the name of a file containing URLs of videos to download from youtube in batch mode. The file must contain one URL per line.

One thing to note is that the YouTube video can be downloaded in a lot of formats (-f option, see man page for `youtube-dl` for more details) and `-f 5` options uses a format with less download, not-bad quality and also plays in VLC on Ubuntu.

Installing of `youtube-dl` on Ubuntu is pretty straight forward. `sudo apt-get install youtube-dl` would be sufficient. There is a non-linux version of the same, but I haven't tried it out. But, the Ubuntu version of `youtube-dl` is really cool.

No comments:

Post a Comment