occivink / mpv-scripts

Various scripts for mpv
The Unlicense
420 stars 38 forks source link

Crop filter doesn't work with certain resolutions #27

Closed AeliusSaionji closed 5 years ago

AeliusSaionji commented 5 years ago

For certain resolutions (3000x2000 is one example) I get this error when trying to use crop:

[ffmpeg] Impossible to convert between the formats supported by the filter 'mpv_src_default_in' and the filter 'auto_scaler_0'
[lavfi] failed to configure the filter graph
Disabling filter crop.00 because it has failed.
AeliusSaionji commented 5 years ago

Update: the converted video is still cropped, I just don't get to see the crop preview/filter while editing..

occivink commented 5 years ago

Is this an error in crop.lua or encode.lua? I don't quite get it

AeliusSaionji commented 5 years ago

It's in crop.lua. The error message is what mpv spits out when I use it.

However, the crop did work for the output video when I used encode.lua.

occivink commented 5 years ago

Ok, gotcha. 3000 x 2000 is the input format or after the crop? In any case if you've got a log that would be helpful

AeliusSaionji commented 5 years ago

3000 x 2000 is the input format. How would I get a log?

occivink commented 5 years ago

Use --log-file=output.txt and reproduce the error

AeliusSaionji commented 5 years ago

output.txt

occivink commented 5 years ago

I can't see anything of interest in there. Can you try

mpv --no-config --vf=crop:y=136:x=65:h=769:w=2560 your_big_file.mkv ?

If that does not work, then something is up on mpv's side

AeliusSaionji commented 5 years ago

That works fine

occivink commented 5 years ago

And without the --no-config?

AeliusSaionji commented 5 years ago

It fails with my config.

config:

autofit-larger=80%x80%
no-border
ontop
screenshot-format=png
screenshot-template="%f [%P]"
hwdec=auto

[protocol.http]
force-window=immediate
[protocol.https]
force-window=immediate
AeliusSaionji commented 5 years ago

The problem is with hardware decoding 🤕

occivink commented 5 years ago

Ah right. The doc mentions this

Most video filters will not work with hardware decoding as they are primarily implemented on the CPU. Some exceptions are vdpaupp, vdpaurb and vavpp. See VIDEO FILTERS for more details.

The ...-copy modes (e.g. dxva2-copy) allow you to use hardware decoding with any VO, backend or filter. Because these copy the decoded video back to system RAM, they're likely less efficient than the direct modes (like e.g. dxva2), and probably not more efficient than software decoding except for some codecs (e.g. HEVC).

so try hwdec=auto-copy ?

AeliusSaionji commented 5 years ago

Yeah that works, but uses 7x more cpu :/ ah well. Thanks for helping solve this!