videoclip/README.md

71 lines
2.3 KiB
Markdown
Raw Normal View History

2020-08-21 04:16:38 +00:00
# videoclip
2020-09-06 15:57:14 +00:00
Easily create video and audio clips with mpv in a few keypresses. Videoclips are saved as `.mp4`.
![screenshot](https://user-images.githubusercontent.com/69171671/92329784-683ff900-f059-11ea-9514-e8718e42dd5a.jpg)
2020-08-21 05:04:26 +00:00
2020-08-21 04:26:24 +00:00
## Installation
### Install as a part of your [dotfiles](https://wiki.archlinux.org/index.php/Dotfiles#Tracking_dotfiles_directly_with_Git)
```
$ 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
```
2020-08-21 07:17:40 +00:00
### Enable the addon
After you've downloaded the addon, open or create ```~/.config/mpv/scripts/modules.lua``` and add these lines:
2020-08-21 04:26:24 +00:00
```
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")
```
2020-08-21 04:28:58 +00:00
## Updating
Submodules are updated using standard git commands:
```
$ config submodule update --remote --merge
```
or
```
$ cd ~/.config/mpv/scripts/videoclip && git pull
```
2020-08-21 04:41:10 +00:00
## 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 `=`.
2020-08-21 04:41:10 +00:00
Example configuration file:
```
# Absolute paths to the folders where generated clips will be placed.
2020-08-21 04:41:10 +00:00
# `~` or `$HOME` are not supported due to mpv limitations.
video_folder_path=/home/user/Videos
audio_folder_path=/home/user/Music
2020-08-21 04:41:10 +00:00
# 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.
2020-09-20 00:43:41 +00:00
# Insane values like 9999 still work but produce the worst quality.
2020-08-21 04:44:43 +00:00
video_quality=23
2020-08-21 04:41:10 +00:00
# Use the slowest preset that you have patience for.
# https://trac.ffmpeg.org/wiki/Encode/H.264
2020-08-21 04:44:43 +00:00
preset=faster
2020-08-21 04:41:10 +00:00
# Video dimensions
2020-08-21 04:44:43 +00:00
video_width=-2
video_height=480
2020-08-21 04:41:10 +00:00
```
Key bindings are configured in ```~/.config/mpv/input.conf```.
This step is not necessary.
```
2020-08-31 19:45:35 +00:00
c script-binding videoclip-menu-open
2020-08-21 04:41:10 +00:00
```
2020-08-21 04:59:41 +00:00
## Usage
- Open a file in mpv and press `c` to open the script menu.
2020-09-20 00:55:19 +00:00
- Follow the onscreen instructions. You need to set the `start point`,
`end point`, and then press `c` to create the clip.