All work
P / 03 · 2025 — 2026
Case study

Media Pipeline

Long-form to short-form, automated

A Django, Celery, and RabbitMQ media pipeline that repurposes long-form video into near-ready short-form deliverables, using durable run/job/output records, artifact-first stage boundaries, delegated LLM planning, credit metering with automatic refunds, and Remotion on AWS Lambda for parallel rendering.

Product preview
(I) — The premise

Ready to post, ready in minutes.

Manual social clipping took about four weeks per campaign. This pipeline turns a two-hour podcast into 30 to 40 branded social clips in roughly one hour.

Before this, enterprises were paying editors to sit through hours of recording, find the usable moments, cut them down, reframe them vertically, and caption them by hand. The target here was not draft quality. It was near-ready output at production throughput.

The system now lands around 95% ready-to-post quality by pushing the work through sixteen cooperating stages that can fail, resume, and reuse work without losing their place.

Branded clips / run
30-40
Turnaround time
1 hr
Ready-to-post quality
95%
Time reduction
4wk→1hr
Pipeline stages
16
Parallel export
Lambda
Output

One pipeline,
unlimited styles

Three runs, three different style contracts pinned at execution time. Captions, emphasis, transitions, generated inserts, and the audio mix all change. The selection logic, the DAG, and the render path do not. This is the payoff of treating creative direction as a versioned runtime input rather than something baked into the renderer.

01
Editorial

Amber italic emphasis, restrained pacing

02
Teal Luxe

Small serif, low-contrast highlight

03
Finfluencer

All-caps, high-contrast, fast cuts

Trimmed excerpts of real pipeline output. Tap any clip to hear its audio mix, since music selection and speech ducking are part of the style contract too.

(II) — System map

Five cooperating parts.

01django + queues
Control Plane
  • Django APIs accept uploads and link imports
  • Celery + RabbitMQ drive async execution
  • Meters credits and refunds failed runs
  • Owns run state and render completion
02analysis + orchestration
Pipeline Runtime
  • Resolves the active workflow from a registry
  • Triggers stages when prerequisites are ready
  • Records job-level progress and failure
  • Delegates LLM analysis and scoring to a planning service
03short-form renderer
Render Runtime
  • Consumes prepared clip payloads
  • Renders branded vertical shorts at 1080×1920
  • Fans out exports through Remotion on AWS Lambda
  • Hands files back to product storage
04authoring + publish
Style Plane
  • Authors subtitle and overlay systems
  • Pins client-specific branding at runtime
  • Publishes immutable creative packages
  • Defines runtime-safe contracts
05durable state
State Layer
  • Run record (one per source video)
  • Job record (one per stage)
  • Output record (one per short)
  • Execution metadata + logs
(III) — DAG

Sixteen stages,
explicit edges.

Two transcode roots run in parallel: one normalizes the analysis copy, the other prepares the render source. Transcription and segment detection fan out from the first, and speaker attribution resolves before any editorial judgement happens. The planning service then scores moments for hook strength, topic completeness, quotability, and likely engagement. Preparation shifts everything to clip-local assets, with framing, protected shots, and cutout work running as separate Cloud Run jobs. Composition writes the render index. Rendering fans out through Remotion on AWS Lambda, and the analysis boundary closes before delivery does.

IngestPlanPrepareComposeRender01Transcodingnormalize02Transcriptionspeech to text03Segment Detectboundaries04Planningeditorial plan05Prepare Mediaclip-local06Enhancement Plancreative07Prepare Finalizemerge08Enhancement Buildbundle09Compositionrender index10Renderingfanoutdelegated · runs off-orchestrator, reports by callbacksimplified · 10 of 16 production stagesanalysis to delivery

Simplified. Ten of the sixteen production stages are drawn, and a few edges collapse intermediate work so the shape stays readable. Six stages are delegated: they run outside the orchestrator and report back by callback, which is why the graph has to survive a signal that never arrives.

(IV) — Records

Three lifecycles,
one spine.

The run is the top-level control object. Each stage becomes a durable job. Each rendered short becomes its own output. The tight job state model (pending, in_progress, completed, failed) keeps orchestration predictable while still allowing retries, subtree resets, and reuse of completed work.

Persistent state · three durable records01Run recordone source video being repurposedstartedanalysisanalysis-completefully generatedokdelivery failedfailcarries· execution id · workflow name· started · completed · failed ts· append-only progress logs· composition index location02Job recordone stage in the workflowpendingin_progresscompletedokfailedfailcarries· stage type · execution id· delegated platform ids· error details for recovery· artifact namespace03Output recordone rendered shortpendingrenderingrenderedokfailedfailcarries· render operation id· render bucket · namespace· progress %· final video asset ref
(V) — Artifact contract

Stages don't call,
they publish.

Each stage reads the artifacts it depends on, computes, writes new structured data or media to durable storage, and marks its job complete. The orchestrator triggers what comes next. Delegated work, retries, and reuse all fall out of that contract. Debugging becomes reading the directory.

Control Planerun recordOrchestratorworkflow graphPipeline Stagejob recordArtifact Storestructured data + mediaRender Runtimeshort-form renderer01start pipeline execution02trigger eligible stage03write stage artifacts04mark job complete05trigger dependent stage06read upstream artifacts07write composition index08trigger render fanout09write rendered shortsevery stage boundary is an artifact, not an in-memory hop
(VI) — Render fanout

Webhook or poll,
whichever wins.

The composition index spawns one render job per short. Remotion packages client branding, captions, overlays, and the audio mix into a single schema-validated props payload, then AWS Lambda fans those renders out in parallel. Each output completes on its own schedule, signalled either by an async webhook or by background polling. Finalization is modeled as a terminal-state transition so a missed callback is recovered by the poll, and a duplicate signal becomes a no-op.

Render fanout · webhook + pollingterminal-state transition · idempotentINComposition Indexone payload per short5 shortsshort 01output record · renderingshort 02output record · renderingshort 03output record · renderingshort 04output record · renderingshort 05output record · renderingwebhookpush · low-latencypollingfallback · resilientOUTFinalizecopy · publish · video recordWhichever signal arrives first wins. The other is a no-op.terminal-state transition handles the race
(VII) — Ownership

Authoring out,
production in.

The style and enhancement control plane is a separate subsystem. It authors and publishes immutable creative contracts: subtitle systems, overlays, audio treatment, and visual rules. The pipeline pins them by version at runtime. Creative quality control stays out of the production DAG.

A - AuthoringStyle Control PlaneAuthoring · Previewcreative quality controlPublish Immutableversioned · auditableB - ProductionMain PipelineControl Planerun recordWorkflow Orchestration16-stage dagPlan / Prepare / Composeclip-localRun / Job / Output statedurableC - DeliveryRender RuntimeShort-form Compositionrender bundleOutput Deliveryobject storage handoffpublishcomposition indexcompletioncreative authoring stays outside the production dag
(VIII) — Operational behavior

Reuse, rerun, recover.

Reuse of completed work
Completed jobs are first-class

The trigger layer can attach a new execution to compatible completed jobs for the same source asset and stage type. No separate cache. The orchestrator keys off completed contracts, not task invocations. Latency drops, cost drops, and the graph continues from the reused boundary.

Enhancement-only rerun
Replay from a controlled subtree

Style override reruns enter at the enhancement-planning boundary rather than at the start. That boundary and every stage below it reset to pending, the override lives in the run metadata, and downstream composition and rendering regenerate. The DAG is not just executable. It is partially replayable.

Self-healing triggers
Readiness beats notification

Every completion re-scans the whole graph for stages whose dependencies are now satisfied, not just the direct dependents of the stage that finished. A dropped notification stops being fatal, because the next completion picks up whatever it stranded. A stage sitting in progress past its plausible ceiling is treated as a dead worker and re-dispatched.

Failure boundaries
Workflow ≠ delivery

Workflow completion = analysis + composition done. Delivery completion = every output reached a terminal render outcome. Any failed required stage marks the workflow failed. Per-clip render failures roll up into delivery state, not workflow state.

(IX) — Metering

Nobody pays for a failed run.

A run costs real money the moment it starts: transcription, inference, GPU time, render minutes. So credits are reserved against the organization when the graph starts, marked successful when it completes, and refunded when it fails. The billing state lives on the same run record as everything else, which makes the whole lifecycle replay-safe: a reservation that already exists is never double-charged, and a refund that already happened is never issued twice.

The interesting part is the ordering. Marking a run failed and refunding it happens under a row lock, before any of the best-effort work like progress logging or realtime fanout. A logging outage can't leave a run stuck in processing with the customer's credits held. And the transition is guarded in both directions: a late failure arriving after a run was already billed as successful is refused, and a late success from work still in flight can't resurrect a run that already failed and refunded.

(X) — Failure points

Where it could break.

  1. 01

    Inconsistent source media

    Strange codecs, broken containers, missing audio. Transcoding has to be defensive enough that downstream stages can assume a stable input.

  2. 02

    Long jobs failing late

    An hour of analysis cannot collapse on a render error. Resumability has to live at the artifact boundary, not at the task level.

  3. 03

    Delegated stages and missed callbacks

    Six of the sixteen stages complete somewhere else and report back over the network. Polling and readiness re-scans are the safety net, so a dropped callback delays a run instead of stranding it.

  4. 04

    Money and state disagreeing

    Credits are reserved before the work happens, so every terminal transition has to be authoritative and idempotent. A duplicate signal or a late arrival must not double-charge, double-refund, or flip a settled run.

  5. 05

    Editorial drift in generated plans

    Plans can be technically valid but editorially uneven. Treating the plan as an explicit contract, with style binding and enhancement separation, keeps reruns cheap when only the creative layer needs to move.

(XI) — Outcomes

What the architecture buys.

Outcome
Four weeks down to one hour

What used to take a campaign-long editorial loop now compresses into a single processing run, because transcription, planning, preparation, and rendering all execute as resumable async stages.

Outcome
95% ready-to-post output

Candidate clips are not just cut on timestamps. They are scored for hook strength, topic completeness, and quotability, then rendered with client branding, captions, and the audio mix already applied.

Outcome
30 to 40 clips in one run

Parallel Lambda export turns per-clip rendering into fanout instead of a queue of serial renders, so dozens of outputs land in minutes rather than hours.

(XII) — Learnings

What stayed useful.

  1. 01

    Make the contract the artifact

    When stages publish to durable storage, retries, reuse, and delegated execution all become trivial. The orchestrator stops caring about who computed what.

  2. 02

    Separate clip selection from creative

    Holding clip selection and creative treatment in different stages made enhancement-only reruns possible without rebuilding the whole graph.

  3. 03

    Two completion signals beat one

    Webhooks reduce time-to-finalize on the happy path; polling survives missed callbacks. Treat finalization as a terminal-state transition and the race resolves itself.

  4. 04

    Pin creative as runtime input

    Style is not a render flag. It is a versioned contract published from a separate control plane. The pipeline pins it for consistency, auditability, and safer reruns.

Next case study
P / 04 · 2025

Tessact AI

Video ingest and analysis pipeline