Just open a Terminal window and enter
If you want to download the video to a specific folder, first navigate to that folder:
On a Mac, you can type
cd and drag and drop the target folder from Finder into the Terminal window.
To automatically extract the audio after the download enter
youtube-dl -k -x https://www.youtube.com/watch?v=ATXbJjuZqbc
-k tells the program to keep the video after extracting the audio, otherwise it would be deleted.
-x extracts the audio.
Just like the
-k -x above you can add more parameters to get exactly the results you want.
Defines what format the extracted audio will be converted into. Can be
best, aac, flac, mp3, m4a, opus, vorbis, wav. If you don’t define a format, it defaults to
Sets the audio quality: 0 is best, 9 is worse for VBR. For a constant bitrate enter it like this: 128K. Defaults to 5.
Makes sure you download the best available quality:
bestaudiodownloads the best available audio-only format. If no audio-only format is available,
bestdownloads the best available combined video and audio format. If you want to download both, the best audio-only and the best video, use a comma instead of the forward slash.
If you’re picky, try
-f "bestaudio[abr>=128]/best"to download the best audio only if its bitrate is at least 128 kBit/s, otherwise download the best video.
You can also exclude formats, for example, if you’d rather not download MP3s:
For other options check the documentation.
Once you’ve found your ideal configuration and want to set it as default, you can save it to a configuration file that youtube-dl will reference every time it runs (except when you override this with the parameter
This is a simple text file, here’s a sample:
# Lines starting with # are comments # Download best audio if available and download best video -f bestaudio,best # Always extract audio and keep downloaded files -x -k # Convert to wav --audio-format wav # Bonus: Save all videos under Downloads directory in your home directory. Add original format to filename. -o ~/Downloads/%(title)s_%(format)s.%(ext)s
youtube-dl.conf (361 Bytes)
On a Mac, download the file above. In the Finder app’s menu, select
Go > Go to Folder...and enter
/etc. Move the downloaded file to that location. Edit it by right-clicking it, then select
Open With > TextEdit.
Note: This affects all user accounts on your Mac. To save the configuration for your user account only, the file needs to be renamed
config(no file extension! not config.conf, just config!). Via the Finder menu go to the folder
~/.config, create a new folder called
youtube-dland move the
configfile into it.
On Windows, download the file above and save it in your user directory:
C:\Users\<user name>\youtube-dl.conf. Or, rename it and save it as
Edit it to adjust it to your preferences.
With this file in place, you can revert back to the simple syntax of
but the audio will still be extracted and put into the right directory.