Skip to content

Export the edit as a Blender video editing project - #116

Merged
wassgha merged 2 commits into
wassgha:mainfrom
program-sam:blender-export
Oct 29, 2026
Merged

wassgha merged 2 commits into
wassgha:mainfrom
program-sam:blender-export

Conversation

@program-sam

Copy link
Copy Markdown
Contributor

Rescript can hand an edit to Resolve, Premiere, Final Cut, Pro Tools, Reaper and Samplitude, but not to Blender. This adds Blender to the Timeline export. It downloads a .blend (Blender 5.2+) that opens in the Video Editing workspace with every cut in place. It works in the browser as well as the desktop app.

How it works

  • Clips link to the original media relative to the project (//<file name>), so save the .blend next to the source. Nothing is packed and no captions are added.
  • The project is written in the browser by patching a small vendored scaffold (assets/blend/scaffold.blend; regenerate it with scripts/generate-blend-scaffold.py). This works the same way as the AAF export.
  • The 25% proxy preview is on by default. Until proxies are built, Blender previews from the original file.

Matching the rendered export

  • The timeline is laid out the way the MP4/WebM export renders it:
    • Each clip keeps exactly the frames ffmpeg's trim keeps.
    • Clips start where concat starts them, rounded to a whole frame.
    • Where a keep's audio outlasts its frames, the render holds the last frame, and a short hold strip does the same here.
  • Blender cuts audio only on whole frames. So each sound strip starts exactly on the cut (via a sub-frame sound offset) and ends on the last frame boundary before the next cut. Deleted audio is never played; at most one frame of kept audio is lost at each cut-out.
  • Blender plays a 30 fps file frame by frame in a 25 fps project, so the scene must use the source's own frame rate:
    • The rate is read from ffmpeg's stream info during the audio extraction that already runs, in both the wasm and the native path.
    • The frame-rate picker only appears for Blender when the rate can't be detected.

Testing

  • npm run test:timeline adds tests/blend-test.ts, covering frame planning, file structure, names, 1,000-clip edits and audio-only projects. When Blender is installed, the test also loads the result in Blender.
  • npm run test:ffmpeg now checks the detected frame rate.
  • End to end, I rendered the downloaded .blend in Blender 5.2.1 and compared it with rescript's own MP4 export of the same edit:
    • Every frame matches at 25, 29.97, 30 and 60 fps, on synthetic sources and on real 1080p phone footage.
    • Audio stays within half a frame of the export, with no drift.
  • Variable-frame-rate phone video is close but not frame-exact: Blender addresses movie frames by index, not by timestamp.

Created with Claude Opus 5.5 in Claude Code, reviewed by GPT-6.1-Sol.

program-sam and others added 2 commits October 26, 2026 18:15
Both engines already run ffmpeg over the file to extract audio; its input
stream line carries the video's nominal rate (tbr), which is kept per File
so exports that need the real rate don't probe again. Silent videos report
it too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds Blender (.blend, 5.2+) to the Timeline export, written in the browser by
patching a vendored scaffold. Clips link the original media next to the .blend
and are laid out the way the rendered export plays: trim's frames, concat's
clip starts rounded to whole frames, hold strips where audio outlasts the
frames, and sound strips cut on whole frames without playing deleted audio.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 26, 2026

Copy link
Copy Markdown

@program-sam is attempting to deploy a commit to the wassgha's projects Team on Vercel.

A member of the Team first needs to authorize it.

@wassgha
wassgha merged commit d53a4f9 into wassgha:main Oct 29, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants