https://github.com/wong-justin/vic
Trim videos in the terminal
https://github.com/wong-justin/vic
ansi chafa crossterm ffmpeg rust terminal trim tui
Last synced: 2 months ago
JSON representation
Trim videos in the terminal
- Host: GitHub
- URL: https://github.com/wong-justin/vic
- Owner: wong-justin
- License: gpl-3.0
- Created: 2024-10-14T14:49:21.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-12-30T05:45:36.000Z (5 months ago)
- Last Synced: 2026-01-02T02:35:24.762Z (5 months ago)
- Topics: ansi, chafa, crossterm, ffmpeg, rust, terminal, trim, tui
- Language: Rust
- Homepage:
- Size: 284 KB
- Stars: 111
- Watchers: 1
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vic
Play & cut videos in the terminal
https://github.com/user-attachments/assets/340596e9-f060-4454-833d-8d62af01ccdd
## Building
`vic` requires [`ffmpeg`](https://ffmpeg.org//download.html) to be on `$PATH` during runtime.
`vic` is linked with [`chafa`](https://hpjansson.org/chafa/), a C library that makes pretty pictures in the terminal.
### Linux
Install `chafa` from your package manager, or build it from source with something like:
```
apt-get install libglib2.0-dev
curl 'https://hpjansson.org/chafa/releases/chafa-1.14.4.tar.xz' -O
tar xf chafa-1.14.4.tar.xz
cd chafa-1.14.4
./configure --without-tools
make
make install
ldconfig
```
Once `chafa` is installed, you can build the Rust project with `cargo build`.
Make sure everything is compiled and linked correctly by running `cargo test`.
You can find the built binary at `target/debug/vic`, or install it with `cargo install --path .`
### Static binaries
Statically linked binaries (that bundle `chafa`) for x86-64 Linux can be built with the Dockerfile.
## Examples
```
vic video.mp4
vic video.mp4 -w=9999
vic http://example.com/video.avi -w 20
vic video.webm -w 80 --dry-run
vic video.mp4 --log log.txt
```
## Usage
```
vic [-w ]
[--dry-run]
[--log ]
[--help|--version]
```
### Options
```
-w Max output width, in columns.
Use -w 9999 for fullscreen.
Defaults to 40.
--dry-run Instead of running ffmpeg on finish,
just print the commands to stdout.
--log Write logs to this file.
```
### Controls
```
[ segment mode ]
m ....... make marker
space ... play/pause
j/l ..... back/forwards 15 secs
←/→ ..... back/forwards 5 secs
0-9 ..... seek to 0%, 10%, etc
. ....... advance one frame
q ....... finish
[ marker mode ]
J/L ..... goto prev/next marker
M ....... delete marker
```
## Notes
Here's a blog post: https://wonger.dev/posts/chafa-ffmpeg-progress
My main focus for now is creating a separate UI thread and adding audio.
I also need to fiddle with GitHub Actions.
There's several quality-of-life improvements to work on.
Pull requests welcome :)
Created during [LMT2](https://lmt2.com/).