Keeping a take
Trim a take, change its speed, keep it as a video or a GIF, and add buttons of your own that send it somewhere.
A finished take plays in a sheet, with Download, and any buttons of your own beside it.
Trim and speed
Drag the yellow handles to trim a video, or move them with the arrow keys, a tenth of a second at a time or a second with Shift. Play it at 0.5×, 1×, 1.5× or 2×. The preview loops the part kept, at its speed, and Download saves it as kept; your own actions get the video as kept too.
Video or GIF
- A video trimmed or sped is played through once at that speed and recorded again, its sound kept at its pitch: it takes as long as the edited take lasts.
- A GIF is 15 frames a second, at most 800 pixels wide, with one palette for the whole take, its most used colours kept exactly and a median cut of the rest. Each frame stores only what changed, so a page that mostly holds still weighs little. It loops.
A regular MP4
Chrome records a fragmented MP4, with no index of its samples and a length of zero, which some players and editors trip on. Closeup rewrites it as a regular MP4 when the take stops: the same samples, not encoded again, indexed, with its length.
Your own actions
addAction puts a button of your own on the finished take, beside Download, to keep it somewhere:
import { addAction } from "@cesarvenzac/closeup";
addAction({
label: "Save to library",
// Optional: its icon, as paths on a 24-unit grid.
icon: `<path d="M12 13v8"/><path d="m8 17 4-4 4 4"/>`,
// Optional: which takes to offer it on.
when: (take) => take.kind === "video",
async run(take, { progress }) {
await upload(take.blob, progress); // progress(0…1)
return "Saved."; // said when it's done
},
});A take is { kind, blob, type, width, height, seconds?, script? }: a photo or a video, its file and type, its size, its length, and the script it played if one did. A video trimmed or sped is made first, then the button counts up while run works; once it's done it shows a tick and stays pressed, and what run returned is said. A thrown error's message is said instead, and the button can be pressed again. addAction returns what takes it away again.