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!