From ac3939ef61d8ca5a5b984ab8d60eca859daf91a7 Mon Sep 17 00:00:00 2001 From: pax Date: Sat, 11 Apr 2026 19:51:56 -0500 Subject: [PATCH] mpv: fix video stutter on network streams MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cache_pause=no caused frame-wait-frame-wait on uncached videos because mpv kept playing through buffer underruns instead of pausing to refill. Flip to cache_pause=yes with a 2s resume threshold so playback is smooth after the initial buffer fill. Also: bump demuxer buffers (50→150MiB forward, add 75MiB back for backward seek without refetch), increase stream_buffer_size from default 128KiB to 4MiB to reduce syscall overhead, extend network timeout (10→30s) for slow CDNs, and set a browser-like user agent to avoid 403s from boorus that block mpv's default UA. behavior change --- booru_viewer/gui/media/_mpv_options.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/booru_viewer/gui/media/_mpv_options.py b/booru_viewer/gui/media/_mpv_options.py index 65a1a23..4834f73 100644 --- a/booru_viewer/gui/media/_mpv_options.py +++ b/booru_viewer/gui/media/_mpv_options.py @@ -77,10 +77,16 @@ def build_mpv_kwargs(is_windows: bool) -> dict[str, object]: "vd_lavc_fast": "yes", "vd_lavc_skiploopfilter": "nonkey", "cache": "yes", - "cache_pause": "no", - "demuxer_max_bytes": "50MiB", + "cache_pause": "yes", + "cache_pause_wait": "2", + "cache_pause_initial": "yes", + "cache_secs": "30", + "demuxer_max_bytes": "150MiB", + "demuxer_max_back_bytes": "75MiB", "demuxer_readahead_secs": "20", - "network_timeout": "10", + "stream_buffer_size": "4MiB", + "network_timeout": "30", + "user_agent": "Mozilla/5.0", "ytdl": "no", "load_scripts": "no", }