Skip to content

MPV lua script to cut and merge video sections into a single clip, using ffmpeg in the background

License

Notifications You must be signed in to change notification settings

marcoradocchia/mpv-cutvid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mpv-cutvid

GitHub releases GitHub source size GitHub open issues GitHub open pull requests GitHub sponsors GitHub license

MPV lua script to cut and merge video sections into a single clip, using ffmpeg in the background.

Description

Lua MPV script which allows to cut/trim video file into clips which are generated and merged in the background while viedo playback is running. In order to cut and merge the video clips a shell script running ffmpeg commands is invoked.

The script uses MPV's OSD messages for user interaction.

The output video will be created in the same directory as original one with the following filename format: YYYY-MM-DD_hh_mm_ss.mkv.

Keymaps

Two default (but editable) keymaps are provides two keymaps:

  • Ctrl+t: start/end video clip timestamp, which are saved in temporary file and passed to ffmpeg;
  • Ctrl+Shift+t: clear accidental start timestamp;
  • Ctrl+p: start trimming/merging clips (valid input only if paired start/end timestamps have been saved).

Installation

In order to install the the scripts run the following commands:

git clone https://github.com/marcoradocchia/mpv-cutvid 
sudo make USER=<user> install

where <user> is a placeholder for the user's name the script is intended to be used by.

Uninstall

In order to uninstall the scripts run:

sudo make USER=<user> uninstall

where <user> is a placeholder like above.

Requirements

This script makes use of ffmpeg to produce video output, on Arch Linux ffmpeg is an MPV dependency. On different distribution installing ffmpeg might be needed.

The ffmpeg-cut-merge script needs bc to be installed. On Arch based distros install it with:

sudo pacman -S bc

License

GPLv3

About

MPV lua script to cut and merge video sections into a single clip, using ffmpeg in the background

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project