Skip to content

Commit

Permalink
refactor readme
Browse files Browse the repository at this point in the history
  • Loading branch information
couleurm committed Feb 25, 2024
1 parent 513768e commit 1f34d0f
Showing 1 changed file with 75 additions and 47 deletions.
122 changes: 75 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,88 @@
> **Warning**
>
> This is not fully functional yet (e.g FFmpeg export option still missing) and still has a few rough edges
> [!WARNING]
> ffmpeg export is not supported, only with [smoothie-rs](https://github.com/couleur-tweak-tips/smoothie-rs), see [alternatives](#alternatives) for now
Lets you set timestamps (which get represented for you by chapters) to export your videos with FFmpeg or [Smoothie](https://github.com/couleur-tweak-tips/Smoothie)
# suckless-cut

### Keybinds
I recreated the features I liked from [losslesscut](https://github.com/mifi/lossless-cut) in the [mpv](https://mpv.io) video player via a lua script

* <kbd>g</kbd> and <kbd>h</kbd> to set the start and end points of your index (will be put at your current time position in the video)
* <kbd>G</kbd> and <kbd>H</kbd> will do the same but set them at the very start of the video (00:00:00) or the very last second of the video
<details>
<summary>Why?</summary>

* <kbd>CTRL+k</kbd> toggles between TRIM and SPLIT mode:
* SPLIT separates every single cut into separate files
* TRIM merges and joins the multiple cuts you have per video
* <kbd>CTRL+v</kbd> toggles on/off verbose
LosslessCut is a great and intuitive user interface for cutting videos, but I dislike all the loading times you need to wait through at each step and much prefer a CLI / keyboard based workflow.

* <kbd>CTRL+e</kbd> toggles exporting modes:
* FFmpeg with keyframe cutting
* [Smoothie](https://github.com/couleur-tweak-tips/Smoothie), my VapourSynth-based motion blur program
* Default behavior when the script inits can be set in the first few lines of the lua script, when you are [installing Smoothie](https://github.com/couleur-tweak-tips/TweakList/blob/master/modules/Installers/Invoke-SmoothiePost.ps1) the default gets changed to Smoothie
mpv is a much snappier video player, so I made a lua script with keybinds to gather in and out points of videos, and run an external process (smoothie or ffmpeg) to read that video and make a cut copy of them.
</details>

# Features

* supports cutting multiple segments (called 'indexes')
* entirely controllable by [keyboard](#keybinds)
* snappy, no chromium or javascript around here
* supports playlists (having multiple files open at once)
* segments are displayed by making fake chapters

![chapters](https://github.com/couleur-tweak-tips/suckless-cut/releases/download/readme-assets/chapters.webp)

# Installation

Place [`suckless-cut.lua`](https://github.com/couleur-tweak-tips/suckless-cut/releases/latest/download/suckless-cut.lua) in your mpv `scripts` folder

<details open>
<summary>What? what even is is my "scripts folder?"</summary>


### mpv config folder location

* https://mpv.io/manual/master/#files (on linux)

* https://mpv.io/manual/master/#files-on-windows

Tip: if you installed mpv on Windows with Scoop it's at `%USERPROFILE%\scoop\apps\mpv\current\portable_config`
</details>

You may also run mpv with `--script="/path/to/suckless-cut.lua"`
## Keybinds

### Setting in & out point(s)

* <kbd>g</kbd> and <kbd>h</kbd> sets <u>in</u> and <u>out</u> points at current player position

* <kbd>G</kbd> and <kbd>H</kbd> sets <u>in</u> point at `00:00:00`, and <u>out</u> the end of the video

### Rendering

* <kbd>Ctrl+r</kbd> takes your indexes and executes your default export program with them

### Navigating indexes

Each cut you make is stored in an index, which contains the `start`, `fin` (end) and file `path`

After setting a start and end point, setting another start point will automatically set it to index #2

* <kbd>c</kbd> and <kbd>C</kbd> lets you go down (uncapped), and up (with capitalized) your **indexes**, which is what each `start`-`end` combo is called

Or if you have the amazing [uosc](https://github.com/tomasklaen/uosc) ui installed you can press <kbd>Ctrl+t</kbd> for a beautiful index selector
* <kbd>Ctrl-p</kbd> prints all indexes to console & OSD

* <kbd>Ctrl+t</kbd> (required [uosc](https://github.com/tomasklaen/uosc) installed) graphical index selector

![](https://media.discordapp.net/attachments/829078609465180170/1040925209240272997/image.png)
![image](https://github.com/couleur-tweak-tips/suckless-cut/releases/download/readme-assets/selector.webp)

## Roadmap

* Export option to FFmpeg (Lossless-Cut style)
* Demo video
* <kbd>k</kbd> cycles between cutting modes:
* `split` separates every single cut into separate files
* `trim` merges and joins the multiple cuts you have per video

### input.conf template (set to defaults)
```yaml
# suckless-cut
g script-binding set-start
G script-binding set-sof
h script-binding set-fin
H script-binding set-eof
Ctrl+r script-binding exportSLC
Ctrl+k script-binding toggleSLCexportModes
Ctrl+v script-binding toggleSLCverbose
Ctrl+g script-binding getCurrentIndex
C script-binding increaseIndex
c script-binding decreaseIndex
Ctrl+p script-binding showPoints
Ctrl+t script-binding selectindex

# misc suckless cut
Ctrl+p script-binding showPoints
n script-binding createChapter
Ctrl+D script-binding deletechapters
R script-binding reloadTrs
```

### Acknowledgements

* @po5 for his help, check out his thumbnailer script [thumbfast](https://github.com/po5/thumbfast)
* Tomas Klaen for making [uosc](https://github.com/tomasklaen/uosc)
### Debugging

* <kbd>Ctrl+v</kbd> toggles on/off verbose
<!--
* <kbd>CTRL+e</kbd> toggles exporting modes:
* FFmpeg with keyframe cutting
* [Smoothie](https://github.com/couleur-tweak-tips/Smoothie), my VapourSynth-based motion blur program
* Default behavior when the script inits can be set in the first few lines of the lua script, when you are [installing Smoothie](https://github.com/couleur-tweak-tips/TweakList/blob/master/modules/Installers/Invoke-SmoothiePost.ps1) the default gets changed to Smoothie
-->

# Alternatives

* https://github.com/stax76/awesome-mpv#video-editing
* https://github.com/f0e/mpv-cut

0 comments on commit 1f34d0f

Please sign in to comment.