This pipeline turns a long recording of people talking into vertical clips for short-form feeds. It transcribes the recording, finds its camera cuts and faces, asks Gemini to choose the moments that stand on their own, and renders each moment at 1080×1920 with a title, word-by-word captions and a crop that follows the speaker.
The example ran on a 23-minute NASA news conference and made four clips. See them beside the other examples in the pipeline examples.
Factory selected the moments from NASA footage and wrote the titles and captions.
moments step is an llm step. Editframe enables pipelines, and llm steps, for an organization after you tell us about your footage.What it produces
- One MP4 for each moment the
momentsstep chose, named after the moment, as a file in your organization. Theclipsstep's output lists each render'sname,status,output_file_idandoutput_url. - The
momentsstep's answer: for each clip, its span in the recording, a title, the speaker, why it works, the shots of its 9:16 framing, corrections of misheard words and the filler trims to cut. The schema below asks for three to five clips; the instructions ask for four. - The transcript, cuts and face tracks, which your application can read by namespace like any step output.
- Playback URLs for the clips from the
publishstep.
The pipeline
This is the example's pipeline.json, step by step. A step starts when the steps in its needs have finished, so after probe the transcript, frames and cuts are prepared at the same time. The long instructions and output.schema of the llm step are shown below it.
probe
Reads the recording's duration, frame size and tracks.
{ "probe": { "type": "probe" } }transcript
Transcribes every word with its start and end time.
{ "transcript": { "type": "transcribe", "needs": ["probe"] } }frames
Takes a frame every second.
{ "frames": { "type": "sample_frames", "needs": ["probe"] } }scenes
Finds the camera cuts.
{ "scenes": { "type": "detect_scenes", "needs": ["probe"] } }faces
Finds the faces in the frames and follows each one across them.
{
"faces": {
"type": "detect_pii",
"needs": ["frames"],
"with": { "speech": [], "faces": "all" }
}
}moments
Gemini watches the video with its transcript and cuts and chooses the clips: each one's span, title, framing, word corrections and filler trims.
{
"moments": {
"type": "llm",
"needs": ["transcript", "scenes"],
"with": {
"provider": "google",
"model": "gemini-4-hydrogen",
"attach_video": true,
"max_input_tokens": 1000000,
"include": ["transcript", "scenes"],
"instructions": "…",
"output": { "mode": "json", "schema": "…" }
}
}
}Instructions of moments
You are a senior social video editor cutting a long news conference into vertical clips for
short-form platforms. Watch and listen to the whole video and read its transcript (speech.word
annotations carry each word's start_ms and end_ms, and speech.untranscribed annotations mark
speech heard between words that the transcript leaves out, such as fillers, stutters and false
starts, with a rough spelling as text) and its camera cuts (scene.cut annotations at each cut's
start_ms).
Choose the 4 strongest moments. A strong moment is self-contained (a viewer with no context
understands it), opens with a hook in its first 3 seconds (start on the line that carries the
idea, not on the speaker repeating the question or hedging, such as "there's not really any one
thing"), has one clear idea or story, ends on a complete sentence that lands the idea rather
than a trailing hedge such as "but nothing really big", and is 25 to 55 seconds long. Prefer
vivid personal stories, surprising facts, humour and emotion over procedure, introductions,
thanks and logistics. Skip the moderator's housekeeping and questions unless the question is
needed to understand the answer. Skip moments where another voice talks over the speaker, such
as a phone line or an off-microphone question. Moments must not overlap.
For each moment:
- start_ms and end_ms: word times follow the speech in the audio, so a pause shows as a gap
between one word's end_ms and the next word's start_ms. Start at the start_ms of the first
word of a sentence that follows a pause (a gap of at least 300 ms after the previous word's
end_ms) or a change of speaker, after any false start or filler, including
speech.untranscribed ones, so the clip opens on that word. Open on the first sentence with
substance, not on an acknowledgement such as "Great question" or on hedging. Listen to the
opening: recognition can write a filler such as "um" as a word, so make sure the first word
you hear starts a sentence. Then check the first few words of each clip you chose: when the
speaker begins a phrase and abandons it to restart, as in "I definitely, the best part was",
move start_ms to the first word of the restarted phrase. When a scene.cut falls less than 1000
ms after that start_ms, start at the cut instead if no word starts before it, so the clip does
not open on a flash of the previous camera angle. End on a sentence followed by a pause, where
the speaker's voice falls to close the thought, not partway through a list, 700 ms after its
last word's end_ms, or 150 ms before the next word's start_ms if that is sooner. Never cut
mid-word or mid-sentence.
- name: a short lowercase slug such as clip-1-first-flight.
- title: a hook of at most 60 characters that makes someone stop scrolling, in sentence case,
true to what is said and to the speaker's own tone (never stronger than the speaker's words: a
mild annoyance is not a crisis), claiming only what the speaker says happened, so something
they imagined, heard about or watched on a screen never becomes something they saw or did,
promising only what the clip delivers (a title that opens with How or Why needs a clip that
explains how or why), without quotation marks or hashtags. Do not attribute it to NASA.
- speaker: who speaks, as described on screen or in the conference (role if the name is not
shown).
- why: one sentence on why this moment works.
- shots: the framing for a 9:16 crop of the 16:9 video, back to back from start_ms to end_ms.
Start a new shot at each scene.cut and whenever the active speaker changes. For each shot give
layout "crop" when one person fills the view or one person speaks; then focus_x and focus_y
are the horizontal and vertical centre of the active speaker's face as fractions of the frame
width and height (0 to 1), which the crop moves onto the nearest detected face, and zoom 1
shows the full frame height (use 1 to 1.4; 1.2 for a wide table shot). Use layout "fit" for a
wide shot with several people where nobody can be cropped well, and for graphics or slides.
Shots shorter than 1500 ms are not allowed unless the camera cuts.
- corrections: the clip's captions are the transcript's words from start_ms to end_ms. List the
words recognition got wrong there, judged by what you hear and by names shown on screen: heard
is one transcript word exactly as written, start_ms is that word's start_ms, and said is what
was spoken in place of that word: the right word, or several words where recognition merged or
dropped them there (such as "at it" heard as "added"); never repeat words the transcript
already has beside it. List each wrong occurrence; a correction changes only the word at its
start_ms. Leave it empty when the transcript is right.
- edit: the clip as an editor marks up its transcript: every speech.word from start_ms to
end_ms, in order and spelt exactly as the transcript writes it (corrections fixes recognition
errors), with each span a short-form editor would cut wrapped in square brackets, as clipping
tools remove filler words. Listen to the clip word by word as you write it. Bracket false
starts and restarted phrases ("[I definitely,] the best part was"), self-corrections (the
words the speaker takes back, so "on [Saturday, or] Friday night" plays "on Friday night"),
stutters, repeated words and cut-off starts of words ("[I] I think", "take a [t-] corner"),
fillers such as um, uh and filler "like" or "you know", and hedging that delays the point.
Where you hear a filler, stutter or false start that the transcript has no word for, such as a
speech.untranscribed span, write what you hear in brackets between the words it falls between,
as in "one day, [uh] a friend". Recognition sometimes writes a filler "uh" as the word "a":
bracket that word when you hear "uh". Keep at least a second of speech between two cuts, since
jump cuts closer together read as a twitch: when the words between two cuts belong to the same
false start or hedge, bracket them together, as in "And for me, [like it was, um, I don't
know, like] trying to pack", and otherwise leave the smaller filler in. Never bracket a word
the sentence needs, and bracket every word of an abandoned phrase, including one it leaves
dangling, such as an "either" with no "or": the words outside brackets, read on their own,
must be fluent, complete sentences in the speaker's own words, meaning and tone. Never add,
reorder or reword words outside brackets. The template shortens long pauses on its own.Output schema of moments
{
"type": "object",
"properties": {
"clips": {
"type": "array",
"minItems": 3,
"maxItems": 5,
"items": {
"type": "object",
"properties": {
"name": { "type": "string" },
"title": { "type": "string" },
"speaker": { "type": "string" },
"why": { "type": "string" },
"start_ms": { "type": "integer", "minimum": 0 },
"end_ms": { "type": "integer", "minimum": 0 },
"shots": {
"type": "array",
"minItems": 1,
"maxItems": 40,
"items": {
"type": "object",
"properties": {
"start_ms": { "type": "integer", "minimum": 0 },
"end_ms": { "type": "integer", "minimum": 0 },
"layout": { "type": "string", "enum": ["crop", "fit"] },
"focus_x": { "type": "number", "minimum": 0, "maximum": 1 },
"focus_y": { "type": "number", "minimum": 0, "maximum": 1 },
"zoom": { "type": "number", "minimum": 1, "maximum": 2.5 }
},
"required": ["start_ms", "end_ms", "layout", "focus_x", "focus_y", "zoom"]
}
},
"corrections": {
"type": "array",
"maxItems": 20,
"items": {
"type": "object",
"properties": {
"heard": { "type": "string" },
"start_ms": { "type": "integer", "minimum": 0 },
"said": { "type": "string" }
},
"required": ["heard", "start_ms", "said"]
}
},
"edit": { "type": "string" }
},
"required": [
"name",
"title",
"speaker",
"why",
"start_ms",
"end_ms",
"shots",
"corrections",
"edit"
]
}
}
},
"required": ["clips"]
}clips
Renders each chosen clip at 1080×1920 with the social clip template.
{
"clips": {
"type": "render",
"needs": ["moments", "faces"],
"with": {
"template_id": "template:social-clip",
"for_each": "moments.metadata.clips",
"include": ["transcript", "scenes", "faces"],
"width": 1080,
"height": 1920,
"context_ms": 1000
}
}
}publish
Returns playback URLs for the clips.
{ "publish": { "type": "publish", "needs": ["clips"] } }How the template uses the step outputs
The clips step renders the social clip template once for each item of moments.metadata.clips (for_each). Each render receives RENDER_DATA with the input file in source, the clip in item, its position in index and the outputs of the steps in include: transcript, scenes and faces. Because each item has start_ms and end_ms, the render receives only the annotations that overlap the clip, and context_ms: 1000 adds those within a second either side, so the template can place the clip's first and last cut on the speech around it.
var data = window.RENDER_DATA || {};
var clip = data.item || {};
var source = data.source || {};
var steps = data.steps || {};
var annotationsOf = function (namespace, kind) {
var output = steps[namespace] || {};
return (Array.isArray(output.annotations) ? output.annotations : []).filter(function (annotation) {
return annotation.kind === kind;
});
};
var cuts = annotationsOf("scenes", "scene.cut");
var spokenWords = annotationsOf("transcript", "speech.word");
var unheard = annotationsOf("transcript", "speech.untranscribed");
var faces = annotationsOf("faces", "pii.face");From these the template:
- plays the clip's span of the input with
ef-videoelements whosefile-idissource.file_id, one for each shot, withsourceinandsourceoutin source time; - cuts out the clip's
trimsand thespeech.untranscribedspans spelt as fillers, such as "um", and closes the gaps; - crops each
cropshot onto thepii.facetrack nearest the shot'sfocus_xandfocus_y, and showsfitshots whole; - writes the captions from the
speech.wordannotations in the clip, with the clip'scorrectionsapplied, in chunks of up to five words, lighting each word as it is spoken; - shows the clip's
titlein a band above the picture, a footage credit and a progress bar.
The template is templates/social-clip.html, and templates/social-clip.schema.json describes the data it receives.
Run it
The example lives in elements/examples/social-clips/ in the Editframe repository: pipeline.json, the template in templates/, sources.json with each source's download URL, licence and attribution, example.json with the pipeline's name and the items to run, and rubric.md, the criteria its output is judged by. From the repository root, with an API key of an organization that has pipelines and llm steps enabled:
export EDITFRAME_TOKEN="$EDITFRAME_API_KEY"
node elements/examples/scripts/run-example.mjs social-clipsThe script reads example.json, which names the pipeline example-social-clips and runs one item, the Loral O'Hara news conference. It registers each template the definition names as template:<name>, from templates/<name>.html and its .schema.json, through POST /api/v1/pipelines/templates, and replaces the reference with the template's ID; the API itself accepts only template IDs. It finds the pipeline by name or creates it, adds a version when the definition changed, and starts a group with one run per item, which reads the item from its download URL. Running the same version and items again returns the earlier group unless you pass --fresh; --items runs other items of sources.json, such as the Crew-9 news conference.
The script waits for the runs and saves their results under ~/.cache/editframe/example-runs/social-clips/<group-id>/: summary.json with the definition the runs used, and for each item run.json, outputs/<namespace>.json and media/<file>.mp4. Requests go to EDITFRAME_HOST, https://editframe.com by default.
To change the template without running the pipeline again, render it on a saved run's outputs with node elements/examples/scripts/render-template.mjs social-clips social-clip --data <data.json>, where <data.json> is the RENDER_DATA a render would receive.
Licences
- NASA (JSC) · Loral O’Hara post-flight news conference · NASA media guidelines · No NASA endorsement.