How to use youtube-dl to download videos from the web (not just youtube!)

Recently I have had to download a large number of videos off the web for the purpose of archiving and transcoding. There are a lot of software products that do this but since I had to download hundreds of them at a time I decided to look into something on the command line so I could get it to download them all for me.

youtube-dl – This little program is what I ended up using and I have found it to be more than sufficient for my needs. If you ever needed to rip a video off of the web or to extract just the audio stream (just the music!) this tool handles it all. Despite it’s name, it works for what seems like hundreds of different websites, is free and open source and also has ways of handling generic video on websites as well.

  1. Lets install it through homebrew for ease: brew install youtube-dl
  2. Go ahead and test it out by downloading a video: youtube-dl -f bestvideo+bestaudio/best -ci
  3. The “-f bestvideo+bestaudio/best” sets the video and audio formats to the very best. This is useful on sites which allow variable “quality” settings.
  4. The “-ci” enables “continuation” which means you can resume a broken/partial download and the “i” is to ignore errors and continue on.
  5. Here is another great option/argument: “-a“, it will read a list of URLs from a file that you specify and download them each one at a time: youtube-dl -f bestvideo+bestaudio/best -cia batchlist.txt
  6. Now for a command line to rip the audio stream out to an mp3 file of the highest possible quality: youtube-dl --audio-format mp3 --audio-quality 0 -cix
  7. Here is the YouTube title as above but with just the shorter ID instead of the entire URL. It also encodes to 128k AAC and selects the best quality audio to start with and includes the -ci options mentioned above: youtube-dl -f bestaudio/best -cix --audio-format aac --audio-quality 128K TWYcSBHfPTQ
  8. Here is another good example for downloading the subtitles file and embedding it into the resulting video: youtube-dl -f bestvideo+bestaudio -ci --sub-lang en --write-sub
    --embed-subs --add-metadata --recode-video mp4\?v\=EaKeNC9dGwg

27/11/17 – UPDATE: I just tried to rip a video from Youku and youtube-dl threw up an error, advising that I either report it as a bug or update my youtube-dl installation. I choose to update it but homebrew still has an older version. So I ran the following to update it to the latest version and it was able to rip from Youku.

  • sudo chmod 777 /usr/bin/local/youtube-dl
  • youtube-dl -U



, ,



2 responses to “How to use youtube-dl to download videos from the web (not just youtube!)”

  1. Onashine

    Thank you for this sharing, really helpful. I always use Acethinker video downloader to save online videos, free and works well. Share it here as an alternative to youtube-dl.

    1. Noshine

      Do not download acethinker, it is not free – trash software probably a virus.

Leave a Reply

Your email address will not be published. Required fields are marked *

four  ×    =  four