Tyrrrz/YoutubeDownloader · error · PlatformNotSupportedException
Unsupported operating system.
Error message
Unsupported operating system.
What it means
Thrown by the local GetSystemMoniker() inside FFmpeg.GetDownloadUrl() while auto-provisioning the FFmpeg binary. The library downloads a prebuilt FFmpeg from github.com/Tyrrrz/FFmpegBin (URL built at FFmpeg.cs:110) and only ships assets for Windows, Linux, and macOS; any other OS cannot be mapped to a release-asset suffix, so the URL cannot be constructed and PlatformNotSupportedException is thrown.
Source
Thrown at YoutubeDownloader.Core/Downloading/FFmpeg.cs:88
GetProbeDirectoryPaths()
.Distinct(StringComparer.Ordinal)
.Select(dirPath => Path.Combine(dirPath, CliFileName))
.FirstOrDefault(File.Exists);
private static string GetDownloadUrl()
{
static string GetSystemMoniker()
{
if (OperatingSystem.IsWindows())
return "windows";
if (OperatingSystem.IsLinux())
return "linux";
if (OperatingSystem.IsMacOS())
return "osx";
throw new PlatformNotSupportedException("Unsupported operating system.");
}
static string GetArchitectureMoniker()
{
if (RuntimeInformation.ProcessArchitecture == Architecture.X64)
return "x64";
if (RuntimeInformation.ProcessArchitecture == Architecture.X86)
return "x86";
if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64)
return "arm64";
throw new PlatformNotSupportedException(
$"Unsupported architecture: {RuntimeInformation.ProcessArchitecture}."
);
}
View on GitHub (pinned to bbcff03951)
Solutions
- Install FFmpeg and make it resolvable via PATH (or place it in AppContext.BaseDirectory) so TryGetCliFilePath() returns a path and DownloadAsync is never called.
- Pass ffmpegPath explicitly to VideoDownloader.DownloadVideoAsync(...) to bypass auto-download (FFmpeg.cs:77 falls back to it).
- If you must support the platform, extend GetSystemMoniker() with the OS moniker and ensure a matching asset exists in the FFmpegBin release at Version (currently "8.1").
Example fix
// before: relies on auto-download, which throws on unsupported OS
await FFmpeg.DownloadAsync(outputPath, progress, ct);
// after: only auto-download on supported platforms, otherwise require a system binary
var ffmpeg = FFmpeg.TryGetCliFilePath();
if (ffmpeg is null)
{
if (!OperatingSystem.IsWindows() && !OperatingSystem.IsLinux() && !OperatingSystem.IsMacOS())
throw new InvalidOperationException("Install FFmpeg manually on this OS.");
await FFmpeg.DownloadAsync(outputPath, progress, ct);
ffmpeg = outputPath;
} Defensive patterns
Strategy: validation
Validate before calling
static bool IsFfmpegAutoDownloadSupported() =>
OperatingSystem.IsWindows() || OperatingSystem.IsLinux() || OperatingSystem.IsMacOS();
// before calling FFmpeg.DownloadAsync:
if (!IsFfmpegAutoDownloadSupported() && FFmpeg.TryGetCliFilePath() is null)
{
// instruct the user to install FFmpeg manually instead of auto-downloading
} Try / catch
try
{
await FFmpeg.DownloadAsync(outputPath, progress, ct);
}
catch (PlatformNotSupportedException ex) when (ex.Message == "Unsupported operating system.")
{
// prompt the user to install FFmpeg in PATH, or accept an explicit ffmpegPath
} Prevention
- Ship or require a system FFmpeg so TryGetCliFilePath() resolves before any auto-download.
- Gate the auto-download call behind an OS-capability check and surface a friendly message.
- Accept an explicit ffmpegPath from the user/config so the download path is optional.
When it happens
Trigger: Calling FFmpeg.DownloadAsync(...) on a runtime where OperatingSystem.IsWindows(), IsLinux(), and IsMacOS() all return false (e.g. FreeBSD, Solaris). It is only reached when no FFmpeg was found by TryGetCliFilePath() and the caller falls through to auto-download.
Common situations: Running under Wine/Proton or a translation layer that reports a non-standard OS; niche containers/distros; new .NET platforms added later. Note TryGetCliFilePath() probes AppContext.BaseDirectory, the current directory, and PATH (plus registry PATH on Windows), so a system FFmpeg avoids this path entirely.
Related errors
- Unsupported architecture: {RuntimeInformation.ProcessArchite
- Entry '{CliFileName}' not found in the downloaded archive.
AI-assisted analysis of Tyrrrz/YoutubeDownloader@bbcff03951 (2026-08-13).
Data as JSON: /api/errors/e0823269f8c42aad.
Report an issue: GitHub.