Open Source

yt-dlp: Feature-Rich Open-Source YouTube and Video Downloader

yt-dlp is a feature-rich command-line video downloader supporting YouTube and 1000+ sites, with advanced options for format selection, subtitles, and playlists.

Keeping this site alive takes effort — your support means everything.
無程式碼也能輕鬆打造專業LINE官方帳號!一鍵導入模板,讓AI助你行銷加分! 無程式碼也能輕鬆打造專業LINE官方帳號!一鍵導入模板,讓AI助你行銷加分!
yt-dlp: Feature-Rich Open-Source YouTube and Video Downloader

Every developer who has needed to download a video programmatically has encountered the same question: is there a reliable command-line tool that handles all the streaming protocols, format negotiations, and site-specific quirks? The answer has been yt-dlp, the open-source video downloader that has become the de facto standard for media archiving, content analysis, and automation.

yt-dlp started as a fork of the venerable youtube-dl project, driven by the need for faster updates as YouTube and other platforms modified their streaming protocols. It has since grown into a comprehensive download tool supporting over 1000 websites, with advanced capabilities for format selection, subtitle extraction, thumbnail downloading, metadata embedding, and post-processing.


How Does yt-dlp Handle the Complexity of Video Extraction?

Video streaming platforms use a bewildering array of protocols, DRM schemes, and format negotiations. YouTube alone serves video in multiple codecs (AV1, VP9, H.264), resolutions (144p to 8K), and container formats (webm, mp4), selected dynamically based on client capabilities and network conditions.

yt-dlp’s extractor system abstracts all of this complexity. Each supported site has a dedicated extractor module that understands the site’s page structure, API endpoints, and streaming protocol. The extractor retrieves available formats, negotiates the best option based on user preferences, and generates direct download URLs for the media segments. The downloader then fetches these segments, handles decryption if needed, and assembles the complete file.

Featureyt-dlpyoutube-dl
Supported sites1000+1000+ (fewer updated)
YouTube format supportAV1, VP9, H.264 (all resolutions)Variable
Download speedMulti-threaded -N optionSingle-threaded
SponsorBlock integrationBuilt-inPlugin required
Cookies from browsersYes (Chrome, Firefox, Safari, Edge)Limited
SponsorBlockBuilt-in sponsor segment removalNot available
Thumbnail embeddingYesYes
Subtitle downloadAll formatsMost formats

The -N (multi-threaded download) option is a significant performance improvement. For large files, yt-dlp splits the download across multiple connections, each fetching different segments in parallel. On fast connections, this can multiply download speeds by 5-10x compared to single-threaded downloads.


What Are the Most Useful yt-dlp Command Patterns?

yt-dlp’s power comes from its extensive command-line options. Basic usage is straightforward — yt-dlp <URL> downloads the best available quality — but the tool’s real value emerges with more specific configurations.

For archiving, a common pattern downloads the best video and audio separately and merges them with --merge-output-format mkv. This preserves the highest quality available while ensuring compatibility. The --write-auto-subs flag downloads automatically generated subtitles, and --embed-metadata embeds title, uploader, description, and thumbnail into the file.

Use CaseCommand
Best quality videoyt-dlp -f bestvideo+bestaudio --merge-output-format mkv URL
Audio only (MP3)yt-dlp -x --audio-format mp3 --audio-quality 0 URL
Download playlistyt-dlp --yes-playlist --playlist-start 1 --playlist-end 10 URL
Download subtitlesyt-dlp --write-subs --write-auto-subs --sub-lang en URL
SponsorBlock segmentsyt-dlp --sponsorblock-mark all URL
Custom output pathyt-dlp -o "%(channel)s/%(title)s.%(ext)s" URL
Multi-threadedyt-dlp -N 5 URL
Download at specific timeyt-dlp --download-sections "*0:15-2:30" URL

The output template system (-o) enables sophisticated file organization. Templates can include channel name, upload date, video ID, resolution, and any other metadata field. For bulk downloads, this keeps files organized without post-processing.


How Does yt-dlp Handle Site Updates and DRM?

Video platforms frequently change their page structures, API endpoints, and streaming protocols. These changes can break extractors — a common frustration with video download tools. yt-dlp’s active development community addresses this with frequent releases, sometimes multiple times per week.

The extractor update mechanism allows users to update extractors independently of the main yt-dlp binary. yt-dlp -U updates yt-dlp to the latest release. For sites that change more frequently, individual extractor updates may be released between full releases.

DRM-protected content (Widevine, PlayReady) remains a limitation. yt-dlp cannot decrypt DRM-protected streams, as this would require circumventing legal protections. For non-DRM content — which covers the vast majority of publicly available videos — yt-dlp provides comprehensive download capabilities.


How Do You Integrate yt-dlp into Automated Workflows?

yt-dlp’s predictable JSON output and exit codes make it ideal for scripting. The --dump-json flag outputs all video metadata as JSON, enabling format analysis, quality checking, and download decisions in scripts without actually downloading the video.

For archiving workflows, yt-dlp’s --download-archive option maintains a text file of downloaded video IDs. Subsequent runs skip already-downloaded videos, making incremental updates efficient. Combined with --dateafter and --datebefore filters, this enables automated weekly archives of specific channels or playlists.

The post-processing system supports custom scripts and hooks. The --exec option runs a command after each download, enabling actions like transcoding to specific formats, uploading to archival storage, or sending notifications through messaging systems.


FAQ

What is yt-dlp and how is it different from youtube-dl? yt-dlp is a feature-rich fork of youtube-dl with faster updates, more site extractors, better YouTube compatibility, multi-threaded downloads, and active community development.

What video sites does yt-dlp support beyond YouTube? yt-dlp supports 1000+ sites including Vimeo, Twitch, Dailymotion, Bilibili, TikTok, Instagram, Twitter/X, and Facebook through dedicated site extractors.

How do I download videos in specific formats or quality? Use -f for format codes, -S for sort criteria, and -f bestvideo+bestaudio/best for best combined quality. List available formats with -F before downloading.

Can yt-dlp download entire playlists and channels? Yes, with options for start/end positions, reverse order, date filters, and archive tracking to avoid re-downloading videos.

How does yt-dlp handle cookies and authentication? yt-dlp supports cookies files, browser cookies extraction, and direct credential passing for sites requiring authentication.


References

TAG
CATEGORIES