No description
  • Lua 98.7%
  • Makefile 1.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-09-29 16:45:55 +00:00
.github Bump softprops/action-gh-release from 2 to 3 (#52) 2026-07-30 00:18:58 +00:00
tests remove fail async 2026-07-29 06:39:01 +03:00
videoclip Added webp clip option 2026-09-29 16:45:55 +00:00
.gitignore update gitignore 2026-07-30 01:10:53 +03:00
LICENSE Initial commit 2020-08-21 04:16:38 +00:00
main.lua replace print with mp.msg 2026-07-29 02:18:53 +03:00
Makefile remove all release artifacts 2026-07-30 03:11:07 +03:00
README.md add auto release file 2026-07-30 02:06:58 +03:00

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.
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

Configuration

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.

Key bindings

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

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"