Today I’d like to share a trick I’ve learned to download videos faster using youtube-dl. The youtube-dl tool is a command-line utility to download videos from YouTube. But sometimes, when you try to download a large video (something like >=200MB of size), you might face a download time of 40 minutes or more, even when you’re used to download files of the same size faster. So, after researching some solution for this, I’ve found out that the best option is to use multiple threads to download the video content.
First you need to have youtube-dl installed on your machine. Follow the official installation guide and you’re done.
After that, you’re gonna need to download an external downloader to call from youtube-dl’s CLI. We’re gonna use aria2. Just grab a compiled version for your system, and add it to yout PATH variable.
Finally, type the following command in your preferred shell to download a large video faster:
1
$ youtube-dl --external-downloader aria2c --external-downloader-args "-s 16 -x 16 -k 1M" VIDEO-URL
Passing these arguments to the external downloader aria2c, we’re gonna use 16 connections to download the video file (-s 16
), in which each chunk of the file has 1MiB (-k 1M
), limited by 16 connections with the server providing the file (-x 16
).
Finally, you can check aria2’s documentation to personalize arguments passed to it’s CLI.