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.
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.
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.
Amber italic emphasis, restrained pacing
Small serif, low-contrast highlight
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Strange codecs, broken containers, missing audio. Transcoding has to be defensive enough that downstream stages can assume a stable input.
An hour of analysis cannot collapse on a render error. Resumability has to live at the artifact boundary, not at the task level.
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.
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.
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.
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.
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.
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.
When stages publish to durable storage, retries, reuse, and delegated execution all become trivial. The orchestrator stops caring about who computed what.
Holding clip selection and creative treatment in different stages made enhancement-only reruns possible without rebuilding the whole graph.
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.
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.
Video ingest and analysis pipeline