Token-level magic move
diffreel diffs line by line, then token by token, so i <= n becomes i < n by moving the tokens that stayed instead of retyping the line.
Free & open source · MIT
Give diffreel two versions of a file, a git commit or a list of steps. It renders an MP4, GIF or WebM in which unchanged code slides into place, removed code fades out and new code types in, all with syntax highlighting.
npx diffreel before.ts after.ts -o out.mp4
Edit the code, and the preview runs the real diffreel engine in your browser. When it looks right, download steps.json and render the video with one command.
Loading the engine…
npx diffreel steps.json -o diffreel.mp4
Rendering to a video file runs on your machine with headless Chromium and ffmpeg, so nothing is uploaded anywhere.
diffreel diffs line by line, then token by token, so i <= n becomes i < n by moving the tokens that stayed instead of retyping the line.
Highlighting comes from Shiki, the engine behind VS Code themes. Use github-dark, dracula, tokyo-night, nord or any other theme.
Choose 16:9 YouTube, 9:16 Reels and Shorts, or 1:1 square. Add captions, a macOS window frame, a typing effect and change highlights.
No server, no account and no upload. diffreel uses headless Chromium plus a bundled ffmpeg, so you install nothing else.
Frames render at 2× scale and are downsampled with Lanczos, so text stays crisp even after social apps compress the video.
The viewport scrolls to keep the changed lines centered, so you can animate a single fix inside a 1,000-line file.
Requires Node.js 20 or newer. The first command downloads the headless browser used to draw frames, and you only run it once.
npm install -g diffreel
npx playwright install chromium
Or skip the global install and use npx diffreel … each time.
npx diffreel before.ts after.ts -o out.mp4
npx diffreel --git HEAD~1..HEAD --file src/app.ts -o out.mp4
npx diffreel steps.json -o tutorial.mp4 --size reel --typing
import { render } from "diffreel";
await render({
steps: [
{ code: "let total = 0;", lang: "ts", caption: "Before" },
{ code: "let total: number = 0;", lang: "ts", caption: "After" },
],
output: "out.mp4",
size: "reel",
window: true,
});
Each of these videos comes from a single command in the examples folder.
diffreel is free and MIT-licensed, built in spare time. If it saves you editing hours, a coffee keeps new features coming, including voice-over, cursor highlights and a VS Code extension.
☕ Buy me a coffeeKeeps the project alive
Your name in the README
Logo in the README and priority requests
Large logo and direct support