How to set default options for youtube-dl youtube downloader in GNU/LINUX

12:05 PM No Label 0 Comments

Before we begin, we shall see what exactly is youtube-dl, for those who might have stumbled upon this page accidentally.

What is youtube-dl ?

youtube-dl is a free command line utility that can be used to download videos from youtube (not just limited to youtube) in Windows and GNU/LINUX.

Linux Mascot Tux holding Youtube
Linux - Youtube


View the full list of sites supported by youtube-dl

Why should I set the default options ?

These are the benefits that I can come up with for myself :
  • Bandwidth is  saved
  • Prevent the video(s) from getting corrupted accidentally
  • Set you preferences for the video/audio format/quality
The benefits are not limited to the ones stated above.

Saving the bandwidth :

Problem :

Suppose that you have a limited bandwidth internet connection. You want to download some videos with youtube-dl , and only as moderate quality videos. Will you enter the options every time you paste a youtube link to download the video ? Sometimes you might forget to do so, and the youtube-dl might start downloading a HD quality video. Boom... Bandwidth loss for you.

Solution :

Set the default option to download the video in a particular quality or restrict the maximum size of the video file that can be downloaded

Prevent the video from getting corrupted accidentally :

Problem :

You start downloading a video and suddenly want to download the video in another format. You cancel the download and start the download. Unfortunately, if the new video is saved under the same file name, youtube-dl considers it as the same video being resumed and downloads from where the last video was stopped downloading. Result - Corrupted Video

Solution :

Set the saved video's file name to be VIDEO TITLE - VIDEO ID - FORMAT.EXTENSION . This could have saved my bandwidth and my time too. was out of luck

Prefer a Video/Audio Format/Quality Everytime :

Problem :

You may want to download the video/audio in a specific format/quality. But specifying them everytime will be a tiresome work.

Solution :

Set your preferred video/audio format so that you do not have to enter it everytime

Setting the default options for youtube-dl :

You can set the default options for youtube-dl in two ways: Graphical way or the nerdy command line way

Graphical way :

  1. Open the file manager.
  2. Open the .config directory in your home folder (If this is not visible, use Ctrl + H to make it visible)
  3. Open the file named youtube-dl.conf. If it does not exist, create one.
  4. Then enter the options that youtube-dl should take as default while downloading the videos. 
  5. Save the file.

Command Line :

  1. Open Terminal and enter the following :
  2. cd ~/.config/
    vi youtube-dl.conf
    
  3. Then enter the default options for the youtube-dl and then save the file
From the next time when you download the youtube videos using youtube-dl, the default options will take effect.

Download Videos without default settings :

Just as much you want to download using the default settings, you might also want to skip the default settings for some videos.

For you to download the video in the way you like, just add --ignore-config flag to the youtube-dl.

youtube-dl --ignore-config https://www.youtube.com/watch?v=yVpbFMhOAwE

(OR)

If you just want to prevent a specific flag from taking effect, then you can also pass that flag with the value you want

Lets say, you have set the default video format to 18 (mp4 - 640x360), but you want to download a video in 720p webm format , you can pass the flag -f 247 .

Stay tuned with us for more updates. See the right pane for our social networking pages




A LINUX enthusiast and tech passionate guy. Love to watch Anime and play cricket. Got extra bit of care in myself, guess that's what people call selfishness :-P Google+