Lua MPV script which allows to cut/trim video file into clips which are generated and merged in the background while viedo playback is running. In order to cut and merge the video clips a shell script running ffmpeg commands is invoked.
The script uses MPV's OSD messages for user interaction.
The output video will be created in the same directory as original one with the
following filename format: YYYY-MM-DD_hh_mm_ss.mkv
.
Two default (but editable) keymaps are provides two keymaps:
Ctrl t
: start/end video clip timestamp, which are saved in temporary file and passed to ffmpeg;Ctrl Shift t
: clear accidental start timestamp;Ctrl p
: start trimming/merging clips (valid input only if paired start/end timestamps have been saved).
In order to install the the scripts run the following commands:
git clone https://github.com/marcoradocchia/mpv-cutvid
sudo make USER=<user> install
where <user>
is a placeholder for the user's name the script is intended to
be used by.
In order to uninstall the scripts run:
sudo make USER=<user> uninstall
where <user>
is a placeholder like above.
This script makes use of ffmpeg to produce video output, on Arch Linux ffmpeg
is an MPV dependency. On different distribution installing ffmpeg
might be
needed.
The ffmpeg-cut-merge
script needs bc
to be installed. On Arch based distros
install it with:
sudo pacman -S bc