-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Ytdlp.NET is an open-source, modern .NET wrapper library for yt-dlp, the popular command-line audio/video downloader and metadata extractor.
It provides a fluent, strongly-typed API to build yt-dlp commands, fetch rich metadata, list formats, monitor progress, and execute downloads with full event support.
| Ytdlp.NET | |
|---|---|
| Developer | Manojbabu (manusoft/manuhub) |
| Initial release | 2025 |
| Stable release | 1.4.0 |
| Preview release | 2.0.0-preview1 (February 2026) |
| Repository | github.com/manusoft/yt-dlp-wrapper |
| Written in | C# (.NET 8.0 or later) |
| License | MIT |
| Website | https://github.com/manusoft/yt-dlp-wrapper |
Ytdlp.NET simplifies interaction with yt-dlp by offering:
- Fluent builder pattern (
SetFormat,EmbedMetadata,UseProxy, etc.) - Rich metadata parsing via
GetVideoMetadataJsonAsync(title, duration, views, thumbnails, formats, chapters, subtitles, etc.) - Auto-selection helpers (
GetBestAudioFormatIdAsync,GetBestVideoFormatIdAsync) - Real-time progress events (
OnProgressDownload,OnPostProcessingComplete) - Cancellation support with graceful handling
- Batch & concurrent downloads
- SponsorBlock, cookies-from-browser, concurrent fragments, custom headers, etc.
It does not bundle yt-dlp — users must install yt-dlp separately (or use companion packages like Ytdlp.Stable.Build).
- Fluent API — chainable methods for almost all common yt-dlp flags
-
Metadata & Formats — full JSON parsing with strongly-typed
MetadataandFormatclasses - Events — progress, errors, completion, post-processing callbacks
- Progress parsing — percentage, speed, ETA, fragments, merging detection
-
Cancellation — safe
CancellationTokensupport (no stalled processes) -
Companion packages —
Ytdlp.FFmpeg.Build,Ytdlp.Stable.Build, etc. for zero-manual-setup - .NET Modern — targets .NET 8.0 and .NET 9.0, async-first
<PackageReference Include="Ytdlp.NET" Version="2.0.0-preview1" /><PackageReference Include="Ytdlp.Stable.Build" Version="*" />
<PackageReference Include="Ytdlp.FFmpeg.Build" Version="*" />
<PackageReference Include="Ytdlp.FFprobe.Build" Version="*" />
<PackageReference Include="Ytdlp.Deno.Runtime" Version="*" /> These packages automatically download and extract the latest yt-dlp / FFmpeg binaries into your output folder.
var ytdlp = new Ytdlp(); // auto-detects yt-dlp from companion packages or PATH
// Download best 1080p video + best audio
await ytdlp
.SetFormat("bestvideo[height<=1080]+bestaudio/best")
.SetOutputFolder("./downloads")
.SetOutputTemplate("%(title)s [%(resolution)s].%(ext)s")
.EmbedMetadata()
.EmbedThumbnail()
.ExecuteAsync("https://www.youtube.com/watch?v=Xt50Sodg7sA");string bestVideo = await ytdlp.GetBestVideoFormatIdAsync(url, maxHeight: 1080);
string bestAudio = await ytdlp.GetBestAudioFormatIdAsync(url);
await ytdlp
.SetFormat($"{bestVideo}+{bestAudio}/best")
.ExecuteAsync(url);var meta = await ytdlp.GetVideoMetadataJsonAsync(url);
Console.WriteLine($"Title: {meta?.Title}");
Console.WriteLine($"Duration: {meta?.Duration} s");
Console.WriteLine($"Views: {meta?.ViewCount:N0}");
Console.WriteLine($"Best thumbnail: {meta?.BestThumbnailUrl}");-
Ytdlp is not thread-safe
Do not use the same instance from multiple threads or concurrent tasks.
Always create a fresh instance per download operation when running in parallel.Safe example (concurrent batch):
var tasks = urls.Select(async url => { var y = new Ytdlp(); // new instance per task await y.SetFormat("best").ExecuteAsync(url); }); await Task.WhenAll(tasks);
Unsafe (will cause race conditions):
var y = new Ytdlp(); // shared instance var tasks = urls.Select(u => y.SetFormat("best").ExecuteAsync(u)); await Task.WhenAll(tasks);
-
Disposal
In v2.0 the class does not implement IDisposable. Internal resources (e.g. child processes) are cleaned up automatically when the instance is garbage-collected. Proper Dispose support and an immutable builder pattern (for safe reuse) are planned for later.
- .NET 8.0 or later
- yt-dlp executable (required)
- FFmpeg / FFprobe (recommended for merging, audio extraction, thumbnails)
- yt-dlp — upstream project
- Ytdlp.NET GitHub Repository
- .NET Package Manager (NuGet)
- GitHub repository: https://github.com/manusoft/yt-dlp-wrapper
- yt-dlp releases: https://github.com/yt-dlp/yt-dlp/releases
- FFmpeg builds: https://www.gyan.dev/ffmpeg/builds/
This page was last edited on February 15, 2026.
Copyright (C) 2025-2026 Manojbabu, Manuhub