Cross platform utility to download video+audio either single files or entire playlists.
Syntax
yt-dlp [OPTIONS] URL [URL...]
Options
-F, --list-formats List the available formats.
-f, --format FORMAT Video format to download, see example below.
-a, --batch-file FILE File containing URLs to download ('-' for STDIN.)
--console-title Display progress in console titlebar.
-i, --ignore-errors Continue on download errors, for example to skip unavailable
videos in a playlist.
--abort-on-error Cancel downloading of further videos (in the playlist or the
command line) if an error occurs.
-h, --help Print this help text and exit.
--no-mtime Set the file last modified date/time to the download date/time.
--no-playlist Download only the video, if the URL refers to a video and a playlist.
--yes-playlist Download the playlist, if the URL refers to a video and a playlist.
-q, --quiet Activate quiet mode.
--restrict-filenames Restrict filenames to only ASCII characters, and avoid "&" and
spaces in filenames.
--sleep-interval SECONDS Number of seconds to sleep before each download.
-U, --update Update this program to latest version. Make sure that you have
sufficient permissions (run with sudo if needed.)
--version Print program version and exit.
--no-warnings Ignore warnings.
-w, --no-overwrites Do not overwrite files.
--write-description Write video description to a .description file.
--write-info-json Write video metadata to a .info.json file.
--write-annotations Write video annotations to a .annotations.xml file.
Above is a summary of the options, for a full list including network/proxy/filtering options, run yt-dlp --help
The files are downloaded to the current directory.
With homebrew:
brew install yt-dlp
Then to update:
brew upgrade yt-dlp
With winget:
winget install yt-dlp
Then to update:
winget upgrade yt-dlp
1) Download yt-dlp to /usr/local/bin/
sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp
( If /usr/local/bin does not already exist, then create it with sudo mkdir -p /usr/local/bin )
2) Apply permissions:
sudo chmod a+rx /usr/local/bin/yt-dlp
3) Install ffmpeg for converting file formats:
Download ffmpeg and copy it to /usr/local/bin/
Apply permissions:
sudo chmod a+rx /usr/local/bin/ffmpeg
The right-click and open ffmpeg so that macOS will recognise and allow it to be run.
4) For M1 macs/Monterey install a recent non-beta copy of Python from Python.org (around 40 MB).
The installer will put python into /usr/local/bin/
after the installer has finished run the two shell scripts which you will find under /Applications/Python 3.10/ from the terminal:
Install Certificates.command
Update Shell Profile.command
First list the available formats with -F
$ yt-dlp -F https://www.youtube.com/watch?v=VG1VVFfOnYQ 140 m4a audio only DASH audio 127k , m4a_dash container, aac @128k (44100Hz), 3.77MiB 141 m4a audio only DASH audio 255k , m4a_dash container, aac @256k (44100Hz), 7.57MiB *** 160 mp4 256x144 DASH video 113k , 12fps, video only, 3.24MiB 133 mp4 426x240 DASH video 269k , 24fps, video only, 7.27MiB 134 mp4 640x360 DASH video 272k , 24fps, video only, 6.55MiB 244 webm 854x480 DASH video 504k , 24fps, video only, 7.95MiB 135 mp4 854x480 DASH video 540k , 24fps, video only, 13.33MiB 136 mp4 1280x720 DASH video 1155k , 24fps, video only, 26.62MiB 248 webm 1920x1080 DASH video 1797k , 24fps, video only, 30.81MiB 137 mp4 1920x1080 DASH video 2750k , 24fps, video only, 57.97MiB *** 43 webm 640x360 18 mp4 640x360 22 mp4 1280x720 (best)
Using the numeric codes in the first column, you can select a specific size of Video and Audio.
So in this example, we want 1080p video (137) plus 255K audio (141) so the command becomes:
$ yt-dlp -f 137+141 https://www.youtube.com/watch?v=VG1VVFfOnYQ
If you just want the (best) possible quality, this is the default so all you need is:
$ yt-dlp https://www.youtube.com/watch?v=VG1VVFfOnYQ
The above examples will work in most shells, PowerShell, CMD, Bash etc but in zsh you must surround the url in quotes, so:
$ yt-dlp "https://www.youtube.com/watch?v=VG1VVFfOnYQ"
The 'best' quality may not be the largest size, e.g. if a 720p video has been transcoded to 1080p it will be larger but won’t look any sharper. However the algorithm for selecting 'best' is not perfect so often you will get higher quality by manually selecting the size.
By default the date/time of the downloaded file will be equal to the upload date/time to hopefully give an approximately correct date of the files creation, to disable this and use the download date use the option --no-mtime
To make YT-dlp available anywhere, either install it to a folder on the system PATH, or add the YT-dlp folder to the PATH.
On MacOS you can run yt-dlp directly from any web browser (or any other application) using macOS services and Automator.
Although this makes for an easy to use inferface, this will auto-select the video quality, often defaulting to 720p.
- Choose Applications ➞ Automator and then create a new Service (File ➞ New ➞ Quick Action)
- From Library > Actions, Choose Run Shell Script and Drag 'Run A Shell Script' into the main window:
Set:
workflow recieves current [URLs] in [any application]
Input is [entire selection]
Image [action]
Pass input:[ as arguments]
- Type in the Shell script as two lines, one to cd change directory to the location where you want the movie saved, and the second to run yt-dlp passing the URL. (Use which yt-dlp to check the location of yt-dlp.)
cd ~/Downloads/
/opt/homebrew/bin/yt-dlpWith that done save the Automator Service with a suitable name like "Save Youtube Movie" which will save into ~/Library/Services/
To run this, select any URL, in the web browser address bar, or even just a suitable URL within a text document, then right click and go to the services menu and select the name of your Automator service "Save Youtube Movie".
“Make each program do one thing well.
To do a new job, build afresh rather than complicate old programs by adding new features” ~ Ken Thompson
Related commands:
rsync - Remote file copy.
yt-dlp Github.