Search code examples
c#streamingpcmvlc.dotnet

VLC.Dotnet saving streaming


Dears, I was checking VLC.Dotnet lib (I am new to audio/video streaming)

static void Main(string[] args)
    {
        var currentDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
        // Default installation path of VideoLAN.LibVLC.Windows
        var libDirectory =
            new DirectoryInfo(Path.Combine(currentDirectory, "libvlc", IntPtr.Size == 4 ? "win-x86" : "win-x64"));

        var destination = Path.Combine(currentDirectory, "record.ts");

        using (var mediaPlayer = new Vlc.DotNet.Core.VlcMediaPlayer(libDirectory))
        {

            var mediaOptions = new[]
            {
                ":sout=#file{dst=" + destination + "}",
                ":sout-keep"
            };

            mediaPlayer.SetMedia(new Uri("http://hls1.addictradio.net/addictrock_aac_hls/playlist.m3u8"),
                mediaOptions);

            mediaPlayer.Play();

            Console.WriteLine($"Recording in {destination}");
            Console.WriteLine("Press any key to exit");
            Console.ReadKey();
        }
    }

I cannot find documentation on the possible mediaOption values. I want to understand if it is possible to change sampling rate while downloading or even the file format (PCM possibly). Any link that can help? Thanks


Solution

  • Vlc.DotNet is dead, use LibVLCSharp instead.

    As for the options documentation, please find the documentation here : https://docs.videolan.me/vlc-user/3.0/en/advanced/index.html