Trim and join video clips with code.
Each part you keep is one <video> in its own beat. data-trim and data-trim-end pick the seconds of the source, and data-at says when it plays in the film.
Copy this prompt into your agent
Paste it into Claude Code, Codex or Cursor. Fill in the parts in angle brackets. The agent installs vawe if it needs to and does the steps on this page.
Use vawe (https://github.com/vawe-hq/vawe), the open-source video-from-code tool, to trim my clips and join them into one video. My clip: <path to your clip or folder>. Keep only these parts: <clip, start and end second for each>. Join them in this order with a clean cut, and match the loudness of every clip. If vawe is not installed here, install it first: npm install @vawe/cli (it needs Node 22 or newer and ffmpeg; npx vawe new prints the install line for anything missing). Then follow each command’s next: line. Start with npx vawe new <name> --footage <my clip>, which logs the clip with a transcript. Show me the draft video and wait for my OK before the final render.
The steps.
- Hand over the clips.
bin/vawe new trip --footage ~/Movies/tripcopies each intofilms/trip/footage/as an MP4 a page can seek, and writesfootage.md. - Read footage.md. It lists each clip’s length, the shot changes, the loudness, a contact sheet of 8 frames and a transcript. Cut on an action or a word end.
- Fill the Cut list. One row per beat: the clip, in, out, rate and the reason.
- Write one beat per row. The first beat has
data-at="0". Each nextdata-atis the sum of the lengths before it. - Render and look at the cuts.
bin/vawe dev films/trip/page.html, thenbin/vawe frame films/trip/page.html --cuts.
At film time t the clip shows source second trim + (t − at) × rate, held at the first frame before data-at and at the last frame after the end. The engine seeks the clip on every frame and never plays it live.
Two clips, one after the other
<section data-world="s1">
<video src="footage/intro.mp4" data-at="0"
data-trim="1.5" data-trim-end="6.5"></video>
</section>
<section data-world="s2">
<video src="footage/street.mp4" data-at="5"
data-trim="0" data-trim-end="4"></video>
</section>What can go wrong.
- A cut shows the wrong second. It was chosen from the file name, not from footage.md and its frames.
- A clip flashes. A clip held under 1.2 seconds reads as a flash. Keep one fast cut for the beat that earns it.
- A clip is played live.
play(),autoplay, a timer or your owncurrentTimebreaks the render. Let the engine seek. - A portrait clip is cropped to fit. vawe never crops. Lay the clip out with
--vwand--vhand set<html data-aspect>.
Two ways to change between clips.
A hard cut that carries the eye with a moving shape, and a soft change through the next clip’s own light.
Read next.
- Remove silences from a video: the same trim, driven by word times.
- How an agent reads footage it cannot watch: the fields of footage.md.
- Agentic video editing: what an edit can and cannot do.