> ## 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.

# Generative Media Overview

> Generate media assets programmatically: images, music, sound effects, voices, and video clips. Translate and dub existing content into new languages.

## Capabilities

| Category         | What You Can Create                     |
| :--------------- | :-------------------------------------- |
| **Images**       | Text-to-image with aspect ratio control |
| **Audio**        | Music, sound effects, text-to-speech    |
| **Video**        | Short AI-generated clips (5-8 seconds)  |
| **Localization** | Dubbing, transcript translation         |

## Quick Example

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

  conn = videodb.connect()
  coll = conn.get_collection()

  # Generate an image
  image = coll.generate_image(
      prompt="Futuristic city skyline at sunset",
      aspect_ratio="16:9"
  )
  print(image.generate_url())

  # Generate a voiceover
  voice = coll.generate_voice(
      text="Welcome to our product demo",
      voice_name="Sarah"
  )

  # Dub a video to Spanish
  dubbed = coll.dub_video(
      video_id="m-xxx",
      language_code="es"
  )
  ```

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

  const conn = connect();
  const coll = await conn.getCollection();

  // Generate an image
  const image = await coll.generateImage(
      "Futuristic city skyline at sunset",
      "16:9"
  );
  console.log(await image.generateUrl());

  // Generate a voiceover
  const voice = await coll.generateVoice(
      "Welcome to our product demo",
      "Sarah"
  );

  // Dub a video to Spanish
  const dubbed = await coll.dubVideo("m-xxx", "es");
  ```
</CodeGroup>

***

## Cheat Sheet

<CodeGroup>
  ```python Python theme={null}
  # Image
  coll.generate_image(prompt, aspect_ratio='1:1', callback_url=None)

  # Music
  coll.generate_music(prompt, duration=5, callback_url=None)

  # Sound Effect
  coll.generate_sound_effect(prompt, duration=2, callback_url=None)

  # Voice
  coll.generate_voice(text, voice_name='Default', config={}, callback_url=None)

  # Video
  coll.generate_video(prompt, duration=5, callback_url=None)

  # Dub
  coll.dub_video(video_id, language_code, callback_url=None)

  # Translate
  video.translate_transcript(language, additional_notes='', callback_url=None)
  ```

  ```javascript Node.js theme={null}
  // Image
  await coll.generateImage(prompt, '1:1', null);

  // Music
  await coll.generateMusic(prompt, 5, null);

  // Sound Effect
  await coll.generateSoundEffect(prompt, 2, null);

  // Voice
  await coll.generateVoice(text, 'Default', {}, null);

  // Video
  await coll.generateVideo(prompt, 5, null);

  // Dub
  await coll.dubVideo(videoId, languageCode, null);

  // Translate
  await video.translateTranscript(language, '', null);
  ```
</CodeGroup>

***

## Async Processing

All generative calls support asynchronous processing:

1. When `callback_url` is not provided: SDK returns an asset object once the process is done (synchronous processing)
2. When `callback_url` is provided: SDK returns immediately and sends a webhook when complete (asynchronous processing)
3. Call `.generate_url()` to get the finished file URL

### Callback Payload

```json theme={null}
{
  "success": true,
  "data": {
    "id": "img-z-019c4cb6-207c-7d23-aab1-e8ef7a5fcde1",
    "collection_id": "c-3b0a66f2-fac5-4816-b29e-e606986c0490",
    "name": "Futuristic City Sunset Skyline",
    "extension": "png",
    "size": "1607220"
  }
}
```

***

## Guide Index

<CardGroup cols={2}>
  <Card title="Images, Audio & Video" href="/pages/act/generative-media">
    Generate images, music, SFX, voices, and video
  </Card>

  <Card title="Translation & Dubbing" href="/pages/act/generative-media/translation-and-dubbing">
    Localize content into 20+ languages
  </Card>
</CardGroup>

***

## What You Can Build

<CardGroup cols={2}>
  <Card title="AI Voiceovers" href="/examples-and-tutorials/content-factory/voiceovers" icon="volume-2">
    Add narration to silent footage with AI-generated voices
  </Card>

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

  <Card title="Voice Cloning" href="/examples-and-tutorials/content-factory/voice-cloning" icon="mic">
    Replace voices with cloned audio preserving tone and style
  </Card>

  <Card title="Trailer Narration" href="/examples-and-tutorials/content-factory/trailer-narration" icon="film">
    Create dramatic trailers with compelling voiceovers
  </Card>
</CardGroup>
