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

# Output Formats

> Configure transcoding output - formats, resolutions, quality presets, and aspect ratio control

Configure transcoding output for your use case - streaming, archival, or web delivery.

## Quick Example

<CodeGroup>
  ```python Python theme={null}
  from videodb import TranscodeMode, VideoConfig, AudioConfig, ResizeMode

  job_id = conn.transcode(
      source="https://example.com/source.mov",
      callback_url="https://your-backend.com/webhooks",
      mode=TranscodeMode.lightning,
      video_config=VideoConfig(
          resolution=720,
          quality=23,
          framerate=30,
          resize_mode=ResizeMode.fit
      ),
      audio_config=AudioConfig(mute=False)
  )
  ```

  ```javascript Node.js theme={null}
  import { TranscodeMode, ResizeMode } from 'videodb';

  const jobId = await conn.transcode(
      "https://example.com/source.mov",
      "https://your-backend.com/webhooks",
      TranscodeMode.lightning,
      {
          resolution: 720,
          quality: 23,
          framerate: 30,
          resizeMode: ResizeMode.fit
      },
      { mute: false }
  );
  ```
</CodeGroup>

***

## Output Formats

| Format | Use Case                        |
| :----- | :------------------------------ |
| MP4    | Download, archival, playback    |
| HLS    | Adaptive streaming, web players |

***

## Resolution Options

| Resolution  | Dimensions  | Use Case               |
| :---------- | :---------- | :--------------------- |
| 360p (SD)   | 640 × 360   | Mobile, low bandwidth  |
| 720p (HD)   | 1280 × 720  | General web delivery   |
| 1080p (FHD) | 1920 × 1080 | High quality streaming |

***

## VideoConfig

| Field          | Type       | Default | Notes                                     |
| :------------- | :--------- | :------ | :---------------------------------------- |
| `resolution`   | int        | 720     | Height in pixels (auto-calculates width)  |
| `quality`      | int        | 23      | CRF (lower = better quality, larger file) |
| `framerate`    | int        | Source  | Target framerate (max 100 fps)            |
| `aspect_ratio` | str        | Source  | e.g., "16:9", "1:1", None for original    |
| `resize_mode`  | ResizeMode | crop    | How to handle aspect ratio changes        |

### Quality Presets (CRF)

| Quality           | CRF Range | Use Case                 |
| :---------------- | :-------- | :----------------------- |
| Visually Lossless | 18–20     | Archival, editing source |
| Good Quality      | 21–23     | General delivery         |
| Lower Quality     | 24–28     | Web previews, thumbnails |

<Tip>
  Lower CRF = better quality but larger file size. Default 23 is a good balance.
</Tip>

### Framerate

Supported: 30fps and 60fps output.

<CodeGroup>
  ```python Python theme={null}
  VideoConfig(
      resolution=720,
      framerate=30  # or 60
  )
  ```

  ```javascript Node.js theme={null}
  {
      resolution: 720,
      framerate: 30  // or 60
  }
  ```
</CodeGroup>

***

## Aspect Ratio Control

### ResizeMode

| Mode   | Behavior                  | Visual                            |
| :----- | :------------------------ | :-------------------------------- |
| `crop` | Crop edges to fill target | No black bars, content may be cut |
| `fit`  | Scale uniformly           | May letterbox (black bars)        |
| `pad`  | Add black bars            | Content preserved, bars added     |

<CodeGroup>
  ```python Python theme={null}
  from videodb import ResizeMode, VideoConfig

  # Crop to fill (may lose edges)
  VideoConfig(aspect_ratio="16:9", resize_mode=ResizeMode.crop)

  # Fit with letterbox
  VideoConfig(aspect_ratio="16:9", resize_mode=ResizeMode.fit)

  # Pad with black bars
  VideoConfig(aspect_ratio="1:1", resize_mode=ResizeMode.pad)
  ```

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

  // Crop to fill (may lose edges)
  { aspectRatio: "16:9", resizeMode: ResizeMode.crop }

  // Fit with letterbox
  { aspectRatio: "16:9", resizeMode: ResizeMode.fit }

  // Pad with black bars
  { aspectRatio: "1:1", resizeMode: ResizeMode.pad }
  ```
</CodeGroup>

***

## AudioConfig

| Field  | Type | Default | Notes                      |
| :----- | :--- | :------ | :------------------------- |
| `mute` | bool | false   | `true` removes audio track |

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

  # Keep audio
  AudioConfig(mute=False)

  # Remove audio
  AudioConfig(mute=True)
  ```

  ```javascript Node.js theme={null}
  // Keep audio
  { mute: false }

  // Remove audio
  { mute: true }
  ```
</CodeGroup>

***

## Common Configurations

### Web Delivery (720p, optimized)

<CodeGroup>
  ```python Python theme={null}
  VideoConfig(
      resolution=720,
      quality=23,
      framerate=30,
      resize_mode=ResizeMode.fit
  )
  ```

  ```javascript Node.js theme={null}
  {
      resolution: 720,
      quality: 23,
      framerate: 30,
      resizeMode: ResizeMode.fit
  }
  ```
</CodeGroup>

### Social Media Square (1:1)

<CodeGroup>
  ```python Python theme={null}
  VideoConfig(
      resolution=720,
      aspect_ratio="1:1",
      resize_mode=ResizeMode.crop
  )
  ```

  ```javascript Node.js theme={null}
  {
      resolution: 720,
      aspectRatio: "1:1",
      resizeMode: ResizeMode.crop
  }
  ```
</CodeGroup>

### Archival (High Quality)

<CodeGroup>
  ```python Python theme={null}
  VideoConfig(
      resolution=1080,
      quality=18,
      framerate=60
  )
  ```

  ```javascript Node.js theme={null}
  {
      resolution: 1080,
      quality: 18,
      framerate: 60
  }
  ```
</CodeGroup>

### Mobile Preview (Low Bandwidth)

<CodeGroup>
  ```python Python theme={null}
  VideoConfig(
      resolution=360,
      quality=28,
      framerate=30
  )
  ```

  ```javascript Node.js theme={null}
  {
      resolution: 360,
      quality: 28,
      framerate: 30
  }
  ```
</CodeGroup>

***

## Job Output Details

Completed jobs include detailed metadata:

```json theme={null}
{
  "job_id": "xxx",
  "status": "completed",
  "output": "https://transcoded-output.mp4",
  "input_details": {
    "resolution": "1920x1080",
    "framerate": 30,
    "duration": 634.53,
    "size": 263.34,
    "video_codec": "h264",
    "audio_codec": "mp3"
  },
  "output_details": {
    "resolution": "1920x1080",
    "framerate": 30,
    "duration": 635.06,
    "size": 253.84,
    "format": "mp4",
    "video_codec": "h264",
    "audio_codec": "aac"
  },
  "cost": 0.1058
}
```

***

## Next Steps

<CardGroup cols={2}>
  <Card icon="link" title="When to Transcode" href="/pages/ingest/transcoding/when-to-transcode">
    Decision guide and processing modes
  </Card>

  <Card icon="upload" title="Upload Video" href="/pages/ingest/files-and-collections/upload-video">
    Ingest media into VideoDB
  </Card>
</CardGroup>
