backup of a important mpv extension
Go to file
Ren Tatsumoto 77744d5de1
Merge pull request #3 from 0x766F6964/embed-subs
embed subs based on visibility instead of option
2021-07-06 04:47:15 +00:00
LICENSE Initial commit 2020-08-21 04:16:38 +00:00
main.lua replace dofile with require 2021-04-16 18:52:21 +03:00
osd_styler.lua rename text 2021-04-16 18:40:07 +03:00
README.md embed subs based on visibility instead of option 2021-07-05 12:00:32 -06:00
videoclip.lua embed subs based on visibility instead of option 2021-07-05 12:00:32 -06:00

screenshot

videoclip

Chat GitHub GitHub top language Lines of code

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.

Installation

Manually

Download the repository and extract the folder containing videoclip.lua 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

Using git

If you already have your dotfiles set up according to Arch Wiki recommendations, execute:

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

If not, either proceed to Arch Wiki and come back when you're done, or simply clone the repo:

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

Updating with git

Install method Command
Submodules $ config submodule update --remote --merge
Plain git $ cd ~/.config/mpv/scripts/videoclip && git pull

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

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=24

# Video settings
video_width=-2
video_height=480
video_bitrate=1M
# Available video formats: mp4, vp9, vp8
video_format=mp4
# The range of the scale is 051, where 0 is lossless,
# 23 is the default, and 51 is worst quality possible.
# Insane values like 9999 still work but produce the worst quality.
video_quality=23
# Use the slowest preset that you have patience for.
# https://trac.ffmpeg.org/wiki/Encode/H.264
preset=faster

# Audio settings
# Sane values for audio bitrate are from 16k to 64k.
audio_bitrate=32k
# Create silent videoclips by default. Possble values: `yes` or `no`.
mute_audio=yes

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.