Translate
translate consumes speech audio and emits translated speech audio plus
avflow.translateText data events. It is a managed AVFlow node; jobs only need
to set the target language.
{ "name": "translator", "type": "translate", "inputs": ["speaker_audio"], "config": { "targetLanguage": "zh-CN", "echoTargetLanguage": false }}Configuration
Section titled “Configuration”| Field | Type | Required | Description |
|---|---|---|---|
targetLanguage | string | Yes | BCP-47 target language, for example zh-CN |
echoTargetLanguage | boolean | No | Allow target-language speech in the input to pass through |
Outputs
Section titled “Outputs”- Audio: translated speech.
- Data:
avflow.translateTextwithtext,kind(sourceortranslation),language, andisFinal.
Route video separately when producing an audiovisual output:
{ "name": "hls", "type": "segment", "inputs": [ "video", "translated_audio", { "name": "translator", "select": { "mediaTypes": ["data"] } } ]}Audio and video timing
Section titled “Audio and video timing”Translation requires source context, so translated speech normally trails the
source video. For audiovisual outputs that use translated audio, AVFlow applies
its managed timing policy automatically when the audio path resolves to exactly
one translate node; no extra graph node or edge is required. The output may
hold the first frame briefly while timing stabilizes.
The translated audio track appears with the first translated audio packet. It
preserves the provider’s sample rate and channel layout, and idle periods are
timestamp gaps rather than generated silence. Add an
audio_mixer when downstream components require a
continuously clocked audio stream.
The timing policy is skipped when the graph is ambiguous, such as when multiple translation nodes feed the same audio path or original and translated speech are mixed together. In those cases, split outputs or use a single translated audio path for the audiovisual output.
Small long-term drift can be corrected with bounded audio time stretching or silence insertion. It should not be corrected by repeatedly dropping video frames.