Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/outfrost/trimmeroni
Cut and concatenate video clips without reencoding
https://github.com/outfrost/trimmeroni
automation ffmpeg utility video-clips video-editing video-trimming
Last synced: about 2 months ago
JSON representation
Cut and concatenate video clips without reencoding
- Host: GitHub
- URL: https://github.com/outfrost/trimmeroni
- Owner: outfrost
- License: mit
- Created: 2022-10-13T09:28:57.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-14T00:56:14.000Z (6 months ago)
- Last Synced: 2024-07-15T01:36:16.612Z (6 months ago)
- Topics: automation, ffmpeg, utility, video-clips, video-editing, video-trimming
- Language: Rust
- Homepage:
- Size: 35.2 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# trimmeroni
This little tool aims to make it easier to cut and concatenate together any number of video clips,
from any number of input files, into one output file, without reencoding. Compared to editing the
clips using video editing or transcoding software, this preserves original video quality, and
saves processing time.It uses the `ffmpeg` program under the hood to copy each requested video segment from the source
files into a temporary directory, and then concatenate them (insert one after another) into
the destination file.The only requirement is that you have `ffmpeg` installed on your system, accessible from `PATH`.
## Usage
### Examples
From "cool_gameplay.mkv", grab the segment between 08:34 and 11:02, and save it to "360_noscope.mp4"
```sh
trimmeroni -i 'cool_gameplay.mkv @ 08:34 - 11:02' "360_noscope.mp4"
```From "camera_footage.mp4", use the segments 04:20 - 04:59, 06:44 - 09:00, and from 14:40 to the end,
concatenate them, and save the result to "check_this_out.mp4"
```sh
trimmeroni -i 'camera_footage.mp4 @ 04:20 - 04:59, 06:44 - 09:00, 14:40 - ' "check_this_out.mp4"
```Take 38:08 to 45:35, and 1:02:20 to 1:17:52 from "Day1.mp4", and from the beginning to 29:26 from
"Day2.mp4", concatenate, and save the result to "Weekend bike adventure.mp4"
```sh
trimmeroni -i 'Day1.mp4 @ 38:08 - 45:35, 1:02:20 - 1:17:52' -i 'Day2.mp4 @ - 29:26' "Weekend bike adventure.mp4"
```### Details
```
Usage: trimmeroni [OPTIONS]Arguments:
Options:
-i, --input-clip
-v, --verbose Print additional information while working
-h, --help Print help information
-V, --version Print version information
````` specifies an input file and the timecodes of clips to copy from it. It should
be formatted as follows:```
INPUT_NAME @ TIMECODE - TIMECODE[, TIMECODE - TIMECODE, ...]
```where
* `INPUT_NAME` is the input file name; if the file name contains "@", use another "@" to escape it
("@@"); there is no need to escape spaces;
* each `TIMECODE` can be any seek position supported by `ffmpeg` (e.g. in `h:mm:ss` format),
or empty, meaning either the start or end of the entire video file;
* "`TIMECODE - TIMECODE,`" can be repeated any number of times in order to grab more than one clip
from the input file.You can use `-i` many times to use clips from many source files.
Remember to quote your ``, so that `trimmeroni` receives it as a single string.
The start of each clip will be snapped to the nearest keyframe before the specified timecode. For recordings from OBS Studio, for example, this may mean that the clip will include a segment from up to 2 seconds earlier.
Use `-v` or `--verbose` to get additional info from `trimmeroni` and `ffmpeg`.
## Installing
If you have `cargo`, you can install this program from crates.io:
```sh
cargo install trimmeroni
```## Building
This project uses Rust's stable toolchain, 2021 edition.
To build locally from source:
```sh
git clone https://github.com/outfrost/trimmeroni.git
cd trimmeroni
cargo build
```You can then run the debug binary like so:
```sh
cargo run -- -i 'file.mkv @ 00:02 - 01:12' "out.mp4"
```or install it to your `cargo` binaries with:
```sh
cargo install --path .
```## Contributing
Issues and pull requests welcome.
By opening an issue or pull request for this repository, you acknowledge and agree that
the contributions included in your issue or pull request may be published, used, copied, modified,
repurposed, and reused without limitation, under the terms of the MIT License (included in
[LICENSE](LICENSE)), regardless of whether or not the pull request is ever merged, and whether
or not the issue is ever resolved.If you would like your name to be included in the list of contributors in the copyright message,
please edit the LICENSE file as part of your pull request.