tool In Development

Drifter

Frame-iterative AI video generation. Style from image. Motion from music.

Published

January 15, 2025

Tech Stack

Cloudflare Workers Cloudflare Workflows Cloudflare D1 Cloudflare R2 RunPod Python RIFE

Key Highlights

  • Frame-by-frame generation with dual-anchor style coherence
  • Audio-reactive motion synced to beat, onset, and section boundaries
  • Sustain/stab prompt layers powered by Grimoire vocabulary
  • Semantic editing replaces strength-based denoising
  • Built for VJs, music producers, and anyone who wants AI visuals that move with sound

Overview

Frame-iterative AI video generation. Feed it a reference image and a music track; it builds video frame by frame, drifting through styles while staying anchored to your original aesthetic. The spiritual successor to Deforum, rebuilt on semantic editing.

Overview

Every AI video tool works the same way: type a prompt, wait, get a clip. Drifter works differently. It builds video one frame at a time, where each frame is a semantic edit of the one before it, guided by your reference image and (optionally) synced to your music.

The concept comes from Deforum, the open-source tool that pioneered frame-iterative generation using Stable Diffusion. Deforum proved that feeding each generated frame back into the model as input for the next frame produces something closer to directed animation than to generated video. The catch was drift. Every iteration degrades the image slightly, and after a few hundred frames you’re left with artifacts and noise. Deforum’s answer was denoising: brute-force correction that traded coherence for stability.

Drifter takes a different approach. Instead of fighting degradation with noise, it uses semantic editing models that understand what the image contains and change its meaning through natural language instructions. Two anchors keep the output stable: the original reference image (frame zero) rides along on every single API call as a persistent style reference, and the previous frame provides content continuity. The instruction layer tells the model what to change and how aggressively, controlled by a custom curve system that maps intensity over time.

The result is video that drifts through styles without losing its identity. Think of it as stop-motion animation where each frame is an AI interpretation of the last, held together by your original image as a north star.

System Features

Frame Loop Engine

The core loop is simple: take the previous frame, apply an affine transform (zoom, pan, rotate) to simulate camera movement, then send it to a semantic edit model along with the original reference image and a natural language instruction. The model returns a new frame. Repeat.

What makes it interesting is the dual-anchor pattern. The original reference image (frame zero) is passed in the image array on every iteration, not just the first. This gives the model a persistent style target to reference, so drift accumulates in the content layer while the aesthetic stays anchored to your starting point.

Weird Curve System

The weird curve controls how aggressively the instruction layer pushes transformation at each frame. Low values produce subtle, barely perceptible shifts. High values produce dramatic, forceful changes.

The curve is a cosine-to-power expression with configurable sharpness: broad dips create stability windows where the image holds steady, sharp spikes create moments of rapid transformation. When synced to audio, the energy envelope can modulate the curve amplitude, so loud sections push harder and quiet sections drift gently.

Motion presets package these curves into ready-to-use configurations. Tunnel creates a continuous push-in with slow rotation. Pulse syncs pops to the beat grid. Drift barely moves at all. Chaos randomizes everything.

Sustain/Stab Layers

Two independent prompt layers control what the model sees beyond the core instruction.

The sustain layer is stable vocabulary extracted from your reference image via StyleFusion’s IR extraction pipeline, then enriched by the Grimoire knowledge graph. It describes your subject, your style, your palette. It stays active for the entire render, keeping the model grounded in what your image actually is.

The stab layer is periodic injections: specific creative atoms fired at scheduled intervals, synced to audio transients or a fixed cadence. These counteract drift entropy by reinforcing style coherence at regular intervals. When the beat hits, the prompt gets a fresh injection of vocabulary from the Grimoire’s arrangement system.

Waypoint System

For longer videos, waypoints let you define a sequence of destination images. The video travels toward each one, passes through it, and continues to the next. Three advance modes control the pacing: audio section boundaries (musically natural), fixed frame counts (predictable), or CLIP embedding similarity (organic, the video advances when it looks close enough to the target).

How It’s Built

Drifter runs on the same Cloudflare edge stack as every HobFarm project. The user-facing system (config UI, job management, prompt composition) is a Cloudflare Worker. The frame loop itself runs as a Cloudflare Workflow, which handles long-running operations that would exceed a Worker’s 30-second CPU limit: a 3-minute video at 6fps generation rate means 1,080 sequential API calls.

Each frame is generated by a RunPod public endpoint running a semantic edit model (Seedream 4.0 Edit at the default tier). Frames are written to R2 immediately after generation, then assembled into final video with ffmpeg and RIFE interpolation. RIFE fills in the gaps between generated frames, so you can generate at 6fps and display at 24fps for a 4x cost reduction.

The Grimoire integration follows the same pattern as StyleFusion: atoms are indexing signals, not raw text in prompts. The knowledge layer outputs prompt-ready vocabulary directly, matched to your reference image’s style profile through harmonic scoring.

Project Status

Drifter has a complete architecture and a detailed build plan, but no running code yet. The core hypothesis (that passing frame zero as a persistent reference on every iteration holds style coherence over 300+ frames of semantic editing) needs to be empirically tested before committing to the full build.

The other open question is cost. Frame-iterative generation means one API call per generated frame. A 30-second clip at 6fps generation rate is 180 API calls; a 5-minute video is 1,800. At Seedream’s $0.027 per frame, that’s roughly $5 for a short clip or $50 for a full song. RIFE interpolation cuts this by 75%, but it’s still meaningfully more expensive than a single video model call. The tradeoff is creative control: you get frame-level direction, music sync, and style waypoints that no current video model offers.

Phase 1 (prove the loop works) is next on the build queue. A Python test script running manual RunPod calls against a single style reference, measuring whether the dual-anchor pattern actually holds over 300 frames.

System Features

Frame Loop Engine

Takes the previous frame, applies an affine transform for camera movement, then sends it to a semantic edit model alongside the original reference image and a natural language instruction. The dual-anchor pattern passes frame zero on every iteration, so drift accumulates in content while aesthetics stay locked to your starting point.

Weird Curve System

A cosine-to-power expression with configurable sharpness that controls how aggressively the instruction layer pushes transformation at each frame. When synced to audio, the energy envelope modulates curve amplitude: loud sections push harder, quiet sections drift gently. Motion presets package these into configurations like Tunnel, Pulse, Drift, and Chaos.

Sustain/Stab Layers

Two independent prompt layers. The sustain layer is stable vocabulary extracted from your reference image via StyleFusion and enriched by the Grimoire knowledge graph, active for the entire render. The stab layer fires periodic creative atoms synced to audio transients, reinforcing style coherence when the beat hits.