Working within Aleph 2's input cap: trimming, splitting and stitching long footage
Updated 2026-10-02
VideoRouter's documentation lists runway/aleph-2 as capped at 30 seconds of input. Output length follows the input, and billing follows the input duration. Real footage is rarely that short, so the work is on your side: cut the clip before you send it, and rejoin the pieces afterwards. This page covers the cutting and joining with ffmpeg, and the mistakes that make segmented edits look inconsistent. For prompt wording, see the edit prompt patterns; for the request shape, see the editing options overview.
Know what the cap implies
Three consequences follow from the documented rules, and none of them require guessing about the model:
- Cost scales with seconds you submit. Because billing follows input duration, a 28-second clip costs more than a 6-second one. Cut to the part that needs the edit, not the whole take.
- Output matches input length. There is no duration field to shorten or extend the result.
- The input must be a public URL.
input_video_urlis a single link the host can fetch, so trimmed files have to be uploaded somewhere reachable before you submit.
If a source is just over the cap, check its real duration first; do not rely on the container's claimed length.
ffprobe -v error -show_entries format=duration -of csv=p=0 source.mp4
Option 1: trim to the part that needs editing
Often only a few seconds change, for example one shot where the weather is replaced. Cut that range and leave the rest alone.
# re-encode for frame-accurate cuts (start at 12s, take 8s)
ffmpeg -ss 12 -i source.mp4 -t 8 -c:v libx264 -crf 16 -preset medium -c:a aac trimmed.mp4
Putting -ss before -i seeks quickly and, when re-encoding, remains accurate. Stream-copying (-c copy) is faster, but it can only cut on keyframes, so the segment may start a little early or late. Use re-encoding when the cut point matters, and a high-quality setting such as the CRF above so you are not feeding the model a visibly degraded clip.
Option 2: split the whole clip into segments
If the entire clip needs the same edit, split it into pieces under the cap. Leaving a safety margin avoids a source that is a fraction over:
ffmpeg -i source.mp4 -c:v libx264 -crf 16 -preset medium -c:a aac \
-f segment -segment_time 25 -reset_timestamps 1 -force_key_frames "expr:gte(t,n_forced*25)" \
seg_%03d.mp4
Here 25 seconds is an arbitrary margin below 30. Forcing keyframes at the boundaries makes the segments land on exact lengths. Better still, split on scene cuts rather than a clock, since each segment is edited independently and a cut between shots hides any difference between neighbours. You can find scene changes with ffmpeg -i source.mp4 -vf "select='gt(scene,0.35)',showinfo" -f null - and read the timestamps from the log.
Submit the segments
import os, time, requests
API = "https://videorouter.sh/api/v1"
H = {"Authorization": f"Bearer {os.environ['VIDEOROUTER_KEY']}"}
PROMPT = "change the weather to heavy rain, keep the people and framing"
def edit(url):
j = requests.post(f"{API}/videos", headers=H, json={
"model": "runway/aleph-2", "prompt": PROMPT,
"input_video_url": url}).json()
while j["status"] not in ("completed", "failed"):
time.sleep(5)
j = requests.get(f"{API}/videos/{j['id']}", headers=H).json()
return j
# segment_urls: publicly reachable URLs of seg_000.mp4, seg_001.mp4, ...
for n, u in enumerate(segment_urls):
j = edit(u)
print(n, j["id"], j["status"])
if j["status"] == "completed":
open(f"out_{n:03d}.mp4", "wb").write(requests.get(j["data"][0]["url"]).content)
Run segments one at a time while testing; once the first two look right, you can submit the rest in parallel. Use the identical prompt for every segment. Billing happens once per job at creation, and a job that fails upstream is not billed, so retry failures individually rather than resubmitting the whole set.
Stitch the results
Create a list file and concatenate. Because every output comes from the same model with the same settings, stream copy usually works; if it does not, re-encode.
printf "file 'out_%s.mp4'\n" 000 001 002 > list.txt
ffmpeg -f concat -safe 0 -i list.txt -c copy joined.mp4
# if the join stutters or audio drifts, re-encode instead
ffmpeg -f concat -safe 0 -i list.txt -c:v libx264 -crf 16 -c:a aac joined.mp4
If the original audio matters, edits of the picture may not carry it through the way you want. Check an output file with ffprobe before you build a pipeline around that, and if needed, re-attach your source audio with ffmpeg -i joined.mp4 -i source.mp4 -map 0:v -map 1:a -c copy -shortest final.mp4.
Why segmented edits drift, and how to limit it
- Each segment is an independent generation. There is no shared state between jobs, so an edit that involves a new object (a red truck, say) can look different from one segment to the next. Prefer edits that act on the whole frame, such as weather or grading, over edits that introduce a specific object.
- Cut on shot boundaries. A difference at a hard cut reads as a normal change of shot; the same difference mid-shot reads as a glitch.
- Keep the prompt identical and the change singular. One change per request is also VideoRouter's own guidance for editing.
- Review at the seam. Watch the last second of one output and the first of the next, not just each segment on its own.
Checklist before you spend credit
- Measure the real duration with
ffprobe. - Trim to what needs the change, then split below the cap.
- Test the prompt on the shortest, most representative segment first.
- Upload segments to a URL that stays valid for the duration of the job.
- Confirm output length and audio on one result before processing the rest.
Check the model page for the current host details of runway/aleph-2, and the pricing page for the live rate; then create a key to try a short segment.
Frequently asked questions
What is the maximum input length for runway/aleph-2?
VideoRouter's documentation lists the input as capped at 30 seconds. Output length follows the input and billing follows the input duration.
How do I edit footage longer than 30 seconds?
Split it with ffmpeg into segments below the cap, ideally at scene cuts, submit each with the same prompt, then concatenate the outputs. Each segment is a separate job.
Does trimming the clip reduce the cost?
Yes, since billing follows the input duration. Cut to the part that needs the edit and avoid sending seconds you will not use.
Will every segment look consistent after the edit?
Not guaranteed. Each segment is an independent generation, so prefer whole-frame edits, cut on shot boundaries and review the seams.
Keep reading
- Editing Video with Runway Aleph 2 over API — Request Format and Limits
- Runway Gen-4.5 API Guide: Text & Image-to-Video Examples
- Runway vs Kling vs Veo API: How to Choose Between Them
- Video-to-Video Editing API Options: Aleph 2 and Alternatives
VideoRouter puts it next to dozens of other video and image models behind one API key, so you can compare providers, prices and fail over automatically. Compare providers on VideoRouter →