Configure transcoding output for your use case - streaming, archival, or web delivery.
Quick Example
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)
)
| 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 |
Lower CRF = better quality but larger file size. Default 23 is a good balance.
Framerate
Supported: 30fps and 60fps output.
VideoConfig(
resolution=720,
framerate=30 # or 60
)
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 |
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)
AudioConfig
| Field | Type | Default | Notes |
|---|
mute | bool | false | true removes audio track |
from videodb import AudioConfig
# Keep audio
AudioConfig(mute=False)
# Remove audio
AudioConfig(mute=True)
Common Configurations
Web Delivery (720p, optimized)
VideoConfig(
resolution=720,
quality=23,
framerate=30,
resize_mode=ResizeMode.fit
)
VideoConfig(
resolution=720,
aspect_ratio="1:1",
resize_mode=ResizeMode.crop
)
Archival (High Quality)
VideoConfig(
resolution=1080,
quality=18,
framerate=60
)
Mobile Preview (Low Bandwidth)
VideoConfig(
resolution=360,
quality=28,
framerate=30
)
Job Output Details
Completed jobs include detailed metadata:
{
"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