I'm having issue's with my RTSP streams in my application when the network setup is running over a PtP(point to point) network.
Some streams have no issue other do. And the only difference I'm seeing is the latency is higher between the two. In one case its around 5ms when I ping the camera on the other its 40+ ms.
The only thing I can assume is that it's related to the latency being higher Though I'm not seeing what option would possible solve this.
public void ShowCamera()
{
string options = string.Empty;
if (string.IsNullOrWhiteSpace(room.resolution) || room.resolution == "<unset>")
{
options = "?compression=30&fps=30&videocodec=h265";
}
else
{
var res = Regex.Replace(room.resolution, @"\(.*\)", "").Trim();
options = $"?resolution={res}&compression=30&fps=30&videocodec=h265";
}
outside_media = new Media(libvlc, "rtsp://root:root@" + room.outsideCamera + "/axis-media/media.amp"+options, FromType.FromLocation);
outside_media.AddOption(":no-sout-rtp-sap" +
":no-sout-standard-sap" +
":sout-all" +
":sout-keep" +
":network-caching=150" +
":--file-caching=2000" +
"rtsp-caching=200");
inside_media = new Media(libvlc, "rtsp://root:root@" + room.insideCamera + "/axis-media/media.amp"+options, FromType.FromLocation);
inside_media.AddOption(":no-sout-rtp-sap" +
":no-sout-standard-sap" +
":sout-all" +
":sout-keep" +
":network-caching=150" +
":--file-caching=2000" +
"rtsp-caching=200");
When I look back at the code for an older application in Java they were using even less options. Yet this problem didn't occur.
mediaPlayer.playMedia("rtsp://root:root@"
+ cameraIp + "/axis-media/media.amp" + options, ":no-sout-rtp-sap",
":no-sout-standard-sap",
":sout-all",
":sout-keep",
"rtsp-caching=200");
Add the network caching and file caching options Changed codec to h265 instead of h264
High latency in vlc 3 is a known issue. I don't have the full background, but I think the latency was better before vlc 3.
See for example : https://code.videolan.org/videolan/vlc-unity/-/issues/100 and https://code.videolan.org/videolan/vlc/-/issues/21859
As you can see there, with libvlc 4, still in prerelease, there is a new --low-delay
option that you might want to try. Libvlc 4 API is still expected to break though.