A video cutting/clipping/slicing script for mpv
- Can generate a small file with a pre-defined size, resolution and audio bitrate using
shift
+c
. - You're able to input custom FFmpeg parameters in the normal cutting process using
c
Place it inside the Linux mpv scripts folder normally on: ~/.config/mpv/scripts
, and install the FFmpeg package if not already installed.
- Ubuntu:
sudo apt install ffmpeg
- Arch:
sudo pacman -S ffmpeg
oryay -S ffmpeg
Place it inside the Windows mpv scripts folder normally on %appdata%\mpv\scripts
, and install the FFmpeg package if not already installed with Chocolatey.
- Chocolatey (open cmd/powershell as admin):
choco install ffmpeg-full
orcinst ffmpeg-full
Press the default key C
to mark the first position, and where you desire to save, on the last position, press C
again.
Use Shift+C
for cutting with a smaller file size. Disclaimer: This will result in way slower cutting speeds.
The settings can be changed by editing the script file.
local settings = {
key_mark_cut = "c",
video_extension = "mp4",
-- if you want faster cutting, leave this blank
ffmpeg_custom_parameters = "",
web = {
-- small file settings
key_mark_cut = "shift+c",
audio_target_bitrate = "128", -- kbps
video_target_file_size = "8", -- mb
video_target_scale = "1280:-1" -- https://trac.ffmpeg.org/wiki/Scaling everthing after "scale=" will be considered, keep "original" for no changes to the scaling
}
}
key_mark_cut
: The key for cutting the video.video_extension
: The output extension of the video.ffmpeg_custom_parameters
: FFmpeg custom parameters to use. Disclaimer: This will result in way slower cutting speeds as it is not going to use-c copy
anymore.web.key_mark_cut
: The key for cutting the video with a shareable web file size (todo).web.audio_target_bitrate
: Target audio bitrate for the web cut.web.video_target_file_size
: Target file size for the web cut.web.video_target_scale
: Target video scale (https://trac.ffmpeg.org/wiki/Scaling), keep "original" for no changes to the scaling.