Files
vibedit/README.md
Sean MTS 396a676146 Initial commit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 02:28:47 +00:00

50 lines
3.3 KiB
Markdown

# VibEdit
A small video cutter for Windows built on ffmpeg. Load one or more source videos, mark the parts you want, and export them joined into one file or as separate files. Lossless export copies the original streams. Re-encode export makes frame-exact cuts and lets you change codec, size and quality.
## Using it
Download or build `dist/VibEdit-windows-x64.zip`, extract it, and double-click `vibedit.exe`. The editor opens in a chromeless Microsoft Edge window. The end-user instructions are in [package-readme.txt](package-readme.txt), which ships inside the zip as `README.txt`.
`vibedit.exe` looks for `ffmpeg.exe` and `ffprobe.exe` in four places, in this order:
1. next to itself
2. in `ffmpeg\`
3. in `bin\`
4. on `PATH`
You can also point to them with `-ffmpeg` and `-ffprobe`.
## Building
The project is pure Go with no cgo, so you can build the Windows exe on any OS:
```sh
./build.sh # dist/vibedit.exe
./build.sh --package # also downloads ffmpeg (gyan.dev "release essentials") into dist/VibEdit-windows-x64.zip
```
On Windows itself, run `go build -o vibedit.exe .`. You need Go 1.22 or later.
`go build` links the app icon and version info into Windows builds automatically from `rsrc_windows_*.syso`. To regenerate those files after editing `winres/`, run:
```sh
go run github.com/tc-hib/go-winres@v0.3.3 make --in winres/winres.json --arch amd64,arm64 --out rsrc
```
## How it works
- `main.go` starts an HTTP server on a random 127.0.0.1 port and opens the UI. It prefers `msedge --app=…` and falls back to the default browser.
- **Access:** every request must carry a cookie, which the browser gets in exchange for a random token in the startup URL. Only loopback `Host` headers are accepted.
- **Shutdown:** the program quits about 10 seconds after the last editor window disconnects, unless an export is still running.
- `web/` holds the UI: plain HTML, CSS and JS embedded into the binary.
- **Playback:** the browser plays sources directly from the server, which supports HTTP range requests.
- **Unplayable formats** (AVI, WMV, some codecs): the server makes a small H.264 preview copy and caches it in `%LocalAppData%\vibedit\proxies`. Until it is ready, the viewer shows still frames.
- `media.go` probes sources with ffprobe, renders thumbnails and scans keyframe positions.
- `export.go` builds the ffmpeg commands:
- **Lossless:** cuts each clip with `-c copy`, starting exactly at the keyframe at or before In. When joining, it writes temporary segments and concatenates them with the concat demuxer. This only works when all sources share the same format; the server rejects joins where they differ.
- **Re-encode:** one ffmpeg run. Each clip is a seeked input; the filter graph normalizes size (letterboxing as needed), frame rate and audio format, then joins with the `concat` filter. Cuts are frame-exact: In includes the frame shown, Out cuts just before the frame shown.
- **Output safety:** outputs are written to `*.vibedit-part.*` and renamed when finished, so a failed or canceled export never leaves a broken file.
- `platform_windows.go` provides native Open/Save dialogs (PowerShell + WinForms, no cgo), drive listing and "Show in folder". Other platforms use the built-in file browser.
- The project is autosaved to `%AppData%\vibedit\session.json`.