mpc-hc
mpc-hc copied to clipboard
playlist and subsync window offset video out of screen
I downloaded a youtube video with mpc-hc via yt-dlp and ffmpeg also included in installation folder. Youtube parameters were default state.
mpc-hc version 1.9.21.2 within k-lite codec
video extension is `.webm`
Video properties:
Video: VP90 1920x1080 60fps [V: English [eng] (vp9 profile 0, yuv420p, 1920x1080) [default]]
Audio: 0x704f 48000Hz stereo 3072kbps [A: English [eng] (opus, 48000 Hz, stereo) [default]]
60fps test video youtube url: https://www.youtube.com/watch?v=05UTU-UErl0 30fps Test file in zip: Pilot - 'Taksi yolunda bir İGUANA VAR!'.zip 30fps Youtube test file url: https://www.youtube.com/watch?v=dF4s5V4hdXQ
When you snap playlist or subresync
to top corner or left corner it causes to offset video amount pixel of playlist size (width or height according to snap position). I have tested with MPC video renderer and EVR-CP. These two are different behavior but have similar effect.
- EVR-CP offset behavior is persistent and affects (probably) all videos:
https://user-images.githubusercontent.com/3073922/163899663-71b56691-446f-45a0-b71d-6ef1ec4e9398.mp4
- mpc-vr offset behavior is not barely visible, just sometimes flick (especially visible on high fps videos):
https://user-images.githubusercontent.com/3073922/163901618-0b508c13-6b0f-4ce6-aeaa-ae33728e3695.mp4
Besides video renderer there might be possible bug about fullscreen playlist:
https://user-images.githubusercontent.com/3073922/163903914-49888e34-4a5f-4ee2-a28e-c55a3a37f4cc.mp4
- With right click to playlist, it makes playlist disappear (probably does not detect cursor at that time)
- Hide on Fullscreen button does not work as expected (it works when you click while windowed mode or exit from fullscreen and go fullscreen again to it works.)
The first issue here is caused by:
videoRect.OffsetRect(-m_windowRect.TopLeft());
in CSubPicAllocatorPresenterImpl::SetPosition()
Removing this seems to work ok, at least for EVR-CP. I'm sure it exists for a good reason, though...
Problem seems to be that WindowRect changes depending on if playlist is visible. Left top goes from 0,0 to 0,-171 here. Showing playlist in top of window in fullscreen pushes subtitles down as a result of that as well.
In CMainFrame::MoveVideoWindow
the WindowRect is adjusted when toolbars/panels are (temporarily) on top of video. But that seems wrong to me since we do not change video size. Maybe it is related to handling mouse clicks to go to correct target? Or maybe in past it did move/resize video.
Problem seems to be that WindowRect changes depending on if playlist is visible. Left top goes from 0,0 to 0,-171 here. Showing playlist in top of window in fullscreen pushes subtitles down as a result of that as well.
That is right. It seems like if the window is (0,0)-(500,500)
, and the toolbar is 100px high, then the window will instead be (0,0)-(500,400)
. bPanelsOnVideo
is true when we are in full screen, so the code then says, "the real window to render to is 500px high, so start rendering at (0,-100)
."
Then CSubPicAllocatorPresenterImpl::SetPosition
says, "because our window doesn't start at (0,0), let's put the video rendering at (0,100)
--that way, any strange offset in the window will be corrected for by the video window."
The end result is that the attempt to grow the rendering window is partially undone by the video rect. Although the size of the window stays expanded, the offset is shifted down.
the WindowRect is adjusted when toolbars/panels are (temporarily) on top of video.
With the toolbar present (even temporarily), the GetClientRect is smaller. On my 3840x2160 monitor, it returns {LT(0, 0) RB(3840, 1962) [3840 x 1962]}
.
https://github.com/clsid2/mpc-hc/commit/c3b04477ba6cf56dfc335eaefc2a59aa917ee4b9
Here's the commit that introduced it.
Tested 1.7.9, and the behavior seems perfectly fine. I'm not sure what necessitated that commit. As of 1.7.10, videos are regularly cut off on the bottom when the toolbar is showing (whether in autohide or not).
So whatever the goal of this was, I have to think it wasn't connected to the movevideowindow logic.
If I comment out the code that moves the windowrect, then video gets moved into the available area when toolbar is shown. I guess that behavior was unwanted.
The commit you linked to is likely related to subtitles. Not sure what its purpose is.
I guess that behavior was unwanted.
Yes, maybe so. Although the result is that it cuts off the bottom instead of the top. If it doesn't want to cover video with the toolbar, then instead it should use a smaller window, and scale accordingly.
The two pieces of code fight each other--one is trying to move the video under the toolbar, and the other is trying to move it back.
videoRect.OffsetRect(-m_windowRect.TopLeft());
I don't see any direct issues with this removed. But could use some more testing.
I did notice (unrelated to this problem) that stetching window with P&S can give messed up subtitles with libass once they go beyond window border. Without libass the subs do not stretch.
videoRect.OffsetRect(-m_windowRect.TopLeft());
I don't see any direct issues with this removed. But could use some more testing.
Yeah it seems to work correctly. Reviewing commit history, it's adjacent to a commit to use IMadVRCommand to control some video positioning.
MADVR and EVR-CP, after these patches, did not have the same behavior in MPC-HC. EVR-CP would be pushed down, but MADVR would remain covered. Perhaps in an attempt to get parity with MADVR positioning, a mistake was made...or maybe it was purposeful, but as I said before, it still cuts off the video this way, just at the bottom instead of the top.
I have reverted that commit
With right click to playlist, it makes playlist disappear (probably does not detect cursor at that time)
Hide on Fullscreen button does not work as expected (it works when you click while windowed mode or exit from fullscreen and go fullscreen again to it works.)
- Edit: Fixed by https://github.com/clsid2/mpc-hc/commit/238b1ac984a4cd2f41f1492002dccaee96f3e416
- Confirm.
Is the first one fixed by https://github.com/clsid2/mpc-hc/commit/238b1ac984a4cd2f41f1492002dccaee96f3e416
My goal was to make the right click work correctly on hover.
https://github.com/clsid2/mpc-hc/pull/2784
Should fix second issue.