Meet Open Source Video Downloader YT-DLP

I’m updating my book, Video Encoding by the Numbers, which means lots of research into what other encoding professionals are doing. One source of knowledge I appreciate is downloading files from different websites to analyze these files. I used to use YouTube-dl, but it is not as reliable as before, and most GUI-based tools don’t work particularly well. I’m also leery about malware from some of these tools.

I learned about yt-dlp this weekend and gave it a try. While it’s currently batting around .500 on file downloads, that’s about average for a program I’d have to buy, download, and hold my nose and breath while I install. Here’s what I learned about it and some preliminary tips about how to use it.

What is yt-dlp?

yt-dlp is a powerful command-line tool derived from the popular youtube-dl project. It is designed to download videos from YouTube and other websites. Researchers, educators, and media professionals often use yt-dlp to archive and analyze video content. Unlike many commercial downloaders, yt-dlp is open-source, highly customizable, and malware-free.

Where to Find yt-dlp

You can find yt-dlp on its GitHub repository, where you can download the latest release, view the source code, and access comprehensive documentation. In addition to the Windows version that I used, yt-dlp it available for Mac and Linux.

How to Install yt-dlp on Windows

Installing yt-dlp on Windows is straightforward and involves downloading a single executable file. This simplicity is a significant advantage over many commercial products that often come bundled with unwanted software.

  1. Download the Executable:
  2. Run yt-dlp:
    • Place the yt-dlp.exe file in a directory of your choice.
    • Open a command prompt (CMD) and navigate to the directory where you placed yt-dlp.exe.
    • You can now run yt-dlp commands directly from this directory.

How to Use yt-dlp

Downloading a Single File

To download a single video file, use the following command:

yt-dlp URL
Replace <URL> with the video’s actual URL. This command works well for many videos but may fail for some due to various limitations, such as DRM protection or changes in the website’s structure. Again, here’s where I batted around 50%.

Viewing All Available Variants

Before downloading, you might want to see all available formats for a video. This is particularly useful for researchers who need specific resolutions or codecs.

yt-dlp -F <URL>
This command lists all available formats for the specified video, allowing you to choose the best one for your needs. As an example, here are the 1080p files produced by YouTube for a recent Seth Meyers video. You can view the complete list generated in this Google Sheet. If you can figure out why there are H.264 (AVC) versions ranging from 1 Mbps to 4.3 Mbps, please clue me in. For this clip, AV1’s efficiency is off the charts.
Table 1. All the 1980p variations YouTube creates for a popular but not explosive video file (about 100K views in 24 hours).

Not surprisingly, the AV1 version is the one YouTube sends when I’m watching in Chrome.

Figure 1. YouTube sends the efficient AV1 variant when I’m watching in Chrome.

Downloading a Specific Variant

Once you have identified the variant to download, use the variant number to download it:

yt-dlp -f <format_number> <URL>
Replace <format_number> with the desired format ID from the list generated by the -F command. So, looking at Table 1, I would insert number 399 to download the AV1 variant.

Downloading All Variant

For comprehensive research, you might want to download all available video variants. This command ensures you get every variation:

yt-dlp --no-download-archive --force-overwrites --no-check-certificate --no-cache-dir -v -f all -o "%(title)s-%(format_id)s.%(ext)s" <URL>
This command does the following:
  • --no-download-archive: Prevents yt-dlp from using an archive file to track downloaded videos.
  • --force-overwrites: Overwrites existing files with the same name.
  • --no-check-certificate: Skips HTTPS certificate verification.
  • --no-cache-dir: Disables caching.
  • -v: Enables verbose output for detailed logging.
  • -f all: Downloads all available formats.
  • -o "%(title)s-%(format_id)s.%(ext)s": Specifies the output template to ensure unique filenames for each format.

Limitations of yt-dlp

While yt-dlp is a versatile tool, it has some limitations:

  • No DRM Cracking: yt-dlp cannot download videos protected by Digital Rights Management (DRM).
  • Website Changes: Websites frequently update their structures, which can break yt-dlp’s ability to download videos. The community often releases updates to address these issues.
  • Incomplete Downloads: Some videos may not download completely or may fail due to network issues or other interruptions.

Additional Tips

  • Keep yt-dlp Updated: Regularly update yt-dlp to the latest version to benefit from new features and bug fixes.
    yt-dlp -U
  • Use Cookies for Authentication: For videos requiring login, you can use cookies from your browser.
yt-dlp --cookies-from-browser chrome <URL>

Documentation and Further Reading

The commands above are just the bare-boned basics. Check out these sites for much, much more functionality.

  1. Official yt-dlp Documentation
    Comprehensive guide to all features and options.
  2. yt-dlp Wiki
    Community-maintained resource with additional tips and use cases.
  3. OSTechNix yt-dlp Tutorial
    An excellent beginner-friendly guide with practical examples.
  4. Reddit r/youtubedl Community
    Active community for troubleshooting and sharing advanced usage tips.

These will help you unlock yt-dlp’s full potential, from basic downloads to complex automation tasks.

Conclusion

yt-dlp is an invaluable tool for researchers needing to download and analyze video content. Its flexibility, ease of use, and open-source nature make it a superior choice over many commercial alternatives.

About Jan Ozer

Avatar photo
I help companies train new technical hires in streaming media-related positions; I also help companies optimize their codec selections and encoding stacks and evaluate new encoders and codecs. I am a contributing editor to Streaming Media Magazine, writing about codecs and encoding tools. I have written multiple authoritative books on video encoding, including Video Encoding by the Numbers: Eliminate the Guesswork from your Streaming Video (https://amzn.to/3kV6R1j) and Learn to Produce Video with FFmpeg: In Thirty Minutes or Less (https://amzn.to/3ZJih7e). I have multiple courses relating to streaming media production, all available at https://bit.ly/slc_courses. I currently work as www.netint.com as a Senior Director in Marketing.

Check Also

Streaming Media 101: “I was Amazed at How Much I Learned”

A recent review from The Ohio State University’s Derrick Freeman highlighted what he learned from …

Build Your Own Live Streaming Cloud

I’m proud to speak at NETINT’s Build Your Own Live Streaming Cloud Symposium. We’ve assembled …

Man learning on his mobile device

Streaming Learning Center Goes Mobile

Just a quick announcement to let you know that if you’re taking a course on …

Leave a Reply

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