m3u-stream-merger-proxy icon indicating copy to clipboard operation
m3u-stream-merger-proxy copied to clipboard

Follow ffmpeg's buffer behavior to reduce playback issues on slow connections

Open sonroyaalmerol opened this issue 5 months ago • 9 comments

Is your feature request related to a problem? Please describe.

When streaming live video, playback issues occur due to buffering delays and inconsistent chunk delivery from the provider's server, especially on slow connections. The proxy currently serves chunks to the client immediately after they are inserted into the buffer and the client requests arrive. This doesn't mitigate issues caused by slow or inconsistent chunk delivery, as the player may still run out of chunks, leading to playback stalls or repeated content.

Describe the solution you'd like

I'd like the proxy to implement a more robust buffering system similar to how ffmpeg handles streams. Instead of serving chunks immediately on client request, the proxy should accumulate data in the buffer until a sufficient amount is available before starting playback. This would help smooth out inconsistencies in chunk delivery, ensuring that the player has a steady stream of data even when the server is slow or delivering chunks inconsistently.

Additional context

At the moment, the proxy doesn’t hold data in the buffer for long, which makes it vulnerable to playback issues when chunk delivery is slow or erratic. By improving the buffer system to hold onto more data before serving, the proxy can better handle server-side delays without affecting the client’s playback experience. However, it’s important to note that while this can improve playback stability, it may not fully resolve streaming issues on extremely slow connections.

sonroyaalmerol avatar Sep 22 '24 20:09 sonroyaalmerol