-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mpv freezes when taking screenshots (screenshot command is not asynchronous) #4250
Comments
That’s possible by adding a |
I tried running PngOptimizer but I have no idea how to pass the screenshot's name to it as a parameter, how to use screenshot wildcards as parameters? |
Scripts and other use-cases might rely on screenshots being fully written once the command completes (even lachs0r's suggestion just now assumes that). So it can't be async by default, which means it essentially freezes up. So we'd explicitly need an async variant of the command, which would be a mess. |
How about take a raw bitmap screenshot and then pass it to another thread for compression, then? |
That's not really the problem. The problem is the user-interface. If the screenshot command returns before the file is fully written, tons of user scripts etc. could break. |
So the only option is to set PNG compression to 0 and use some other tool to watch for new files in mpv's screenshots folder? That sounds rather inconvenient. |
There's also screenshot-to-file and screenshot-raw. The latter would allow you to implement async screenshots - if you managed to write the data to disk using a Lua script of a cplugin. |
If I may ask: what are you even trying to do? |
I take screenshots. When I take screenshots, the video hangs, unless I disable PNG compression, in which case I would have to compress it later using some other tools. I tried to make mpv run PngOptimizer on a freshly created screenshot but I have no idea how to pass the resulting screenshot's filename to it. |
Just a few random screenshots? And what is the problem with compressing them later? It seems to me like you're trying to automate something, but I don't see the point here. |
I'll probably implement an async mode. But first I got distracted and then bored, so not today. |
Perhaps related (or should this be made a separate issue?): |
Adding the |
My program takes screenshots on a regular basis, using the libmpv API function mpv_command(ctx, "screenshot-to-file", "mydir/myfile.png"). Not when the user presses a key. So there's no key binding involved. How can my program get a correctly rotated screenshot? |
watch.sh can, among other things, run |
mpv version and platform
mpv 0.24.0-git-0f1afc6ba, Windows 7 build 7601, SP1
Reproduction steps
Add these lines to mpv.conf:
screenshot-format=png
screenshot-png-compression=9
Open any video file (the higher resolution the better) and take a screenshot with hotkey (default: s)
Expected behavior
I'd like mpv to pass the screenshot to another process for compression to not interfere with playback.
Actual behavior
mpv freezes for a few seconds to compress the screenshot, disrupting playback.
Also, is it possible to create a screenshot with 0 compression and then run some other PNG compression tool on the screenshot?
The text was updated successfully, but these errors were encountered: