backup of a important mpv extension
Go to file
2020-08-27 10:13:48 +03:00
LICENSE Initial commit 2020-08-21 04:16:38 +00:00
README.md audio clips and video clips have their own locations 2020-08-27 10:12:30 +03:00
videoclip.lua check for the trailing '/' 2020-08-27 10:13:48 +03:00

videoclip

Easily create videoclips with mpv in a few keypresses.

Requirements

Installation

Install as a part of your dotfiles

$ config submodule add 'https://github.com/Ajatt-Tools/videoclip.git' ~/.config/mpv/scripts/videoclip

Install by cloning the repo

$ git clone 'https://github.com/Ajatt-Tools/videoclip.git' ~/.config/mpv/scripts/videoclip

Enable the addon

After you've downloaded the addon, open or create ~/.config/mpv/scripts/modules.lua and add these lines:

local mpv_scripts_dir_path = os.getenv("HOME") ..  "/.config/mpv/scripts/"
function load(relative_path) dofile(mpv_scripts_dir_path .. relative_path) end
load("videoclip/videoclip.lua")

Updating

Submodules are updated using standard git commands:

$ config submodule update --remote --merge

or

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

Configuration

Configuration file is located at ~/.config/mpv/script-opts/videoclip.conf and should be created by the user. If a parameter is not specified in the config file, the default value will be used. mpv doesn't tolerate spaces before and after =.

Example configuration file:

# Absolute paths to the folders where generated clips will be placed.
# `~` or `$HOME` are not supported due to mpv limitations.
video_folder_path=/home/user/Videos
audio_folder_path=/home/user/Music

# Menu size
font_size=20

# Sane values are from 16k to 32k.
audio_bitrate=32k

# The range of the scale is 051, where 0 is lossless,
# 23 is the default, and 51 is worst quality possible.
video_quality=23

# Use the slowest preset that you have patience for.
# https://trac.ffmpeg.org/wiki/Encode/H.264
preset=faster

# Video dimensions
video_width=-2
video_height=480

Key bindings are configured in ~/.config/mpv/input.conf. This step is not necessary.

c script-binding 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.