Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

1/1/2020 Download YouTube Videos and Audio with YouTube-dl

Download YouTube videos and audio with


YouTube-dl
Updated: 09/03/2019 by Computer Hope

YouTube-dl is a free and open-source


command-line program for Windows,
macOS, and Linux. You can use it to
download videos from YouTube.

Tip: In addition to YouTube videos,


YouTube-dl can be used to download
videos from
over 700 websites with videos , including
Tumblr.

Copyright and Fair Use

Tip: Downloading a YouTube video is legal if you use it in accordance with its license. Many
YouTube videos use the standard YouTube license, and some are licensed under Creative
Commons, for example. You can check the video's license type on its YouTube page by clicking
"Show More," then clicking the license name.

For more information, see:

https://www.computerhope.com/issues/ch001724.htm 1/9
1/1/2020 Download YouTube Videos and Audio with YouTube-dl

Google: YouTube Copyright and fair use FAQ.

Google: Creative Commons licensing on YouTube.

Installing YouTube-dl
For installation instructions, choose your operating system from the list below.

Windows

macOS

Linux

Installation: Windows
YouTube-dl does not have an installer, like most Windows programs. YouTube-dl consists of a
single executable file, youtube-dl.exe, which you can download directly.

1. Open the project page at https://rg3.github.io/youtube-dl/ , and click Download.

2. On the Download page, click the link for the


Microsoft Visual C++ 2010 Redistributable Package (x86) . You might already have
this installed; these steps will check, and install it if necessary.

https://www.computerhope.com/issues/ch001724.htm 2/9
1/1/2020 Download YouTube Videos and Audio with YouTube-dl

3. Clicking the link takes you to a page at Microsoft's website. Click Download to
download vcredist_x86.exe.

4. When the download is complete, open File Explorer, and go to the location on your
computer where you downloaded vcredist_x86.exe. Double click the file to run it.

5. At the UAC prompt, click Yes.

6. If you see the message "A newer version of Microsoft Visual C++ 2010 Redistributable
has been detected on the machine," that means you already have it installed. You can
click Close, and skip to step 8.

https://www.computerhope.com/issues/ch001724.htm 3/9
1/1/2020 Download YouTube Videos and Audio with YouTube-dl

7. Otherwise, continue with the installation, choosing the default options. When installation
is complete, click Close, and continue to the next step.
8. In your web browser, go back to the YouTube-dl Download page , and click Windows
exe.

9. The file youtube-dl.exe will download.

10. YouTube-dl now exists in the folder where you downloaded it. You can run it by opening
a command prompt, changing to your Downloads directory with the cd command, and
running youtube-dl.

https://www.computerhope.com/issues/ch001724.htm 4/9
1/1/2020 Download YouTube Videos and Audio with YouTube-dl

When you run youtube-dl, nothing will happen unless you provide it with the URL of a video to
download. For examples of how to use the program, proceed to Downloading a video, below.

Installation: macOS
If you have Homebrew, you can install YouTube-dl by opening a Terminal and running the
following command.

brew install youtube-dl

Or, if you have MacPorts, run the command below.

sudo port install youtube-dl

Or, you can download the source code using git, and compile it yourself:

git clone https://github.com/rg3/youtube-dl/ && cd youtube-dl && make

sudo make install

You can also download it using curl:

curl https://yt-dl.org/latest/youtube-dl && chmod u+rx youtube-dl

Or with wget:

https://www.computerhope.com/issues/ch001724.htm 5/9
1/1/2020 Download YouTube Videos and Audio with YouTube-dl

wget https://yt-dl.org/downloads/latest/youtube-dl && chmod u+rx youtube-dl

Tip: If you use curl or wget, youtube-dl will be downloaded to your current directory. To run the
program from anywhere else, move youtube-dl to a directory of your choosing, and make sure this
directory exists in your PATH environment variable. For example:

mkdir ~/ydl && mv ./youtube-dl ~/ydl/.

echo "PATH=$PATH:$HOME/ydl" >> ~/.bashrc && source ~/.bashrc

When installation is complete, you can proceed to Downloading a video, below.

Installation: Linux
YouTube-dl is available as a packaged binary in many Linux operating systems. For instance, on
Debian or Ubuntu systems, you can install using apt:

sudo apt install youtube-dl

On all Linux systems, you can also install it by using the curl, wget, or git methods listed above for
macOS.

Using YouTube-dl
YouTube-dl is a command line program, so it has no GUI. Instead, you use it from your command
prompt or terminal window.

https://www.computerhope.com/issues/ch001724.htm 6/9
1/1/2020 Download YouTube Videos and Audio with YouTube-dl

For help using the command prompt in Windows, see how to use the Windows command

line.

For help using the terminal in Linux or macOS, see our Command shell guide.
YouTube-dl has many options. Here, we'll cover the basics: downloading video, and downloading
audio.

Downloading a video
The simplest way to use YouTube-dl is to give it the URL of a youtube video.

1. Go to a video on YouTube that you want to download. Select the text of the URL in the
address bar, and copy it to your clipboard by pressing Ctrl+C. If the URL has a "&" in it
(a playlist, for example), only copy the URL up to, but not including, the &.

2. Open a command prompt or terminal window. On Windows, you can open the command
prompt if you press Win+R (hold down the Windows key and press R) to open the Run
box, then type cmd and press Enter. In macOS, open Applications, then Utilities, and
choose Terminal. On Linux, your terminal program will depend on your particular Linux
distribution. Usually, you can press Ctrl+Alt+T to open a terminal window.

3. Navigate to the folder where you downloaded YouTube-dl, using the cd command. (On
macOS or Linux, if you installed using a package manager such as Homebrew or apt, you
can skip this step. The youtube-dl executable is already installed to a directory in your
PATH, so you can run it from any directory.)

https://www.computerhope.com/issues/ch001724.htm 7/9
1/1/2020 Download YouTube Videos and Audio with YouTube-dl

4. Type youtube-dl, followed by a space. Then, paste the URL you copied in step 1. (In
Windows, place your cursor in the command prompt window and right-click to paste. In
macOS, you can paste in the terminal using ⌘+V. In most Linux terminals, press
Ctrl+Shift+V.)
The command should look like this:

youtube-dl https://www.youtube.com/watch?v=2Op3QLzMgSY

Press Enter to run the command and start the download.

5. The video will be downloaded to the current directory. You can now view it using a
media player such as VLC.

Downloading audio
To download the audio of most YouTube videos, you can use the -f 140 option. For example:

youtube-dl -f 140 https://www.youtube.com/watch?v=dQw4w9WgXcQ

https://www.computerhope.com/issues/ch001724.htm 8/9
1/1/2020 Download YouTube Videos and Audio with YouTube-dl

YouTube-dl will extract the M4A audio version of the video file, and save it as an audio file with
the M4A extension. You can then open it a media player such as VLC, or an audio editor such as
Audacity.

To properly save some audio files, you may need to install the ffmpeg codec first. For Windows,
visit https://www.ffmpeg.org to download ffmpeg. On macOS Homebrew, run brew install
ffmpeg. On most Linux systems, the package name is ffmpeg, e.g., sudo apt install ffmpeg.

Then, to convert a downloaded audio file to the MP3 format, you can use ffmpeg -i inputfile
outputfile. For example, the command:

ffmpeg -i Lecture.m4a Lecture.mp3

Will convert M4A audio file Lecture.m4a to an MP3 file, Lecture.mp3.

For a complete list of options, see the official YouTube-dl documentation on GitHub.

© 2019 Computer Hope

https://www.computerhope.com/issues/ch001724.htm 9/9

You might also like