Canonical low-latency settings for VLC for Android (3.0+)

VLC for Android and Chrome OS specific usage questions
sjoshi
New Cone
New Cone
Posts: 1
Joined: 21 Jun 2019 22:54

Canonical low-latency settings for VLC for Android (3.0+)

Postby sjoshi » 21 Jun 2019 23:20

Hi all, first post for me, so I hope I'm not overstepping here.

I've recently started using libVLC in an Android application with the intent of replacing a commercial SDK that we're paying a lot for, but not seeing the results that we'd hoped for. The application requires viewing RTSP streams at as-close-to real-time as possible. 500ms or better ideally (depending on the tablet), without that latency drifting over time.

The process of switching out the commercial SDK for libVLC was almost seamless and it worked right away, with the exception of the latency being a few seconds (without touching any default settings). It connects to the RTSP streams really fast, and doesn't drop connections - so, kudos on that!

I've spent a couple of days tweaking the various settings to try to reduce the latency as much as possible. In some cases, I get 300ms latency, that eventually drifts to a few seconds of latency, before the stream drops and restarts (and the latency dance begins again). In other cases (I guess when I set the network cache too low), I get a log full of errors and never get a picture.

Anyways, I've found dozens of potential answers spanning a decade, some are similar, some conflicting, and some using deprecated flags. Some notable ones:

2018: [url]https://stackoverflow.com/questions/51773268/android-libvlc-options-do-not-work[/url]

Code: Select all

options.add("--network-caching=50"); options.add("--clock-jitter=0"); options.add("--clock-synchro=0");

2017: [url]https://stackoverflow.com/questions/41849541/reduce-delay-when-playing-rtp-stream-with-libvlc-on-android[/url]

Code: Select all

LibVLC libVlc = new LibVLC(context, arrayListOf("--file-caching=150", "--network-caching=150", "--clock-jitter=0", "--live-caching=150", "--clock-synchro=0", "-vvv", "--drop-late-frames", "--skip-frames")); ...OR... media.setHWDecoderEnabled(true, false); media.addOption(":network-caching=150"); media.addOption(":clock-jitter=0"); media.addOption(":clock-synchro=0");
2015: [url]https://forum.videolan.org/viewtopic.php?f=35&t=124932&p=420020&hilit=latency#p420020[/url]
Set network cache to 500, and disable HW acceleration

2015: [url]https://stackoverflow.com/questions/30901818/decrease-delay-during-streaming-and-live-streaming-methods[/url]

Code: Select all

mLibvlc.setDevHardwareDecoder(LibVLC.DEV_HW_DECODER_AUTOMATIC); mLibvlc.setHardwareAcceleration(LibVLC.HW_ACCELERATION_DISABLED); mLibvlc.setNetworkCaching(150); mLibvlc.setFrameSkip(true);

2013: [url]https://stackoverflow.com/questions/16369745/stream-desktop-over-rtp-using-vlc-with-the-lowest-latency-possible[/url]
Related to Desktop VLC and tweaking FFMPEG

And of course, we have the immense VLC flags list here: [url]https://wiki.videolan.org/VLC_commaand-line_help/[/url]

So, in conclusion, is there a canonical method for libVLC 3+ on Android that we should collectively use for real-time streaming applications?

In my case, zero caching and dropping late frames, in order to stay as close as possible to real-time is ideal (even with janky frames). But, I do also understand that for most people, stable streaming (with occasional, sporadic frame drops) would be preferred.

Thanks!
-SJ

Return to “VLC for Android and Chrome OS”

Who is online

Users browsing this forum: Betonhaus and 7 guests