164 lines
5.2 KiB
Markdown
164 lines
5.2 KiB
Markdown
|
|
# Skill: Video Generation with OpenAI Sora 2
|
||
|
|
|
||
|
|
Generate trailer clips, gameplay-style footage, and cinematic sequences using OpenAI's Sora 2 API. This skill covers the API workflow, prompting patterns, and cost management for game development use.
|
||
|
|
|
||
|
|
## Overview
|
||
|
|
|
||
|
|
Sora 2 generates 5-20 second video clips from text prompts or still images. For game studios, it's useful for:
|
||
|
|
|
||
|
|
- Trailer pre-visualisation (storyboard frames as video)
|
||
|
|
- Marketing clips before the game is playable
|
||
|
|
- Concept videos to test art direction
|
||
|
|
- Social media content
|
||
|
|
|
||
|
|
## Prerequisites
|
||
|
|
|
||
|
|
- OpenAI API key with Sora access
|
||
|
|
- Set `OPENAI_API_KEY` environment variable
|
||
|
|
|
||
|
|
## API Reference
|
||
|
|
|
||
|
|
### Create a video
|
||
|
|
|
||
|
|
```bash
|
||
|
|
curl -X POST "https://api.openai.com/v1/videos/generations" \
|
||
|
|
-H "Authorization: Bearer $OPENAI_API_KEY" \
|
||
|
|
-H "Content-Type: application/json" \
|
||
|
|
-d '{
|
||
|
|
"model": "sora-2",
|
||
|
|
"prompt": "Your prompt here",
|
||
|
|
"size": "1920x1080",
|
||
|
|
"duration": 10,
|
||
|
|
"n": 1
|
||
|
|
}'
|
||
|
|
```
|
||
|
|
|
||
|
|
Response includes a generation ID. Video generation takes 2-10 minutes.
|
||
|
|
|
||
|
|
### Check status
|
||
|
|
|
||
|
|
```bash
|
||
|
|
curl "https://api.openai.com/v1/videos/generations/{generation_id}" \
|
||
|
|
-H "Authorization: Bearer $OPENAI_API_KEY"
|
||
|
|
```
|
||
|
|
|
||
|
|
Poll until `status` is `"completed"`. The response includes a download URL.
|
||
|
|
|
||
|
|
### Download
|
||
|
|
|
||
|
|
```bash
|
||
|
|
curl -o output.mp4 "{video_download_url}"
|
||
|
|
```
|
||
|
|
|
||
|
|
### Image-to-video
|
||
|
|
|
||
|
|
Animate a still image:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
curl -X POST "https://api.openai.com/v1/videos/generations" \
|
||
|
|
-H "Authorization: Bearer $OPENAI_API_KEY" \
|
||
|
|
-H "Content-Type: application/json" \
|
||
|
|
-d '{
|
||
|
|
"model": "sora-2",
|
||
|
|
"prompt": "Camera slowly pulls back, revealing the full village. Waves lap at the shore.",
|
||
|
|
"image": "{base64_or_url_of_image}",
|
||
|
|
"size": "1920x1080",
|
||
|
|
"duration": 5
|
||
|
|
}'
|
||
|
|
```
|
||
|
|
|
||
|
|
This is powerful for animating your generated concept art or key art frames.
|
||
|
|
|
||
|
|
## Models
|
||
|
|
|
||
|
|
| Model | Quality | Speed | Cost |
|
||
|
|
|-------|---------|-------|------|
|
||
|
|
| `sora-2` | High | 2-5 min | ~$0.10-0.20/clip |
|
||
|
|
| `sora-2-pro` | Highest | 5-10 min | ~$0.50-1.00/clip |
|
||
|
|
|
||
|
|
Use `sora-2` for iteration and pre-vis. Use `sora-2-pro` for final trailer clips only.
|
||
|
|
|
||
|
|
## Prompting for Game Trailers
|
||
|
|
|
||
|
|
### Structure
|
||
|
|
|
||
|
|
```
|
||
|
|
[Camera movement] + [Subject action] + [Environment] + [Lighting/mood] + [Style]
|
||
|
|
```
|
||
|
|
|
||
|
|
### Example: Opening shot
|
||
|
|
|
||
|
|
```
|
||
|
|
Slow aerial drone shot descending toward a cluster of thatched-roof huts
|
||
|
|
on a tropical island shoreline. Crystal clear turquoise water, white sand
|
||
|
|
beach, palm trees swaying gently. Golden hour sunlight, long shadows.
|
||
|
|
Stylised 3D game engine quality, warm colour palette. No text overlays.
|
||
|
|
```
|
||
|
|
|
||
|
|
### Example: Character reveal
|
||
|
|
|
||
|
|
```
|
||
|
|
Medium shot of a young Polynesian woman standing on a cliff edge, looking
|
||
|
|
out over an ocean dotted with volcanic islands. Wind blowing her hair.
|
||
|
|
She turns to face the camera with a calm, determined expression. Sunset
|
||
|
|
light behind her. Stylised 3D render, game cinematic quality.
|
||
|
|
```
|
||
|
|
|
||
|
|
### Example: Action sequence
|
||
|
|
|
||
|
|
```
|
||
|
|
Wide shot of three outrigger canoes racing across open ocean toward a
|
||
|
|
volcanic island. Waves crashing, spray in the air. Warriors paddling
|
||
|
|
in unison. Storm clouds building on the horizon. Dynamic camera
|
||
|
|
tracking the lead canoe. Stylised game engine quality.
|
||
|
|
```
|
||
|
|
|
||
|
|
## Cultural Guardrails
|
||
|
|
|
||
|
|
If your game draws from real cultures, set explicit rules:
|
||
|
|
|
||
|
|
- **No anachronistic elements** (modern objects, wrong architectural styles)
|
||
|
|
- **Research your references** --- use authentic building styles, clothing, tools
|
||
|
|
- **Avoid stereotypes** --- specific cultural elements, not generic "exotic"
|
||
|
|
- **No sacred symbols used decoratively** without understanding their meaning
|
||
|
|
|
||
|
|
## Workflow for Trailer Storyboards
|
||
|
|
|
||
|
|
1. **Write the storyboard** --- list each shot with description, duration, and camera movement
|
||
|
|
2. **Generate key frames** using image generation (see [Image Generation skill](image-generation.md))
|
||
|
|
3. **Animate key frames** using Sora 2's image-to-video
|
||
|
|
4. **Generate original clips** for shots that don't need a specific starting frame
|
||
|
|
5. **Review and iterate** --- regenerate clips that don't match the vision
|
||
|
|
6. **Compile** in a video editor (DaVinci Resolve, Premiere, etc.)
|
||
|
|
|
||
|
|
## Cost Management
|
||
|
|
|
||
|
|
| Scenario | Estimated Cost |
|
||
|
|
|----------|---------------|
|
||
|
|
| 1 test clip (sora-2, 5s) | ~$0.10 |
|
||
|
|
| 10-clip exploration session | ~$1.00 |
|
||
|
|
| 20-clip trailer storyboard | ~$2-4 |
|
||
|
|
| Final 5-clip trailer (sora-2-pro) | ~$2.50-5.00 |
|
||
|
|
|
||
|
|
**Tips:**
|
||
|
|
- Use `sora-2` (not pro) for all iteration
|
||
|
|
- Keep clips to 5-10 seconds --- shorter clips have better coherence
|
||
|
|
- Generate 2-3 variants per shot and pick the best
|
||
|
|
- Only use `sora-2-pro` for the final selected shots
|
||
|
|
|
||
|
|
## Common Mistakes
|
||
|
|
|
||
|
|
| Mistake | Fix |
|
||
|
|
|---------|-----|
|
||
|
|
| Overly long prompts | Keep under 200 words. Focus on what's visible. |
|
||
|
|
| Requesting specific text/UI | Sora can't render readable text. Add text in post. |
|
||
|
|
| Not specifying art style | Always end with style direction ("stylised 3D", "game engine quality") |
|
||
|
|
| Using sora-2-pro for iteration | Expensive and slow. Use sora-2 until you're happy with the prompt. |
|
||
|
|
| Ignoring cultural accuracy | Set guardrails before generating. Review outputs for stereotypes. |
|
||
|
|
| Not tracking costs | Log every generation with model, duration, and cost. |
|
||
|
|
|
||
|
|
## Related Skills
|
||
|
|
|
||
|
|
- [Image Generation](image-generation.md) --- create key frames to animate with Sora
|
||
|
|
- [Concept Art Pipeline](concept-art-pipeline.md) --- character and asset design workflow
|