1

I already tried FileCaching = 0, NetworkCaching = 0, but the playback delay still appears to be very high (several seconds). I am using the Avalonia view from LibVLCSharp.Avalonia NuGet package, but that should not matter.

Here's how the code looks like:

var mediaPlayer = new MediaPlayer(this.vlc) {
    FileCaching = 0,
    NetworkCaching = 0,
    EnableHardwareDecoding = true,
};

var input = new StreamMediaInput(new VideoStream(source));
using var media = new Media(this.vlc, input);
media.AddOption(":demux=h264");
mediaPlayer.Play(media);

P.S. After some research, I found, that h264 demuxer does not really know the video FPS, so the reason for delay might be that VLC is only showing frames at 24-30 per second. I tried adding media.AddOption(":h264-fps=60") to indicate real video FPS, but the issue did not disappear. This parameter appears to be ignored (wrong format? broken?).

P.P.S. Sadly LibVLCSharp does not complain about unrecognized options.

LOST
  • 2,956
  • 3
  • 25
  • 40

1 Answers1

0

In my experience, VLC has an added latency that you can't get below a certain point. See : https://code.videolan.org/videolan/vlc/-/issues/21859

As per your "PPS", Libvlcsharp can't detect whether an option is valid or not, it's all handled by the core.

cube45
  • 3,429
  • 2
  • 24
  • 35
  • After observing it for a while, the FPS is indeed the problem. E.g. the video is almost exactly 2x slower than the source. So the question is, probably, what is the correct way to tell it to decode at certain frame rate. – LOST Mar 21 '23 at 18:06