-
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
Add variable of display resolution to the VapourSynth filter #11510
Comments
Yes, actually this should be pretty trivial. |
Weirdly enough, the display fps is somehow available super early but the display resolution is not. To work around this, we try to call get_display_res continuously in vf_vapoursynth_process until we get something. By no means perfect and has lots of obvious pitfalls where it won't work (still images, changing monitors, etc.), but for general usage it's probably good enough and display_fps has similar limitations anyway. As an aside, the vapoursynth API this uses apparently requires R26 (an ancient version anyway), so bump the build to compensate for this. Fixes mpv-player#11510
@CrendKing: I added a commit that in theory should do this in #12132. I know nothing about actually using vapoursynth though. Can you verify if it works? I had to move the display res logic to a different place. |
Weirdly enough, the display fps is somehow available super early but the display resolution is not. To work around this, we try to call get_display_res continuously in vf_vapoursynth_process until we get something. By no means perfect and has lots of obvious pitfalls where it won't work (still images, changing monitors, etc.), but for general usage it's probably good enough and display_fps has similar limitations anyway. As an aside, the vapoursynth API this uses apparently requires R26 (an ancient version anyway), so bump the build to compensate for this. Fixes mpv-player#11510
Weirdly enough, the display fps is somehow available super early but the display resolution is not. To work around this, we try to call get_display_res continuously in vf_vapoursynth_process until we get something. By no means perfect and has lots of obvious pitfalls where it won't work (still images, changing monitors, etc.), but for general usage it's probably good enough and display_fps has similar limitations anyway. As an aside, the vapoursynth API this uses apparently requires R26 (an ancient version anyway), so bump the build to compensate for this. Fixes mpv-player#11510
Weirdly enough, the display fps is somehow available super early but the display resolution is not. To work around this, we try to call get_display_res continuously in vf_vapoursynth_process until we get something. By no means perfect and has lots of obvious pitfalls where it won't work (still images, changing monitors, etc.), but for general usage it's probably good enough and display_fps has similar limitations anyway. As an aside, the vapoursynth API this uses apparently requires R26 (an ancient version anyway), so bump the build to compensate for this. Fixes mpv-player#11510
Weirdly enough, the display fps is somehow available super early but the display resolution is not. To work around this, we try to call get_display_res continuously in vf_vapoursynth_process until we get something. By no means perfect and has lots of obvious pitfalls where it won't work (still images, changing monitors, etc.), but for general usage it's probably good enough and display_fps has similar limitations anyway. As an aside, the vapoursynth API this uses apparently requires R26 (an ancient version anyway), so bump the build to compensate for this. Fixes mpv-player#11510
Weirdly enough, the display fps is somehow available super early but the display resolution is not. To work around this, we try to call get_display_res continuously in vf_vapoursynth_process until we get something. By no means perfect and has lots of obvious pitfalls where it won't work (still images, changing monitors, etc.), but for general usage it's probably good enough and display_fps has similar limitations anyway. As an aside, the vapoursynth API this uses apparently requires R26 (an ancient version anyway), so bump the build to compensate for this. Fixes mpv-player#11510
I'm sorry I tried hard to make a build that works with VapourSynth, but unable to do so. The build under MSYS just unable to initialize VSScript for some reason. And shinchiro's script just don't work for me. Maybe you commit that, and I'll check shinchiro's daily build ASAP? If anything is wrong, you can still revert. Alternatively, if you have a Windows environment, I can tell you steps to test this in VapourSynth yourself. |
Do you have like a nice minimal example script I could try out that would process frame by frame? The variables are |
|
Hmm okay, I understand a little better now. So there aren't any runtime changes; what you get during initialization is all that is there. Quite unfortunately, X11 and Wayland don't get the information from the backend fast enough. The vapoursynth filter initializes before the windowing/display server gives us information (for the record, display_fps doesn't work on wayland either) so this is always just 0. However, peaking at the windows code it appears to get the default monitor back which is better than nothing so it shouldn't be totally useless. Anyways, this will let me simplify that commit. Thanks. |
mpv has a generic method for getting the display resolution, so we can save it in vf_vapoursynth without too much trouble. Unfortunately, the resolution won't actually be available in many cases (like my own) because the windowing backend doesn't actually know it yet. It looks like at least windows always returns the default monitor (maybe we should do something similar for x11 and wayland), so there's at least some value. Of course, this still has a bunch of pitfalls like not being able to cope with multi monitor setups at all but so does display_fps. As an aside, the vapoursynth API this uses apparently requires R26 (an ancient version anyway), so bump the build to compensate for this. Fixes mpv-player#11510
So like you said, this always returns the resolution of the "default" (first) monitor, even if mpv is for example started with |
Yes, I'm thinking having some kind of fallback for these properties is useful when we're in the pre-initialization phase, I just pushed a commit for X11/Wayland on that PR.
On a second look, it appears that this is exactly how it should work on Windows. |
mpv has a generic method for getting the display resolution, so we can save it in vf_vapoursynth without too much trouble. Unfortunately, the resolution won't actually be available in many cases (like my own) because the windowing backend doesn't actually know it yet. It looks like at least windows always returns the default monitor (maybe we should do something similar for x11 and wayland), so there's at least some value. Of course, this still has a bunch of pitfalls like not being able to cope with multi monitor setups at all but so does display_fps. As an aside, the vapoursynth API this uses apparently requires R26 (an ancient version anyway), so bump the build to compensate for this. Fixes mpv-player#11510
mpv has a generic method for getting the display resolution, so we can save it in vf_vapoursynth without too much trouble. Unfortunately, the resolution won't actually be available in many cases (like my own) because the windowing backend doesn't actually know it yet. It looks like at least windows always returns the default monitor (maybe we should do something similar for x11 and wayland), so there's at least some value. Of course, this still has a bunch of pitfalls like not being able to cope with multi monitor setups at all but so does display_fps. As an aside, the vapoursynth API this uses apparently requires R26 (an ancient version anyway), so bump the build to compensate for this. Fixes mpv-player#11510
mpv has a generic method for getting the display resolution, so we can save it in vf_vapoursynth without too much trouble. Unfortunately, the resolution won't actually be available in many cases (like my own) because the windowing backend doesn't actually know it yet. It looks like at least windows always returns the default monitor (maybe we should do something similar for x11 and wayland), so there's at least some value. Of course, this still has a bunch of pitfalls like not being able to cope with multi monitor setups at all but so does display_fps. As an aside, the vapoursynth API this uses apparently requires R26 (an ancient version anyway), so bump the build to compensate for this. Fixes mpv-player#11510
I merged it now. Should hopefully return actually meaningful values on windows. |
@Dudemanguy, I got the nightly build to test this now. It works perfectly if the initial display is the main one (i.e.
When I start mpv with
I get 2560x2520, where 2520 = 1080 + 1440. The reason is that in Also, what about the implementation of the same API on other systems? For example, drm probably got it right, but wayland seems to be wrong: it's the coordinate of the bottom right corner, not width and height. Maybe the whole thing warrants a separate issue and PR? |
If you check the Wayland is right. I tested that myself. There's no global rectangular layout exposed to clients in wayland. You just get the width/height for every output, so it is indeed x1 and y1. |
The Sorry about misunderstanding Wayland. I didn't know that. I also glanced at common.swift and x11_common.c and both seem correct. Hopefully w32 is the only one incorrect. Do you want me to make an issue to track this? |
Wayland is different from literally everything else for better or worse, so not surprising that someone would misunderstand. And yeah that's a legitimate bug then and worth an issue. |
…ry data to script. Currently the vapoursynth video filter does not accept any argument for passing arbitrary user data. This limits what the VS script can do. Ideally, the vapoursynth filter has an user-data parameter that contains string value. mpv passes that value to the VS script just like container_fps and others. Once the VS script gets the data, it can do all sorts of data extraction and transformation. Another benefit is that instead of mpv always have to [catch up to user needs for this filter](mpv-player#11510), with this users can just pass whatever needed themselves, thus becomes more future-proof. Fixes mpv-player#14214
Expected behavior of the wanted feature
In mpv, the VapourSynth filter has
display_fps
. Often I come across use cases where I would like to resize the video up or down to the display size in VapourSynth and further process the scaled video before sending it back to mpv. Currently there is no way to get the information.It looks like mpv is calling this
get_display_fps()
to get the display FPS, which internally callsvo_control(p->vo, VOCTRL_GET_DISPLAY_FPS, &res)
. It seems there is already aVOCTRL_GET_DISPLAY_RES
. Maybe this is easy to implement?Alternative behavior of the wanted feature
Currently I have to hard code a resolution in the script, which only works for me. This makes it difficult to share the script without telling everyone to change those numbers.
Log file
I'll provide log if needed.
The text was updated successfully, but these errors were encountered: