Black Friday deposit bonus·Top up $50+ and get $10 · Top up $100+ and get $25·Ends November 30Top up →

Put yourself in a movie scene with AI: how it works and costs

Swap a photo into a video clip with character swap at $0.10 per second. Walk through templates, inputs, outputs, and API code.

Nov 12, 2026 · 7 min read

To put yourself in a movie scene with AI, you supply a reference video clip and a clear photo of a person. The model replaces the target actor in every frame and keeps the original camera movement, scene lighting, background extras, and audio track. On Lovely Router, character swap does this at $0.10 per second of output video. A 5-second clip costs $0.50.

Consumer apps package the same workflow as mobile entertainment: upload a selfie, pick a genre like a heist or a courtroom drama, and get cast as the lead in a pre-built story. If you are building a consumer video app, an interactive marketing campaign, or a personalized greeting tool, you can run that pipeline with pre-rigged character swap templates or your own licensed footage, over a single API.

How an AI character swap video works under the hood#

This is not a 2D face paste. Older face-swap tools tracked facial landmarks and warped a flat image over the original actor's head. That breaks as soon as the actor turns in profile, walks behind an object, or the light changes, and it leaves the original hair, neck, and clothing untouched.

Modern character replacement resynthesizes the whole subject inside the scene:

  1. Pose and motion extraction. The pipeline reads the source video frame by frame and maps the target actor's skeletal pose, head rotation, eye gaze, and lip movement.
  2. Scene and occlusion masking. The model separates the target actor from the background and from foreground objects. Co-stars, props passing in front of the camera, and background extras are masked so they stay untouched.
  3. Identity conditioning. Your photo supplies facial structure, skin tone, hair, and clothing for the new character.
  4. Lighting and color synthesis. As the new character is rendered into the masked space, the model applies the scene's directional lighting, shadows, depth of field, and film grain so the subject sits in the frame.
  5. Audio passthrough. The original audio track, including room tone, music, and dialogue timing, carries over to the final MP4. If the target actor speaks, the generated character matches those lip movements.

Because the model generates a new body inside the volume of the old one, you can replace an actor in a tuxedo with a photo of yourself in a hoodie, or swap a stylized character from an image model into a live-action clip.

A raw upload flow asks people to find clips, trim them, and live with bad camera angles. A template gallery skips that cold start. The scenes are already tested for clean tracking and clear subject separation.

When you browse the character swap templates, or build a template selector in your own app, each template has four properties.

  • Template ID and preview clip. A short, single-shot sequence, typically 4 to 10 seconds: a tense diner conversation, an action walk-away, or a dramatic turn toward the camera.
  • Target character slot. If two actors are talking, the template marks which actor is replaced, or it exposes two slots so the user can swap both.
  • Framing type. Templates are tagged medium close-up, waist-up, or full-body. A medium close-up only needs a headshot. A full-body walk needs a full-body reference photo, or you let the model infer the lower outfit.
  • Duration. The length in seconds, which locks the generation cost before the user hits render.

For a user, the flow is three steps:

  1. Pick a scene from the gallery.
  2. Upload one clear photo, or generate a character portrait first.
  3. Submit the job.

Calling the character swap API#

Everything on Lovely Router—video models, image generators, web data tools, and LLMs—runs on one prepaid API key. This Python script submits a template video and a user photo to the character-swap model, polls until the job finishes, and returns the video URL.

Python
import os
import time
import json
from urllib.request import Request, urlopen

API_KEY = os.environ["LOVELY_ROUTER_API_KEY"]
BASE_URL = "https://api.lovelyrouter.com/v1"
HEADERS = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json",
}

def call_api(method, url, payload=None):
    body = None if payload is None else json.dumps(payload).encode()
    req = Request(url, data=body, headers=HEADERS, method=method)
    with urlopen(req) as resp:
        return json.load(resp)

# 1. Start the character swap job
# Character-swap video model from the catalog ($0.10 per second of output).
payload = {
    "model": os.environ["LOVELY_ROUTER_CHARACTER_SWAP_MODEL"],
    "video_url": "https://cdn.example.com/templates/heist-briefing-6s.mp4",
    "character_image_url": "https://cdn.example.com/uploads/user-selfie.jpg",
    "target_character": "primary",
}

data = call_api("POST", f"{BASE_URL}/video/generations", payload)
job_id = data["id"]
print(f"Started job: {job_id}")

# 2. Poll until the video is ready
while True:
    data = call_api("GET", f"{BASE_URL}/video/generations/{job_id}")

    if data["status"] == "succeeded":
        print(f"Finished video URL: {data['output_url']}")
        print(f"Billed duration: {data['duration_seconds']}s")
        break
    elif data["status"] == "failed":
        raise RuntimeError(f"Generation failed: {data.get('error')}")

    time.sleep(5)

To generate a custom outfit or a stylized look before the swap—medieval armor or a sci-fi spacesuit so the user matches the movie genre—pass the selfie through an image model first. gpt-image-2.5-flare is $0.04 per image. qwen-image-edit-uncensored is $0.10 per image. Use that output URL as character_image_url.

What comes back and how to evaluate quality#

The API returns a standard MP4 at the duration and aspect ratio of the source clip, with the original audio track muxed in. Before a new template goes to production, run one test render and check four places where swaps succeed or fail.

What works reliably#

Single-shot clips between 4 and 10 seconds hold up. Continuous camera motion (pans, dollies, handheld shake) tracks well because the model keeps temporal consistency across adjacent frames.

Clear subject separation helps. Scenes where the target actor stands in the foreground, with lighting distinct from the background, produce sharp edges around hair and shoulders.

Evenly lit reference photos are the safe input. A front-facing photo without heavy sunglasses, harsh shadows across the nose, or extreme wide-angle distortion gives the identity conditioner clean geometry.

Dialogue and head turns transfer. Turns up to 60 degrees, and normal conversation lip-sync, land cleanly on the new face.

What breaks or degrades output#

Hard cuts inside the source clip are the usual failure. If a 6-second clip contains three rapid camera cuts, the model has to re-establish identity and scene lighting at every cut. Split multi-shot scenes into individual shots, run each shot separately, and stitch them back together with a video editor.

Heavy foreground occlusion is next. An actor walking behind venetian blinds, thick smoke, or a crowd crossing directly in front of the lens can make the character mask flicker.

Extreme lighting shifts cause trouble too. A scene that starts in pitch darkness and then gets hit by a strobe or a flashlight beam makes it harder to keep skin tones consistent with the reference photo.

Group scenes without a clear primary subject are the last case. If four actors stand shoulder-to-shoulder at the same depth, use a pre-cropped template or a mask coordinate so the model knows which actor to replace.

To see how a new template performs, run a 3-photo test on the candidate clip: one studio headshot, one indoor phone selfie, and one angled outdoor photo. Inspect frame 1, the middle frame, and the final frame for identity drift, edge haloing around the shoulders, and lip-sync against the original audio.

What it costs per clip and in production#

Character swap is billed per second of generated video. You do not pay for failed renders, and you do not manage GPU instances or idle compute.

Here is one user session in a consumer app: an optional stylized portrait, a swap into a 6-second movie template, and an optional custom voice line from text-to-speech.

StepModel (model_id)AmountPriceCost
Pre-style user selfie (optional)GPT Image 2.5 Flare (gpt-image-2.5-flare)1 image$0.04 per image$0.0400
Character swap video renderCharacter swap video6 seconds$0.10 per second$0.6000
Custom voice dub (optional)Text-to-speech0.1 minutes (6s)$0.09 per minute$0.0090
Total per 6-second scene$0.6490

Skip the image pre-style and keep the original clip audio, and that 6-second scene costs $0.60. For an adult or unrestricted entertainment app using an unrestricted character-swap model at $0.12 per second, a 6-second clip costs 6 × $0.12 = $0.72.

For a production launch—a viral marketing campaign, a wedding proposal video builder, or a subscription mobile app—unit cost follows clip duration and volume. The table below is monthly API spend for an app generating 1,000 user videos a month. Each user averages one 5-second draft preview, one 10-second final scene, and an LLM call that writes custom scene dialogue or metadata on the same API key.

Production itemModel (model_id)Monthly volumeUnit priceMonthly cost
1,000 draft swaps (5s each)Character swap video5,000 seconds$0.10 per second$500.00
1,000 final swaps (10s each)Character swap video10,000 seconds$0.10 per second$1,000.00
1,000 outfit portraitsGPT Image 2.5 Flare (gpt-image-2.5-flare)1,000 images$0.04 per image$40.00
Scene script & prompt routing (input)Claude Haiku 5.5 (claude-haiku-5.5)2M input tokens$0.10 per 1M tokens$0.20
Scene script & prompt routing (output)Claude Haiku 5.5 (claude-haiku-5.5)1M output tokens$0.50 per 1M tokens$0.50
Total for 1,000 user runs$1,540.70

At $1,540.70 for 1,000 complete multi-step runs (a 5-second preview, a 10-second final render, an outfit image, and LLM orchestration), unit cost is $1,540.70 / 1,000 = $1.54 per user. Price a consumer credit pack or subscription tier above that floor, without surprise infrastructure bills. Full rates for video, image, audio, and text models are on the pricing page.

Run your first character swap#

Pick a scene from the character swap templates gallery, grab one prepaid API key, and run a 5-second test swap with your own photo. You should have the output in under two minutes.

Try it yourself

One prepaid key, no subscription. Every price in this article is the price you pay.

Keep reading

All articles →