Easily create video and audio clips with mpv in a few keypresses.
Videoclips are saved as .mp4 or .webm.
Subtitles can be embedded into the clips.
-
Add the directory where
mpvis installed to the PATH.If you're using GNU/Linux, this step is likely unnecessary because package managers (
apt,pacman, etc.) place executable files to/usr/binwhich is already added to thePATH. If you have installedmpvto a non-standard location, or if you're not using the GNU operating system, you need to make sure thatmpvis added to thePATH.
Clone the repository to the mpv/scripts directory.
The command below works on the GNU operating system with git installed.
git clone 'https://github.com/Ajatt-Tools/videoclip.git' ~/.config/mpv/scripts/videoclipTo update the user-script on demand later, you can execute:
cd ~/.config/mpv/scripts/videoclip && git pullClone the repository first, then install to ~/.config/mpv by running:
git clone 'https://github.com/Ajatt-Tools/videoclip.git'
cd videoclip
make installThe installation target copies the videoclip/ directory to ~/.config/mpv/scripts/.
If none exists, installs the example config to ~/.config/mpv/script-opts/videoclip.conf.
To uninstall, run:
make uninstallTo install to a different mpv config directory, set PREFIX:
make PREFIX="$HOME/.config/mpv" install- Download the latest release or the master branch (trunk)
- Extract the
videoclip/directory from the zip file to your mpv scripts directory.
| OS | Location |
|---|---|
| GNU/Linux | ~/.config/mpv/scripts/ |
| Windows | C:/Users/Username/AppData/Roaming/mpv/scripts/ |
Note: in Celluloid user scripts are installed by switching to the "Plugins" tab in the preferences dialog and dropping the files there.
Expected directory tree
~/.config/mpv/scripts
|-- other_addon_1
|-- other_addon_2
`-- videoclip
|-- main.lua
|-- ...
`-- videoclip.lua
The config file should be created by the user, if needed.
| OS | Config location |
|---|---|
| GNU/Linux | ~/.config/mpv/script-opts/videoclip.conf |
| Windows | C:/Users/Username/AppData/Roaming/mpv/script-opts/videoclip.conf |
If a parameter is not specified in the config file, the default value will be used.
mpv doesn't tolerate spaces before and after =.
The example configuration file is stored in
videoclip/config/default_config.conf.
Release pages also provide it as videoclip.conf.
Copy it to your script-opts directory and edit it as needed.
| OS | Config location |
|---|---|
| GNU/Linux | ~/.config/mpv/input.conf |
| Windows | C:/Users/Username/AppData/Roaming/mpv/input.conf |
Add this line if you want to change the key that opens the script's menu.
c script-binding videoclip-menu-open
- Open a file in mpv and press
cto open the script menu. - Follow the onscreen instructions. You need to set the
start point,end point, and then presscto create the clip.
It is possible to create silent videoclips.
To do that, first mute audio in mpv.
The default key binding is m.
Muted videoclips contain no audio tracks, rather than an audio track with silence.
If a video has visible subtitles, they will be embedded automatically.
Toggle them off in mpv if you don't want any subtitles to be visible.
The default key binding is v.
Run tests without mpv or a media file:
lua tests/run.lua
luajit tests/run.luaRun tests inside a real mpv instance with a local media file:
VIDEOCLIP_TEST=TRUE mpv --msg-level=all=no,videoclip=warn "/path/to/video.mkv"