> ## Documentation Index
> Fetch the complete documentation index at: https://docs.videodb.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Translation and Dubbing

> Localize videos with automated dubbing and transcript translation

Dub videos into new languages or translate transcripts for subtitles. Support for 20+ languages with automated voice matching.

## Quick Example

<CodeGroup>
  ```python Python theme={null}
  import videodb

  conn = videodb.connect()
  coll = conn.get_collection()
  video = coll.get_video("m-xxx")

  # Dub video to Spanish
  dubbed = coll.dub_video(
      video_id=video.id,
      language_code="es"
  )
  dubbed.play()

  # Translate transcript to French
  video.generate_transcript()
  french_transcript = video.translate_transcript(language="fr")
  ```

  ```javascript Node.js theme={null}
  import { connect } from 'videodb';

  const conn = connect();
  const coll = await conn.getCollection();
  const video = await coll.getVideo("m-xxx");

  // Dub video to Spanish
  const dubbed = await coll.dubVideo(video.id, "es");
  await dubbed.play();

  // Translate transcript to French
  await video.generateTranscript();
  const frenchTranscript = await video.translateTranscript("fr");
  ```
</CodeGroup>

***

## Video Dubbing

Replace the audio track with AI-generated voices in another language.

<CodeGroup>
  ```python Python theme={null}
  dubbed = coll.dub_video(
      video_id=video.id,
      language_code="hi",  # Hindi
      callback_url="https://your-backend.com/webhooks/dubbing"
  )

  # Returns a new video object
  dubbed.play()
  ```

  ```javascript Node.js theme={null}
  const dubbed = await coll.dubVideo(
      video.id,
      "hi",  // Hindi
      "https://your-backend.com/webhooks/dubbing"
  );

  // Returns a new video object
  await dubbed.play();
  ```
</CodeGroup>

### Parameters

| Parameter | Type | Default | Description |
| :- | :- | :- | :- |
| `video_id` | str | required | Source video ID |
| `language_code` | str | required | Target language (ISO 639-1) |
| `callback_url` | str | None | Webhook URL when complete |

### Supported Languages

| Language | Code | Language | Code |
| :- | :- | :- | :- |
| Spanish | `es` | Hindi | `hi` |
| French | `fr` | Japanese | `ja` |
| German | `de` | Korean | `ko` |
| Italian | `it` | Chinese | `zh` |
| Portuguese | `pt` | Arabic | `ar` |
| Dutch | `nl` | Russian | `ru` |
| Polish | `pl` | Turkish | `tr` |

***

## Transcript Translation

Translate the spoken content for subtitles or text-based use cases.

### Step 1: Generate a Transcript

<CodeGroup>
  ```python Python theme={null}
  # Required before translation
  video.generate_transcript()
  ```

  ```javascript Node.js theme={null}
  // Required before translation
  await video.generateTranscript();
  ```
</CodeGroup>

### Step 2: Translate

<CodeGroup>
  ```python Python theme={null}
  # Translate to French
  french_text = video.translate_transcript(
      language="fr",
      additional_notes="Use formal tone"
  )

  print(french_text)
  ```

  ```javascript Node.js theme={null}
  // Translate to French
  const frenchText = await video.translateTranscript(
      "fr",
      "Use formal tone"
  );

  console.log(frenchText);
  ```
</CodeGroup>

### Parameters

| Parameter | Type | Default | Description |
| :- | :- | :- | :- |
| `language` | str | required | Target language (ISO 639-1) |
| `additional_notes` | str | `""` | Style guidance for translation |
| `callback_url` | str | None | Webhook URL |

### Style Guidance Examples

```python theme={null}
# Formal business content
additional_notes = "Use formal business language appropriate for corporate presentations"

# Casual content
additional_notes = "Use casual, conversational tone"

# Technical content
additional_notes = "Preserve technical terms in English where no equivalent exists"

# Marketing content
additional_notes = "Adapt cultural references for the target audience"
```

***

## Use Cases

### Global Product Launch

```python theme={null}
# Upload marketing video
video = coll.upload(url="https://example.com/product-launch.mp4")

# Create versions for key markets
languages = ["es", "fr", "de", "ja", "zh"]

for lang in languages:
    dubbed = coll.dub_video(
        video_id=video.id,
        language_code=lang,
        callback_url=f"https://backend.com/webhooks/dubbing/{lang}"
    )
```

### Educational Content

```python theme={null}
# Upload lecture video
lecture = coll.upload(url="https://example.com/lecture.mp4")
lecture.generate_transcript()

# Generate subtitles in multiple languages
for lang in ["es", "fr", "pt", "zh"]:
    translated = lecture.translate_transcript(
        language=lang,
        additional_notes="Educational content, maintain academic tone"
    )
    # Use with CaptionAsset for subtitles
```

### Customer Support

```python theme={null}
# Dub support video for regional markets
support_video = coll.get_video("m-support-tutorial")

# Create localized versions
regional_versions = {
    "LATAM": "es",
    "Brazil": "pt",
    "France": "fr",
    "Germany": "de"
}

for region, lang in regional_versions.items():
    coll.dub_video(
        video_id=support_video.id,
        language_code=lang,
        callback_url=f"https://backend.com/webhooks/{region}"
    )
```

***

## Best Practices

### Pre-Dubbing Checklist

| Check | Why |
| :- | :- |
| Clear audio | Reduces transcription errors |
| Single speaker | Better voice matching |
| Minimal background music | Cleaner dubbing result |
| Proper pacing | Allows for language expansion |

### Language Expansion

Different languages have different word counts for the same content:

| Original (English) | Expansion |
| :- | :- |
| German | +15-20% |
| French | +15-20% |
| Spanish | +10-15% |
| Japanese | -10-15% |
| Chinese | -20-30% |

Plan for this when timing is critical.

### Quality Review

After dubbing:

1. Check lip sync on close-ups
2. Verify tone matches content
3. Review technical term pronunciation
4. Test with native speakers

***

## Async Processing

Dubbing is a long-running operation. Use callbacks:

<CodeGroup>
  ```python Python theme={null}
  # Start dubbing (returns immediately when callback_url is provided)
  dubbed = coll.dub_video(
      video_id=video.id,
      language_code="ja",
      callback_url="https://your-backend.com/webhooks/dubbing"
  )

  print(f"Processing video ID: {dubbed.id}")

  # When callback_url is not provided, SDK returns video object once process is done
  dubbed = coll.dub_video(
      video_id=video.id,
      language_code="ja"
  )
  # This will wait and return the completed video object
  ```

  ```javascript Node.js theme={null}
  // Start dubbing (returns immediately when callback_url is provided)
  const dubbed = await coll.dubVideo(
      video.id,
      "ja",
      "https://your-backend.com/webhooks/dubbing"
  );

  console.log(`Processing video ID: ${dubbed.id}`);

  // When callback_url is not provided, SDK returns video object once process is done
  const dubbedSync = await coll.dubVideo(
      video.id,
      "ja"
  );
  // This will wait and return the completed video object
  ```
</CodeGroup>

### Webhook Response

When the dubbing process completes, your webhook receives:

```json theme={null}
{
  "success": true,
  "data": {
    "id": "m-dubbed-xxx",
    "collection_id": "c-xxx",
    "name": "dubbed_video",
    "extension": "mp4",
    "size": "12345678"
  }
}
```

***

## What You Can Build

<CardGroup cols={2}>
  <Card title="Video Dubbing" icon="globe" href="/examples-and-tutorials/content-factory/dubbing">
    Localize videos into multiple languages automatically
  </Card>

  <Card title="AI Voiceovers" icon="volume-2" href="/examples-and-tutorials/content-factory/voiceovers">
    Generate narration in different languages
  </Card>
</CardGroup>

***

## Next Steps

<CardGroup cols={2}>
  <Card icon="shield" title="Safety & Approvals" href="/pages/act/generative-media">
    Review workflows before publishing
  </Card>

  <Card icon="captions" title="Subtitles Guide" href="/pages/act/subtitles/subtitles-guide">
    Add styled subtitles to videos
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.