youtube-dl is a command line utility to download videos from Youtube and in this tutorial you will learn how to use it.


There are several ways to install youtube-dl:

sudo curl -L -o /usr/local/bin/youtube-dl

sudo chmod a+rx /usr/local/bin/youtube-dl
sudo wget -O /usr/local/bin/youtube-dl

sudo chmod a+rx /usr/local/bin/youtube-dl
sudo pip install --upgrade youtube_dl




  • -o <filename>: set a name for the output file.
  • -f FORMAT: specify a quality format. FORMAT is an expression that describes format or formats you would like to download:
    -f "bestvideo[height<=1080,ext=webm]+bestaudio[ext=webm]"
    • best: Best quality format.
    • worst: Worst quality format.
    • bestvideo: Best quality video-only format (e.g. DASH video).
    • worstvideo: Worst quality video-only format.
    • bestaudio: Best quality audio only-format.
    • worstaudio: Worst quality audio only-format.
    • height: Height of the video, if known.
    • ext: File extension.
    • More options.