2026-11-12 · 5 min read
How to add captions to gaming videos with an API
Gaming content is commentary over chaos: a streamer talking over explosions, callouts over team chatter, reactions over cutscene audio. Captions are how the commentary survives the mix, and they are half the style of gaming clips on every platform. caption.sh generates them with an API call.
Where captions fit in gaming content
- Stream highlights clipped for TikTok, Shorts, and Reels, where text carries the joke even when the audio is busy.
- Esports recaps where the caster audio is the content and the gameplay is the backdrop.
- Tutorial and guide videos where viewers follow steps on screen while listening.
- Community clips for Discord, where people watch in public without headphones.
The workflow
import requests, time
API = "https://api.caption.sh/v1"
HEADERS = {"Authorization": "Bearer YOUR_API_KEY"}
job = requests.post(
f"{API}/videos",
headers=HEADERS,
json={
"source_url": "https://your-cdn.example/stream-highlight.mp4",
"options": {
"position": "center",
"max_words": 3,
"max_lines": 2,
"caps": True,
"highlight": True,
"highlight_color": "#A3E635",
"outline_width": 2,
"max_tilt": 3,
},
},
).json()
job_id = job["job_id"]
for _ in range(120):
job = requests.get(f"{API}/jobs/{job_id}", headers=HEADERS).json()
if job["status"] in ("done", "error"):
break
time.sleep(5)
if job["status"] == "done":
r = requests.get(f"{API}/jobs/{job_id}/result", headers=HEADERS,
allow_redirects=False)
video_url = r.headers["Location"]Jobs run queued, awaiting_upload, running, then done or error; poll until a terminal status. The result endpoint answers 302, so read the Location header with redirects disabled. Results are stored for 24 hours, then deleted.
Styling for gaming clips
Gaming captions lean loud: center position so text sits over the action, caps on, three words per line, a bright highlight, a solid outline, and a small max_tilt for energy. Preview against your loudest footage, since game audio plus commentary can challenge any transcription; highlight reels with clean voice tracks caption best.
Tradeoffs and limits
- Burned-in captions cannot be toggled, resized, or translated by viewers. Keep platform captions enabled for viewers who need adjustable text.
- Game audio under the voice lowers transcription accuracy. If your edit can duck the game mix under commentary, caption that version.
- Each job covers up to 10 minutes. Long VODs should be clipped into highlights first, which is also the content that performs.
- A 429 means the transcription throughput ceiling is reached. Wait and retry rather than submitting duplicates.
- At $0.10 per minute prepaid, a 45-second highlight costs about $0.08.