videoclip

July 29, 2026 ยท View on GitHub

screenshot

videoclip

Chat GitHub GitHub top language Patreon

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.

Prerequisites

  1. Install mpv.

  2. Add the directory where mpv is 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/bin which is already added to the PATH. If you have installed mpv to a non-standard location, or if you're not using the GNU operating system, you need to make sure that mpv is added to the PATH.

Installation

Using git

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/videoclip

To update the user-script on demand later, you can execute:

cd ~/.config/mpv/scripts/videoclip && git pull

Using make

Clone the repository first, then install to ~/.config/mpv by running:

git clone 'https://github.com/Ajatt-Tools/videoclip.git'
cd videoclip
make install

The 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 uninstall

To install to a different mpv config directory, set PREFIX:

make PREFIX="$HOME/.config/mpv" install

Manually

  1. Download the latest release or the master branch (trunk)
  2. Extract the videoclip/ directory from the zip file to your mpv scripts directory.
OSLocation
GNU/Linux~/.config/mpv/scripts/
WindowsC:/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

Configuration

The config file should be created by the user, if needed.

OSConfig location
GNU/Linux~/.config/mpv/script-opts/videoclip.conf
WindowsC:/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.

Key bindings

OSConfig location
GNU/Linux~/.config/mpv/input.conf
WindowsC:/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

Usage

  • Open a file in mpv and press c to open the script menu.
  • Follow the onscreen instructions. You need to set the start point, end point, and then press c to create the clip.

It is possible to create silent videoclips. To do that, first mute audio in mpv. The default key binding is m.

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.

Running tests

Run tests without mpv or a media file:

lua tests/run.lua
luajit tests/run.lua

Run 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"