![](https://cdn.mos.cms.futurecdn.net/9GAnGA8fRVFcAKtfX3BqBK.png)
YouTube is, by far, the most popular user-content video streaming service in the world, hosting everything from children's songs to live streaming tech shows. But what if you need to download a YouTube video?
The officially supported way to download YouTube videos is to pay $11.99 per month for YouTube Premium, which allows you to save clips to your PC or phone for later viewing. However, not only does that cost money, but you don't end up with a file you can edit or feed to an AI voice-to-text program for transcription.
Fortunately, it's easy to download any YouTube video as an MP4 file, which you can transfer to any device or modify or transcribe as necessary. Note that downloading copyrighted work without permission is illegal and downloading files from YouTube violates its terms of service and may lead to termination of your account.
Below, we'll show you two different methods of downloading YouTube videos to your PC. The first method involves using VLC (Video Lan Player), a popular open-source media player and using it to grab the direct URL to an MP4 you can visit and save via your browser. The second method is faster, allowing you to download YouTube videos with a single command line command, but it requires you to use Python.
How to Download YouTube Videos Using VLC
1. Download and install VLC Media player if you don't have it already. Make sure to get the latest version.
2. Copy the URL of the YouTube video you wish to download.
3. Select Open Network Stream from the Media menu or Click CTRL + N.
![](https://cdn.mos.cms.futurecdn.net/LotxpbFFbxrwnEmVLKf4nZ.png)
4. Paste the URL into network URL box and click Play.
![](https://cdn.mos.cms.futurecdn.net/ad6TE6kjpbTwZBpZNhnFT3.png)
If this works, you should see the video start playing in VLC. If the VLC screen remains blank (as it did for us) and doesn't play a video, you need a fix. The fix that worked for us was to download youtube.lua from VLC's github repo, copy it to the playlist folder (C:\Program Files\VideoLAN\VLC\lua\playlist) and delete or rename the youtube.luac file that it's meant to replace.
![](https://cdn.mos.cms.futurecdn.net/7Prr3Eu4t7xUnRK5udpRqV.png)
If that doesn't work, try disabling hardware acceleration or cookie forwarding in VLC.
5. Select Codec information from the Tools menu or hit CTRL + J.
![](https://cdn.mos.cms.futurecdn.net/bQSuKQHwtF4eEnbxzeE6c.png)
6. Copy the URL from the Location box. To copy it all, you'll need to click into the box, hit CTRL + A and hit CTRL + C.
![](https://cdn.mos.cms.futurecdn.net/FGLT2Undo4jr5bV8LtFPQ5.png)
7. Paste the URL into your browser's address bar and load it. The video will load and start to play. You can pause it as it's not necessary for it to be playing.
8. Right click on the video and select Save video as. Or hit CTRL + S.
![](https://cdn.mos.cms.futurecdn.net/k3ngBv3hmk3ctxbkTuPxXU.png)
9. Select the location you want to save the file to and the file name and click Save.
![](https://cdn.mos.cms.futurecdn.net/ve7xgQYkZDSaNbqcwUCmTm.png)
Within a few seconds or minutes, depending on the file size and Internet connection, you'll have an MP4 of the YouTube video stored locally.
How to Download YouTube Videos Using Python
If you want a YouTube download process that involves fewer steps, using a Python script with pytube, a free Python library, is a great way to do it. You just need to have a recent version of Python installed and be comfortable working with the command line.
The following steps will work for Windows, Linux and (likely) macOS as well.
1. Install Python and pip if you don't have them both already. If you're using Windows, you can get Python, which includes pip, from Python.org
2. Install pytube via pip.
pip install pytube
3. Create the following Python script and save it as ytd.py or whatever you want to name it.
from pytube import YouTube
import sys
videoURL = ""
if (len(sys.argv) > 1):
videoURL = sys.argv[1]
if ("youtube.com" not in videoURL):
videoURL = input("Enter YouTube URL: ")
yt = YouTube(videoURL,use_oauth=True,allow_oauth_cache=True)
filename = yt.title.replace(" ","_")
print("Downloading YouTube File: " + yt.title)
yt.streams.first().download(filename=filename + ".mp4")
This is a very simple script that could be even simpler. It first imports YouTube from pytube and sys (needed for handling command-line arguments). It creates a blank variable called videoURL and, if there's an argument given at the command line, it checks to see if that URL contains youtube.com.
If there's no argument given at the command line or the argument doesn't contain a YouTube URL, it prompts the user to paste in a YouTube URL and then downloads it in MP4 format, using the title of the video (with dashes for spaces) as the filename.
On line 7, you'll note that we are downloading our YouTube video with oauth and oauth caching enabled. You can try running the script without these, but in my experience, it will not download videos if these are not enabled. However, the first time you run the script with them on, Google will ask you to register your device (see below), which is free and takes about 30 seconds.
4. Run the ytd.py Python script followed by the URL of a video you wish to download.
python ytd.py [YOUTUBE VIDEO URL GOES HERE]
If you do not give a valid YouTube URL in your command-line argument, the script will prompt you to enter one.
![](https://cdn.mos.cms.futurecdn.net/mbagogGm9GyoLMAr6MVJbA.png)
5. Register your computer as a device at google.com/device if prompted. The first time you download a YouTube video (or perhaps the first time in a while), the system will give you a code and ask you to go to google.com/device and enter the code to associate the PC with your YouTube account (in my case, it also asked for permission to my YouTube TV account which was weird).
![](https://cdn.mos.cms.futurecdn.net/5YiPShWNJgb5hYDUkyvhG.jpg)
The reason you need to do this is that, if you don't associate the PC with your account, pytube may not be allowed to download videos. In effect, you are making YouTube think of your PC much the way it registers a set-top box.
After you've registered, return to the command prompt and hit Enter. You should not need to do this again in the same session and perhaps not for a while.
Your YouTube video will download as an MP4 in the same directory you ran ytd.py from.