Closed ghost closed 8 years ago
I can't reproduce this, so I'll need more information to debug:
Are there any error messages in the mpv log? After clicking top-left, there should be a clear region in the grey square indicating the region to crop to, so it's possible some intermediate error is causing this issue.
Does this issue occur with all video files? Are you using mpv directly, or are you using a wrapper GUI?
using MPV, no wrapper. log: https://i.imgur.com/dPgSZbK.png
I don't see any clear box. still crops to wrong area.
happens with MP4, not webm
The crop filter is being added with the correct region (the Opening video filter: [crop ...]
lines). The problem appears to be the image format d3d11_nv12
and the use of hardware decoding (the d3d11va
line). mpv automatically moves the crop origin to 0/0 if the image format has hardware decoding (yellow log lines). So the cropped region has the correct width and height, it's just been moved over into the top-left corner.
Could you confirm whether hardware decoding is in use for a video where cropping works properly?
log of video where the crop works: (webm format) https://i.imgur.com/eAd2ote.png
Yeah, that seems to be the problem then; here you're using software decoding (image format yuv420p
), and the crop origin is only adjusted to the nearest even number. I'm not sure if there's any other way to fix this, apart from disabling hardware decoding :/
It may be possible to toggle hardware/software decoding as cropping is enabled/disabled. That'd at least be better than cropping to the wrong region or permanently disabling hwdec, even if it's less than ideal.
setting "hwdec=no", makes the crop work on the first (MP4) video where it wouldn't work previously. https://i.imgur.com/8faiIFd.png
but this is not a great solution, as it means I'd have to permanently disable hardware decoding
there should be a reason why the region gets reset on hardware decoding
It's possible/likely that the hardware is designed to decode entire pictures at a time, and that the driver APIs are limited in turn. Decoding a region of a video picture often needs pixel information from outside that region. I'm surprised that this isn't emulated at a software level, however, since it'd be trivial to do in a shader.
same issue using this script for auto cropping off black bars: https://github.com/mpv-player/mpv/blob/master/TOOLS/lua/autocrop.lua
that one also doesn't work with hardware decoding https://i.imgur.com/ZITztqK.png
I've added a check at 4a5d8a1 for whether hwdec without copy-back is in use, currently with a whitelist (ugh)---if cropping can't work, it'll notify with an OSD message.
I press "c" click top left click bottom right and I get a totally different region of the video cropped to (top left of the video)
bug in action: https://my.mixtape.moe/vmqkzy.webm