Download a YouTube Video from the Command Line with youtube-dl

Ben Cook • Posted 2020-02-15 • Last updated 2021-10-15

To download a YouTube video from the command line, use the Python package youtube-dl:

pip install youtube-dl
youtube-dl <url>

If you want to specify the name of the downloaded file, use the -o flag.

For example, to download this road traffic video for object tracking to a file called traffic.mkv:

youtube-dl -o traffic

When the process finishes you will have the full video on your computer!