Back to Partners
Guide

Video, Audio, and Subtitle Translation API Integration Flow

Integration flows for video, audio, and subtitle translation APIs: transcription, timing, and rendering pipelines, and the orchestration patterns that turn media localization into an automated workflow.

Video, Audio, and Subtitle Translation API Integration Flow

Localizing a single 30-minute training video into eight languages means orchestrating automatic speech recognition, machine translation, subtitle formatting, and optionally text-to-speech, each handled by a different API, each with its own authentication, rate limits, and output quirks. When any step fails silently, a dropped speaker label, a mangled timestamp, a brand name the MT engine "translates" into nonsense, the entire deliverable breaks. This article walks through a production-grade integration pipeline for media localization: from raw file ingestion through ASR, MT, and final subtitle or dubbed-audio output. You'll find concrete API patterns, segmentation strategies, format handling for SRT and VTT, async job orchestration with webhooks and retries, and quality-check mechanisms that catch errors before they reach viewers.

If you’re deciding how to architect this pipeline and want to see a working reference that handles ASR/MT swaps, retries, glossaries, and artifact storage, see it in action: Schedule a technical walkthrough.

The End-to-End Media Localization Pipeline

A scalable media localization flow is a directed acyclic graph with four primary stages: Ingest β†’ ASR β†’ MT β†’ Output (subtitles or TTS). Each stage produces an intermediate artifact that feeds the next. Designing the pipeline as discrete, stateless steps connected by a job orchestrator lets you swap providers, retry individual stages, and scale horizontally. Ollang's hosted orchestration layer wires these steps together, enforces glossary and token handling, and exposes unified webhooks, retries, and artifact storage so teams don't build coordination logic from scratch.

Ingest β†’ ASR β†’ MT β†’ Subtitle/TTS: A Stage-by-Stage Overview

  1. Ingest. The source media file (MP4, WAV, MKV, etc.) is uploaded to cloud storage (S3, GCS, Azure Blob) and a job record is created. Metadata, language hint, expected speaker count, glossary ID, is attached. The orchestrator validates the file format and duration, then triggers the ASR stage.
  2. ASR (Automatic Speech Recognition). The audio track is extracted (or the full file is sent, depending on the ASR provider) and transcribed. The output is a timestamped transcript, ideally with speaker diarization. This stage is the single biggest source of downstream errors: a wrong word boundary here cascades through translation and subtitle timing.
  3. MT (Machine Translation). The transcript segments are translated while preserving timestamp alignment. Glossary terms, brand names, product names, personal names, are injected to prevent mistranslation. Placeholder tokens protect non-translatable content.
  4. Output. Translated segments are rendered into SRT or VTT subtitle files, or routed to a TTS engine for dubbed audio. Timing adjustments account for target-language expansion (German text is typically longer than English) or compression.

Each stage emits a webhook or writes to a shared job-state store so the orchestrator knows when to trigger the next step.

Why Each Stage Needs Independent Error Handling

Treating the pipeline as a monolith is tempting but fragile. ASR can time out on long files. MT can hit rate limits mid-batch. TTS can reject segments with unsupported characters. Independent error handling means:

  • Isolated retries. A failed MT call for segment 47 doesn't force re-transcription of the entire file.
  • Partial progress persistence. If the pipeline crashes, it resumes from the last completed segment, not from scratch.
  • Provider fallback. If the primary ASR engine returns low-confidence results for a specific language, a fallback provider can re-process just that stage.

Store each stage's output as an immutable artifact (a JSON transcript, a translated segment file) in your object store. This gives you an audit trail and makes debugging straightforward.

Comparing ASR APIs for Media Workflows

Choosing an ASR provider for a localization pipeline is not just about word error rate. You need timestamped word or segment boundaries, speaker labels, and content filtering, all via an API that supports async processing of files longer than a few minutes.

Diarization, Timestamps, and Profanity Filtering Across Providers

| Capability | OpenAI Whisper (API) | Google Cloud Speech-to-Text | AWS Transcribe | Azure Speech Service |

|---|---|---|---|

| Word-level timestamps | Segment-level; word-level depends on endpoint | Yes | Yes | Yes |

| Speaker diarization | Not native; add via separate stage | Yes (configurable) | Yes (configurable) | Yes (conversation transcription) |

| Profanity filtering | Not built-in | Yes (configurable) | Yes (vocabulary filters) | Yes (profanity masking) |

| Async/batch mode | File upload; async responses | Long-running async | Async transcription jobs | Batch transcription |

| Max file duration | Varies by model/endpoint | Hours (async) | Hours (async) | Hours (batch) |

| Language coverage | Dozens | Broad | Broad | Broad |

Whisper variants (the open-source model run via tools like faster-whisper, whisperX, or hosted endpoints) offer strong accuracy for many languages and allow you to add diarization via libraries such as pyannote.audio. The trade-off is that you manage infrastructure and latency yourself. The OpenAI-hosted Whisper API is simpler but lacks native diarization.

Google Cloud Speech-to-Text provides broad language support and a mature async API that returns an operation you can poll or receive via Pub/Sub.

AWS Transcribe is well-integrated with S3 workflows and offers vocabulary filters for profanity and custom terminology. Its async model writes output directly to S3.

Azure Speech Service offers real-time and batch modes, with strong diarization through its conversation transcription API. Its custom speech models can be tuned for domain-specific vocabulary.

For a localization pipeline, prioritize providers that return segment-level timestamps with confidence scores. Word-level timestamps let you build tighter subtitle cues, and confidence scores let you flag segments that need human review.

Selecting the Right MT Provider for Translated Subtitles

MT for subtitles has constraints that general document translation does not. Segments are short, context is fragmented, and timing is non-negotiable. Key evaluation criteria:

  • Glossary/terminology support. Can you force specific translations for brand names and proper nouns via the API? Google Cloud Translation (Advanced) supports glossaries natively. DeepL offers glossary endpoints. Amazon Translate supports custom terminology.
  • Formality control. For customer-facing content, controlling formal vs. informal register matters. DeepL exposes a formality parameter for supported languages.
  • Segment-level translation. The API should handle an array of short strings efficiently without requiring concatenation into paragraphs (which destroys alignment).
  • HTML/tag preservation. If you pass placeholder tokens (for example, <x id="1"/>) to protect non-translatable content, the engine must return them intact.

No single MT provider dominates across all language pairs. A common production pattern is to route by language pair: use one provider for European languages where it excels, another for CJK, and a third as a fallback.

If you’re choosing providers and want to see how a unified orchestrator routes by language pair while enforcing glossaries and tokens, get a tailored comparison: See a provider-routing demo.

Segmentation Strategies That Preserve Timing

The transcript from ASR arrives as a sequence of timestamped words or phrases. Subtitle standards impose constraints: a maximum of two lines, typical character limits per line, a minimum display duration (often around 1 second), and a maximum reading speed (often 17-21 characters per second, per the BBC Subtitle Guidelines). Translating segments that don't respect these constraints produces subtitles that flash past too quickly or overflow the screen.

Aligning Subtitle Segments with Source Timestamps

The key challenge is that translation changes segment length. A compact English subtitle may become a longer German subtitle. Your segmentation logic must:

  1. Pre-split source segments to leave headroom. If the source segment is already near the character limit, split it before translation so the translated version has room to expand.
  2. Re-time after translation. After MT, recalculate display duration based on the target-language character count and the configured reading speed. If the translated segment is too long for the available time window, either split it into two cues or extend the end timestamp (if there's a gap before the next cue).
  3. Respect sentence boundaries. Splitting mid-sentence degrades both readability and MT quality. Use punctuation and syntactic cues to find natural break points.

A practical approach is to define a max_chars_per_line and a max_lines_per_cue in your pipeline configuration, then run a post-translation reformatter that re-wraps and re-times cues.

Glossary Injection for Names, Brands, and Domain Terms

Brand names, product names, and personal names must survive translation unchanged. Two complementary approaches:

  • Provider-level glossaries. Upload a glossary to your MT provider's API. For example, Google Cloud Translation's glossary endpoint accepts a CSV or TSV mapping source terms to target terms per language pair. When you send a translation request, reference the glossary ID:

{
"sourceLanguageCode": "en",
"targetLanguageCode": "de",
"contents": ["Welcome to the Ollang platform."],
"glossaryConfig": {
"glossary": "projects/my-project/locations/us-central1/glossaries/my-glossary"
}
}

  • Placeholder tokenization. Before sending text to MT, replace protected terms with tokens (for example, __BRAND_01__), translate, then swap the tokens back. This is provider-agnostic and works even with engines that don't support glossaries. The risk is that tokens can confuse the MT model's grammar, so test carefully.

For subtitles, glossary injection is non-negotiable. A single mistranslated brand name in a product demo video undermines credibility across every market.

Handling SRT and VTT Subtitle Formats

SRT (SubRip) and WebVTT are the two dominant subtitle formats. Both are plain-text, cue-based formats, but they differ in syntax and capability.

FeatureSRTWebVTT
Cue numberingRequired (sequential integers)Optional
Timestamp formatHH:MM:SS,mmm (comma separator)HH:MM:SS.mmm (dot separator)
StylingNot officially supportedCSS-like styling, ::cue selectors
PositioningNot supportedposition, line, align attributes
HeaderNoneWEBVTT header required
Metadata/notesNot supportedNOTE blocks supported

Your pipeline should:

- Parse incoming SRT/VTT into an internal cue model (start time, end time, text lines, optional metadata).

- Translate at the cue-text level, preserving the timing metadata.

- Serialize back to the requested output format, ensuring correct timestamp separators and encoding (UTF-8 with BOM for some players).

A common bug: SRT files with Windows-style line endings (\r\n) that break parsers expecting Unix endings. Normalize line endings on ingest.

Ready to see Ollang in action?

Talk to our team about your localization goals and see how the Ollang platform fits your workflow.

Book a Demo

Async Job Orchestration, Webhooks, and Retries

Media files are large and processing is slow. A 60-minute video can take several minutes for ASR alone. Synchronous request-response patterns don't work here. Every stage of the pipeline should be asynchronous. Ollang centralizes job state (attempt counts, artifact URLs, webhook verification) to make resuming failed stages and observing pipeline health straightforward.

Designing Job State Machines

Model each localization job as a state machine:

CREATED β†’ INGESTING β†’ TRANSCRIBING β†’ TRANSLATING β†’ RENDERING β†’ COMPLETED
↓ ↓ ↓ ↓
FAILED FAILED FAILED FAILED

Each state transition is triggered by a webhook callback or a polling check. Persist the current state, the stage-specific artifact URL, attempt count, and last error in a database. This lets you:

- Resume from any failed stage without re-processing earlier stages.

- Query job status via a simple API endpoint.

- Build dashboards showing pipeline throughput and bottlenecks.

Webhook Callbacks and Retry Logic

When a stage completes, the provider (or your worker) sends a webhook to your orchestrator. A typical callback payload:

{
"job_id": "loc-2024-07891",
"stage": "transcription",
"status": "completed",
"artifact_url": "s3://media-pipeline/jobs/loc-2024-07891/transcript.json",
"metadata": {
"duration_seconds": 1847,
"detected_language": "en-US",
"speaker_count": 3,
"confidence_mean": 0.94
},
"timestamp": "2025-01-15T09:32:17Z"
}

Your webhook endpoint should:

1. Validate the payload (check a signature or HMAC if the provider supports it).

2. Acknowledge immediately with a 200 OK, do not perform processing in the webhook handler.

3. Enqueue the next stage asynchronously.

For retries, implement exponential backoff with jitter. A reasonable default: retry up to 3 times with delays of 5s, 20s, and 60s. After exhausting retries, mark the stage as FAILED and alert the operations team.

If a provider's webhook is unreliable, supplement with polling. Poll at increasing intervals (for example, 10s, 30s, 60s) and cap at a maximum wait time before declaring a timeout.

Example JSON Payloads for Job Creation and Callbacks

Job creation request (sent by your application to the orchestrator):

{
"source_file": "s3://media-pipeline/uploads/product-demo-2025.mp4",
"source_language": "en",
"target_languages": ["de", "fr", "ja", "pt-BR"],
"output_formats": ["srt", "vtt"],
"glossary_id": "gloss-enterprise-2025",
"options": {
"speaker_diarization": true,
"max_speakers": 4,
"profanity_filter": "mask",
"tts_output": false,
"quality_check": "llm_spot_check"
},
"callback_url": "https://api.example.com/webhooks/localization"
}

Stage completion callback (sent by the orchestrator to your application):

{
"job_id": "loc-2024-07891",
"stage": "translation",
"status": "completed",
"target_language": "de",
"artifact_url": "s3://media-pipeline/jobs/loc-2024-07891/de/translated_cues.json",
"term_adherence_score": 0.97,
"segments_flagged": 2,
"timestamp": "2025-01-15T09:45:03Z"
}

The segments_flagged field indicates how many segments were flagged during automated quality checks, a signal to route those segments for human review.

If you want to see how Ollang's pipeline handles job orchestration, webhook routing, and glossary management for media localization, explore our integration workflow in a live demo.

Latency and Cost Tradeoffs: Streaming vs. Batch

The choice between streaming and batch processing affects latency, cost, and architectural complexity.

When to Use Streaming ASR and MT

Streaming is appropriate for live events, webinars, earnings calls, live customer support, where subtitles must appear within seconds. Streaming ASR APIs accept audio chunks via WebSocket or gRPC and return partial transcripts incrementally. Streaming MT then translates each partial result.

The trade-offs are significant:

- Higher cost per minute. Streaming endpoints are typically priced higher than batch, and you pay for partial results that get revised.

- Lower accuracy. Without full-sentence context, both ASR and MT produce more errors. Streaming ASR may revise earlier words as more audio arrives (the "stability" problem), which causes subtitle flicker.

- Architectural complexity. You need WebSocket infrastructure, buffering logic, and a mechanism to reconcile partial and final transcripts.

When Batch Processing Wins

For pre-recorded content, training videos, marketing assets, product demos, e-learning modules, batch processing is almost always the right choice. You get:

- Higher accuracy. The ASR engine processes the full audio context. MT translates complete sentences.

- Lower cost. Batch pricing is typically cheaper, and you avoid paying for discarded partial results.

- Simpler infrastructure. Upload a file, receive a webhook when it's done. No WebSocket management.

The latency penalty (minutes instead of seconds) is irrelevant for pre-recorded content. Most enterprise localization workflows are batch.

FactorStreamingBatch
LatencySecondsMinutes to hours
AccuracyLower (partial context)Higher (full context)
Cost per minuteHigherLower
Use caseLive eventsPre-recorded media
InfrastructureWebSockets, bufferingFile upload, webhooks
Subtitle stabilityFlickering/revisionsStable final output

A hybrid approach works for some workflows: stream for a rough live preview, then run batch post-event for the final, polished subtitle file.

Quality Checks: Catching Errors Before Delivery

Automated pipelines produce output fast. They also produce errors fast. Quality checks are not optional, they're a pipeline stage.

Spot-Checking with LLM Reviewers

Large language models can serve as automated quality reviewers. After MT produces translated subtitle cues, sample a percentage (for example, every 10th cue, plus all cues flagged with low ASR confidence) and send them to an LLM with a structured prompt:

Review this subtitle translation for accuracy, fluency, and term adherence.

Source (en): "The Ollang API processes your glossary in under two seconds."
Translation (de): "Die Ollang-API verarbeitet Ihr Glossar in weniger als zwei Sekunden."
Glossary terms that must appear unchanged: Ollang, API

Return a JSON object: {"fluency": 1-5, "accuracy": 1-5, "term_adherence": true/false, "issues": ["..."]}

This is not a replacement for human review on high-stakes content, but it catches the most common failures, hallucinated translations, dropped terms, grammatical errors, at machine speed. Flag any segment scoring below your threshold for human review.

Term Adherence and Consistency Validation

Beyond LLM spot-checks, run deterministic validation:

- Glossary term presence. For every glossary term expected in a segment, verify it appears in the translation. Use case-insensitive checks and, where needed, morphological handling.

- Placeholder integrity. If you used placeholder tokens, confirm every token in the source appears in the translation.

- Subtitle constraint compliance. Verify that no cue exceeds the maximum character count, that display durations meet the minimum threshold, and that no two cues overlap in time.

- Consistency across cues. The same source term should be translated the same way throughout the file. Flag inconsistencies.

These checks run in milliseconds and catch a surprising number of issues that would otherwise reach the viewer.

FAQ

What subtitle format should I use for translated output, SRT or VTT?

If your content is delivered via web players (HTML5 <track> elements), use WebVTT. It's the W3C standard for web video, supports styling and positioning, and is natively supported by all modern browsers. If you're delivering to broadcast systems, legacy media players, or platforms like YouTube (which accepts both but historically favored SRT), SRT is the safer choice. Many pipelines generate both formats from the same internal cue model, which costs almost nothing in processing time.

How do I handle speaker diarization when my ASR provider doesn't support it natively?

If you're using a provider that doesn't return speaker labels, add diarization as a separate pipeline stage. Tools like pyannote.audio perform speaker diarization on audio files and output timestamped speaker segments. You then align these speaker segments with the ASR transcript's word-level timestamps to assign each word to a speaker. This adds processing time but gives you the speaker labels needed for multi-speaker subtitle formatting.

What's a reasonable retry strategy for ASR and MT API failures?

Use exponential backoff with jitter: start at a short delay (for example, 5 seconds), double it on each retry, and add a random jitter of up to 50% of the delay to avoid thundering-herd effects. Cap retries at 3 attempts per stage. For transient errors (HTTP 429, 500, 503), retries are appropriate. For client errors (400, 401, 403), retries won't help, fix the request. After exhausting retries, persist the failure state and route to an alert or fallback provider. Always log the full error response for debugging.

How do I manage translation quality for subtitle segments that are very short?

Short segments (2-4 words) lack context, which can degrade MT quality. Two strategies help. First, context windowing: when sending a segment to the MT API, include the preceding and following segments as context (some APIs support a context parameter; otherwise, concatenate with a delimiter and extract only the middle translation). Second, pre-merge and post-split: merge adjacent short cues into a longer segment for translation, translate, then split the result back into the original cue boundaries. This gives the MT engine more context and produces more fluent output.

Ready to see Ollang in action?

Talk to our team about your localization goals and see how the Ollang platform fits your workflow.

Book a Demo

Build Your Media Localization Pipeline with Ollang

A production media localization pipeline involves dozens of integration points, ASR providers, MT engines, subtitle formatters, TTS systems, quality validators, each with its own API contract, failure modes, and quirks. Ollang handles this orchestration as a unified platform: ingest your media, apply your glossaries, manage async jobs with built-in retries and webhooks, and deliver validated subtitle files or dubbed audio across every target language.

Book a Demo

Published on July 29, 2026