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 https://www.youtube.com/watch?v=MNn9qKG2UFI -o traffic
When the process finishes you will have the full video on your computer!