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.
- Lets install it through homebrew for ease: brew install youtube-dl
- Go ahead and test it out by downloading a video: youtube-dl -f bestvideo+bestaudio/best -ci http://www.dailymotion.com/video/x5f0hub
- 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.
- The “-ci” enables “continuation” which means you can resume a broken/partial download and the “i” is to ignore errors and continue on.
- Here is another great command, it will read a list of URLs and download them each one at a time: youtube-dl -f bestvideo+bestaudio/best -ci –batch-file=’./batchlist.txt’
- 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 https://www.youtube.com/watch?v=TWYcSBHfPTQ