Lesson 3 of 3 Image and Video Generation

Generating and Remixing Videos with Sora 2

This lesson explains how Sora 2 generates short videos with audio from text prompts and reference images, how remix changes a generated video while keeping its structure, and how asynchronous, costly generation shapes applications. The sora-2 model was retired in Foundry on 15 October 2026 with no replacement listed, but the exam guide still names Sora 2, so the concepts remain examinable.

Learning outcomes

After completing this lesson, you will be able to:

  • Start a video job with videos.create and poll for the result.
  • Anchor a video with a reference image.
  • Change a generated video with videos.remix.
  • Design applications around asynchronous generation.

Creating a video

Sora 2 (preview) was deployed in Foundry and called through the v1 videos API, the pattern the exam guide describes. videos.create starts a job with a prompt, a size (1280x720 landscape or 720x1280 portrait) and a duration in seconds (4, 8 or 12). The job moves through queued and in_progress to completed or failed; the application polls with videos.retrieve and downloads the MP4 with videos.download_content. Generated videos expire after a limited time, so they are downloaded and stored promptly.

import time
video = aoai.videos.create(
    model="sora-2",
    prompt=("Slow dolly shot of a barista pouring latte art in a sunlit cafe, "
            "warm morning light, shallow depth of field, ambient cafe sounds"),
    size="1280x720", seconds="8",
)
while video.status not in ("completed", "failed"):
    time.sleep(20)
    video = aoai.videos.retrieve(video.id)
if video.status == "completed":
    aoai.videos.download_content(video.id, variant="video").write_to_file("latte.mp4")
Put in order

The video job pattern

Exam skills 3.1.2

Put the steps of the asynchronous video job pattern in order. The exam guide names Sora 2, which retired in Foundry in October 2026.

Log in to try this activity Interactive activities are free with an account.

Reference images and prompts

An input_reference image anchors the first frame, which suits animating a product photo or keeping a brand's visual style; its resolution must match the requested size. Prompts work best when they describe one shot clearly: shot type and camera movement, subject, action, setting, lighting and sound. Sora 2 has built-in protections: it blocks photorealistic depictions of real people and protected intellectual property, and prompts and outputs pass through content filtering. Physical interactions, precise sequences of events and left-right consistency can still be imperfect, so generated videos are reviewed.

Editing generated videos with remix

videos.remix takes the ID of a completed video and a prompt that describes a change. The new video keeps the original's structure, motion and framing and applies the change, such as a different colour palette, weather or time of day. Single, specific changes preserve the original best; prompts that change many things at once behave more like a new generation. The remixed video records the source video ID, which lets an application keep a version history.

remixed = aoai.videos.remix(video_id=video.id, prompt="Same scene at dusk with warm lamp light")
True or false

Video options and remix

Exam skills 3.1.2 · 3.1.4

Check four facts about the Sora 2 video API that the exam guide describes.

Log in to try this activity Interactive activities are free with an account.

Designing for asynchronous generation

Generation takes minutes and costs more per second of output than images, and only a limited number of jobs can run at the same time. Applications therefore submit jobs from a queue-driven background worker, store job IDs with their prompts and owners, notify users when videos are ready, and limit duration and resolution to what the use case needs. Requests that are rejected by content filters are reported to the user with guidance.

The following diagram shows the queue-driven design and the states a video job passes through.

A queue-driven worker submits video jobs with videos.create, stores each job ID with its prompt and owner, and polls videos.retrieve. A job moves from queued to in_progress and then to completed or failed. Completed videos are downloaded with videos.download_content and stored promptly, because generated videos expire.
The worker, not the user's request, waits for the job. Job records let the application report status and find each user's videos, and completed videos are copied to storage before they expire.
Worked example

A marketing approval loop

A marketing team generates an 8-second product teaser, and reviewers approve its composition but ask for a winter version and an autumn version for regional campaigns.

Remix the approved video twice, once with "same scene with light snowfall" and once with "same scene with autumn leaves", so that both keep the approved camera movement and framing. Generating two new videos from modified prompts would change the composition the reviewers approved.

Check yourself

Why should video generation run in a background worker?

Show answer

Generation is asynchronous and takes time: the job is created, polled until it completes and then downloaded, so a user request should never be held open while it runs.

Exam Tips

Remember for the exam

  • Sora 2: videos.create, poll with videos.retrieve, download with videos.download_content.
  • Edit a generated video and keep its composition: videos.remix with the video ID.
  • A reference image must match the requested video size.
  • Run video jobs in background workers; never hold a user request open.