0

I use VLCLibSharp in my WPF application. I want that my stream that I get from h264 data is streamed directly into my vlc wpf mediaplayer element. How to do that?

_streamReceiver.OnH264DataReceived += (s, e) =>
        {
            // DO SOMETHING WITH VIDEO DATA... -> IS WORKING PERFECTLY
            using (FileStream _writer = new FileStream("C://Users/MyUsername/Desktop/dump/dump.h264", FileMode.Append))
            {
                _writer.Write(e.Data, 0, e.Length);
            }

            // STREAM INTO VLC MEDIAPLAYER - NOT WORKING - IMAGE IS BLURRY AND FREEZED FOREVER
            using (var mediaPlayer = new LibVLCSharp.Shared.MediaPlayer(MainWindow._libVLC))
            {
                var media = new Media(MainWindow._libVLC, new StreamMediaInput(new MemoryStream(e.Data, 0, e.Length)));
                media.AddOption(":screen-fps=24");
                media.AddOption(":demux=h264");
                media.AddOption(":sout-keep");

                MainWindow._mediaPlayer.Play(media);
            }

The Code you see is working just fine, but the stream is blurry and freezed (Look this image) I think that something with MemoryStream is wrong

texi
  • 3
  • 4

0 Answers0