Lowest Possible Streaming Latency with libVLC?
Posted: 21 May 2019 16:06
Hi -
Our project requires the lowest possible latency when streaming rtsp (udp) into the LibVLCSharp.WPF.VideoView control. We've smashed all the latency we can on the encoder/server/LAN.
* What, definitively, are the *best* settings to use to minimize latency (we can tolerate stuttering, pauses, etc. It is latency that we must minimize).
* Where can I find or enumerate a list of available settings? I have logged the results of 'vlc.exe --help' but already I am using settings not listed in that output.
Right now our best performance is ~550ms of total latency, of which we attribute 60-90ms to the encoder/server/LAN, meaning that ~460ms is due to the VideoView (VLC) control. Our total allowable latency spec is 250ms.
So far, our initialization is like this:
But how do we know if these settings are sufficent and optimal?
Is there any statistics that are accessible through the library to evaluate performance?
Some websites claim that 60ms latency should be achievable. Others claim that the settings above have brought their latency from 2s down to 200ms. I realize some of this can be affected by the encoding parameters, so I'd like to know what a best practice for that (h.264 encoding) is as well?
Basically, there is a whole lot of 'anecdotal' information on the web about low/zero latency streaming, but very little that I can take confidence in as being the best for my scenario.
Any thoughts, help, guidance, and/or advice would be appreciated.
Our project requires the lowest possible latency when streaming rtsp (udp) into the LibVLCSharp.WPF.VideoView control. We've smashed all the latency we can on the encoder/server/LAN.
* What, definitively, are the *best* settings to use to minimize latency (we can tolerate stuttering, pauses, etc. It is latency that we must minimize).
* Where can I find or enumerate a list of available settings? I have logged the results of 'vlc.exe --help' but already I am using settings not listed in that output.
Right now our best performance is ~550ms of total latency, of which we attribute 60-90ms to the encoder/server/LAN, meaning that ~460ms is due to the VideoView (VLC) control. Our total allowable latency spec is 250ms.
So far, our initialization is like this:
Code: Select all
_libVLC = new LibVLC("--file-caching=2000", "-vvv");
_mediaPlayer = new MediaPlayer(_libVLC);
videoView.MediaPlayer = _mediaPlayer;
if (CommandLineArgs.Args.Length > 0)
{
Media m = new Media(_libVLC, CommandLineArgs.Args[0], FromType.FromLocation);
m.AddOption(":network-caching=150");
m.AddOption(":clock-jitter=0");
m.AddOption(":clock-syncro=0");
_mediaPlayer.Play(m);
}
Is there any statistics that are accessible through the library to evaluate performance?
Some websites claim that 60ms latency should be achievable. Others claim that the settings above have brought their latency from 2s down to 200ms. I realize some of this can be affected by the encoding parameters, so I'd like to know what a best practice for that (h.264 encoding) is as well?
Basically, there is a whole lot of 'anecdotal' information on the web about low/zero latency streaming, but very little that I can take confidence in as being the best for my scenario.
Any thoughts, help, guidance, and/or advice would be appreciated.