How To Archive YouTube Videos On Mac

832 views Leave a comment

Have you ever got issues with watching a YouTube video where the Wi-Fi coverage is spotty? Or you want to watch a 4k video but the download speeds are too slow? For whatever reasons, you can mitigate these issues by storing your favorite YouTube videos locally with the help of the terminal on your Mac. Here’s how to do it.

What is youtube-dl

You can easily archive all YouTube videos using youtube-dl. Youtube-dl (the dl stands for “download”) is open source that supports many platforms, including macOS. It’s simply a command line utility, which can be run in the terminal application.

How to install youtube-dl

There are a few ways to install youtube-dl on your Mac.

  1. First, you need to download the source code and then build it by using a compiler.
  2. You can also install Homebrew as a package manager and then you have the youtube-dl executable installed.
  3. Finally, install the pre-built app directly by entering the following commands in terminal.
    1. sudo curl -L /usr/local/bin/youtube-dl
    2. sudo chmod a+rx /usr/local/bin/youtube-dl

How to use youtube-dl

Using youtube-dl is similar to copying the URL of your favorite video to archive and then append it to the youtube-dl command in your MacOS’s terminal. But there are also other nifty options to make sure that you get the desired video quality level.

For instance, if you simply want to download and watch a video on YouTube, just do the following steps

  1. Open terminal on your Mac
  2. Enter youtube-dl URL_OF_VIDEO
  3. Click on return >Done.

The app will automatically download the “best” version containing both video and audio. Once done, you can then use your video player to play the downloaded file.

But, if you want to download a specific resolution, you can download the video portion, or if you just want an audio-only portion, here’s how to do it.

  1. Open terminal app
  2. Type in youtube-dl -F URL_OF_VIDEO
  3. Click on return.

You’ll then see a list of formats to choose from. Some format codes come with both audio and video, while some only include video and some just have audio.


If you want to download the specific format, enter the following in the terminal:

  1. youtube-dl -f 313 URL_OF_VIDEO.

You will now download the 4K video only portion. But you need to download the audio separately. For example, if the audio-only version is format code 251, you simply enter the following in terminal.

  1. youtube-dl -f 251 URL_OF_VIDEO -o AUDIO_ONLY.output.

In order to play the two files simultaneously, you will need a compatible media player to synchronously mux the two files. VLC is a good choice for you. For example, if you’d like to install mplayer, you can type in the following in the terminal:

  1. mplayer -lavdopts threads=6 -audiofile AUDIO_ONLY.output DOWNLOADED_VIDEO_FILE_NAME.

You can now enjoy your locally stored video and audio without a good internet connection. If you need more information about using youtube-dl, then you can read the youtube-dl manual in the terminal by entering the command: man youtube-dl.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.