diff options
| -rw-r--r-- | ar/.config/mpv/input.conf | 1 | ||||
| -rw-r--r-- | ar/.config/mpv/scripts/slicing.lua | 15 |
2 files changed, 14 insertions, 2 deletions
diff --git a/ar/.config/mpv/input.conf b/ar/.config/mpv/input.conf index ef86749..4d63c44 100644 --- a/ar/.config/mpv/input.conf +++ b/ar/.config/mpv/input.conf @@ -43,6 +43,7 @@ s cycle pause ctrl+PRINT script-binding crop-screenshot # Crop screenshot o script-binding slicing/set-start # Set lossless cut start point O script-binding slicing/set-end # Set lossless cut end point and export +ctrl+o script-binding slicing/set-end-eof # Cut from start point to the end of the video and export ctrl+l script-message-to misc cycle-known-tracks audio # Loop auidio shift+l no-osd seek 30 exact; script-message-to misc show-position # Seek exactly 1 second forward shift+h no-osd seek -30 exact; script-message-to misc show-position # Seek exactly 1 second backward diff --git a/ar/.config/mpv/scripts/slicing.lua b/ar/.config/mpv/scripts/slicing.lua index 2653ce8..59bd980 100644 --- a/ar/.config/mpv/scripts/slicing.lua +++ b/ar/.config/mpv/scripts/slicing.lua @@ -39,8 +39,7 @@ local function set_start() osd(("Cut start: %s"):format(fmt(start_time))) end -local function set_end() - local end_time = mp.get_property_number("time-pos") +local function do_cut(end_time) if not end_time then return end if not start_time then @@ -107,5 +106,17 @@ local function set_end() end) end +-- mark end at the current playback position +local function set_end() + do_cut(mp.get_property_number("time-pos")) +end + +-- mark end at the very end of the file, regardless of playback position, +-- so you don't have to catch the last frame before playback ends +local function set_end_eof() + do_cut(mp.get_property_number("duration")) +end + mp.add_key_binding(nil, "set-start", set_start) mp.add_key_binding(nil, "set-end", set_end) +mp.add_key_binding(nil, "set-end-eof", set_end_eof) |
