mpv
mpv copied to clipboard
First screenshot to a networked folder with a lot of screenshots takes very long
Important Information
Provide following Information:
- mpv version: v0.37.0-268-ga45518cf
- Windows Version: 10 Pro 22H2
- Source of the mpv binary: updater
- If known which version of mpv introduced the problem: unknown
- GPU model, driver and version: GTX 1080 (31.0.15.3742)
Reproduction steps
- Prepare a networked drive with a screenshots directory.
- Ensure it has the first 2000 or so valid screenshot names.
- Open mpv with a video file.
- Take a screenshot.
Expected behavior
The screenshot is nearly instantaneous.
Actual behavior
The application locks up for almost 30 seconds (buffering any additional inputs) while taking the first screenshot. Every subsequent one is nearly instantaneous, as expected.
Log file
This is the log file for a remote location: screenshots.log
This is one for the same folder, copied locally: screenshots-local.log
It's tagged as os:win but there's no guarantee it's a Windows-exclusive issue; it's just the only platform I have set up that experiences it.
This happens because mpv tries to first save mpv-shot0001.jpg
, finds that the file already exists, then tries mpv-shot0002.jpg
and so on until it reaches a filename that doesn't already exist. The problem is that the networked drive is slow enough that this process repeated 2000+ times takes 30 seconds. I wonder if there's optimizations left on the table for this.
A simple fix would be to include the current filename or timestamp to the screenshot-template
.
A quick check in powershell says I can get the directory contents in about 300ms; since the player caches the last number used anyway (because subsequent screenshots are nigh-instant as expected), why not try that to get a good starting point?