# VibEdit A small video cutter for Windows and Linux 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. Animated GIF export makes a looping GIF without sound. Load an .srt file with a source video to see its captions while you edit and burn them into Re-encode and GIF exports. ## Using it **Windows:** 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`. **Linux:** download or build `dist/VibEdit-linux-x64.tar.xz`, extract it, and run `./vibedit`, or run `./install.sh` once to add it to the applications menu. The editor opens in a Chrome, Chromium, Edge or Brave app window, or else in the default browser. File dialogs use zenity or kdialog when either is installed. The end-user instructions are in [linux/README.txt](linux/README.txt), which ships inside the archive as `README.txt`. VibEdit looks for `ffmpeg` and `ffprobe` (`.exe` on Windows) 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 ./build.sh linux # dist/vibedit ./build.sh linux --package # also downloads ffmpeg (BtbN static release build) into dist/VibEdit-linux-x64.tar.xz ./build.sh all [--package] # both ``` The Linux ffmpeg URL in `build.sh` names a release branch (currently n9.0). BtbN only keeps the newest few branches, so bump the version there when the download starts failing. On Windows itself, run `go build -o vibedit.exe .`; on Linux, `go build .`. 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 an Edge or Chrome `--app=…` window (on Linux also Chromium and Brave) 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` (`~/.cache/vibedit/proxies` on Linux). 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. - **Animated GIF:** two ffmpeg runs over the same filter graph as Re-encode. The first picks a 256-color palette for the whole animation (`palettegen`), the second maps every frame onto it (`paletteuse`). ffmpeg reports no progress while it builds a palette, so the progress bar only covers the second run. - **Output safety:** outputs are written to `*.vibedit-part.*` and renamed when finished, so a failed or canceled export never leaves a broken file. - `captions.go` handles captions: - **Loading:** it parses .srt files in UTF-8, UTF-16 (with a byte order mark) or Windows-1252. The editor draws the current source's captions over the viewer itself, at the size and in the style the export will use. - **Burning in:** Re-encode and GIF exports write each clip's captions to a temporary .srt timed from its In point. The `subtitles` filter (libass) draws them after scaling, so they get the same size in every clip. Sizes are relative to the shorter side of the frame, so portrait videos get the same size as landscape ones. Lossless export cannot change the picture and refuses captions. - `platform_windows.go` provides native Open/Save dialogs (PowerShell + WinForms, no cgo), drive listing and "Show in folder". - `platform_linux.go` does the same with zenity or kdialog, mounted drives, and the FileManager1 D-Bus call (falling back to `xdg-open` on the folder). It runs ffmpeg in its own process group, so Ctrl+C in the terminal reaches only VibEdit, which then cancels exports cleanly. - Without a dialog program (and on other platforms) the UI uses its built-in file browser. - The project is autosaved to `%AppData%\vibedit\session.json` (`~/.config/vibedit/session.json` on Linux). ## License VibEdit is public domain, released under [the Unlicense](LICENSE). Kopimi: copy it, change it, share it, sell it. No permission needed. That covers VibEdit's own code. The ffmpeg and ffprobe binaries in the release archives are GPLv3 and ship with their license as `ffmpeg-LICENSE.txt` (source at ).