When I open the Preferences of VLC and go to Input & Codecs, I have a setting called Default Caching Level. I can choose between

  • Cusom
  • Lowest latency
  • Low latency
  • Normal
  • High latency
  • Higher latency

I'm used to caching being set in seconds or something like that. So, more seconds/higher buffer means less chance of buffer underrun while streaming. What is latency? What does it mean to set it lower or higher? In what cases should I go in what direction? If I'm struggling with buffer underruns, should I set it to lower or higher latency?


Solution 1:

Latency is an extremely complicated subject and there's an article about it on the all-knowing wiki

To put it simply, it is the time which passes from the moment a packet is sent to the moment you receive it. So if you set the caching to high latency, it will cache more data before it starts playing. So if you're having buffer underruns, you need to set it to high latency.

Another interesting point is that packets do not arrive in the same order they are sent. So it can happen that if you're playing sound file at say location 5s, you can get packets from location 5.1s before those form 5s. Player will need to compensate for that using cache, so packets form later time period will have to wait.