occivink / mpv-scripts

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

MPV crop video playback/cut the part of the video into new file - How to install and use it #54

Open slrslr opened 3 years ago

slrslr commented 3 years ago

Here is what worked for me on Linux to setup the cropping and cutting MPV player scripts:

Setup/3 commands: 1) for i in encode crop; do wget https://raw.githubusercontent.com/occivink/mpv-scripts/master/scripts/$i.lua -O ~/.config/mpv/scripts/$i.lua; done 2) echo -e "\n\n# crop.lua - c/C keys and then click+click to select crop rectangle; d key to reset, l key to obfuscate the logo\nc script-message-to crop start-crop hard\nalt+c script-message-to crop start-crop soft\nl script-message-to crop start-crop delogo\nd vf del -1\n\nC script-message-to crop toggle-crop hard\n\n# encode.lua\ne script-message-to encode set-timestamp\nalt+e script-message-to encode set-timestamp encode_webm\nE script-message-to encode set-timestamp encode_slice" >> ~/.config/mpv/input.conf 3) sed -i "s|-an -sn||g" ~/.config/mpv/scripts/encode.lua 4) quit MPV player, open the media file

Usage (keyboard keys for MPV): e,e - define cut points, make new cut file(no HW encoding) c/C and mouse clicks - crop the video playback l (lowercase L) and mouse clicks - dissolve/obfuscate logo, seems to work for playback not for cut new file

For Windows, i think one would have to manually copy scripts and append the contents of input.conf into the %appdata%\mpv *.conf file :-/ setup is not easy, can be good if these features are built in mpv https://github.com/mpv-player/mpv/issues/4639 .