← Back to Home

How to Render and Process Large Videos with E2B and R2 from Cloudflare Workers

Updated March 5, 2026
cloudflare workerse2br2video renderingmultipart upload

Large-video Rendering Pattern

Workers have strict memory/runtime limits, so run heavy render/extract work in E2B and stream outputs to R2.

Render Flow

  1. Fetch script + assets metadata from D1.
  2. Send render input to E2B sandbox (Remotion or Python path).
  3. Upload output to R2 using multipart/chunked transfer.
  4. Persist rendered_video asset row.
  5. Post-process highlight clips and persist shorts rows.

Memory-safe Rules

Highlight Post-processing

Failure Isolation

Render can still complete even if highlight extraction fails. Record short-level failures instead of failing the entire render stage.