This article will show you how to download only sound of a youtube video in C#.Net
To play demo, you should install MediaToolKit and VideoLibrary from Manage Nuget Packages. This library allows you to convert a youtube video to mp3 file
var source = @"your destination folder";
var youtube = YouTube.Default;
var vid = youtube.GetVideo("your url video");
File.WriteAllBytes(source + vid.FullName, vid.GetBytes());
var input = new MediaFile { Filename = source + vid.FullName };
var output = new MediaFile { Filename = $"{source + vid.FullName}.mp3" };
using (var engine = new Engine())
{
engine.GetMetadata(inputFile);
engine.Convert(input, output);
}
I hope this article resolves your issue. Thank you !