H.264
H.264 (also known as AVC) is the most widely supported video codec. It plays on virtually every device, browser, and media player. Transcodely uses the libx264 encoder with sensible defaults that you can override per-output or per-variant.
Quick Start
The simplest H.264 output uses the defaults. Just specify the codec:
{
"type": "mp4",
"video": [
{
"codec": "h264",
"resolution": "1080p",
"quality": "standard"
}
]
}This produces a 1080p H.264 MP4 using the high profile, medium preset, and a CRF of 23 — suitable for most streaming applications.
H264Options Reference
Pass the h264 object on a video variant to override defaults:
{
"codec": "h264",
"resolution": "1080p",
"quality": "standard",
"h264": {
"profile": "high",
"preset": "slow",
"crf": 20,
"tune": "film"
}
}Presets
Presets control the encoding speed-to-compression tradeoff. Slower presets produce smaller files at the same quality.
| Preset | Speed | Compression | Allowed |
|---|---|---|---|
ultrafast | Fastest | Lowest | Yes |
superfast | Very fast | Low | Yes |
veryfast | Fast | Below average | Yes |
faster | Above average | Average | Yes |
fast | Average | Above average | Yes |
medium | Below average | Good | Yes (default for standard tier) |
slow | Slow | Very good | Yes (default for premium tier) |
slower | Very slow | Excellent | Yes |
veryslow | Extremely slow | Near-optimal | Not allowed |
placebo | Impractical | Negligible gain | Not allowed |
The veryslow and placebo presets are blocked because they provide minimal quality improvement at extreme encoding cost.
Default by quality tier:
| Quality Tier | Default Preset | Default CRF |
|---|---|---|
economy | veryfast | 26 |
standard | medium | 23 |
premium | slow | 20 |
Profiles
Profiles define which H.264 features the encoder can use. Higher profiles enable better compression but require more capable decoders.
| Profile | Features | Compatibility |
|---|---|---|
baseline | No B-frames, no CABAC | Legacy devices, video conferencing |
main | B-frames, CABAC | Mainstream devices |
high | 8x8 transforms, quantization scaling | Modern devices (default, recommended) |
The high10, high422, and high444 profiles are not allowed due to limited playback support.
Levels
Levels cap the maximum bitrate, resolution, and frame rate. The encoder auto-selects the appropriate level by default. Override only if you need to target a specific device profile.
| Level | Max Resolution | Max Framerate | Max Bitrate |
|---|---|---|---|
3.0 | 720x576 | 25 fps | 10 Mbps |
3.1 | 1280x720 | 30 fps | 14 Mbps |
4.0 | 2048x1024 | 30 fps | 20 Mbps |
4.1 | 2048x1024 | 30 fps | 50 Mbps |
4.2 | 2048x1088 | 60 fps | 50 Mbps |
5.0 | 3672x1536 | 30 fps | 135 Mbps |
5.1 | 4096x2160 | 30 fps | 240 Mbps |
5.2 | 4096x2160 | 60 fps | 240 Mbps |
CRF (Constant Rate Factor)
CRF controls quality-based encoding. Lower values produce higher quality and larger files.
| CRF Range | Quality | Use Case |
|---|---|---|
| 15-18 | Visually lossless | Archival, mastering |
| 19-22 | High quality | Premium streaming |
| 23-25 | Good quality | Standard streaming (default: 23) |
| 26-30 | Acceptable | Mobile, previews |
| 31-35 | Lower quality | Thumbnails, low-bandwidth |
Allowed range: 15-35. Values below 15 produce near-lossless output (wasteful). Values above 35 produce poor quality.
CRF is mutually exclusive with bitrate. If you set both, the API returns a validation error.
Tune
Tune options optimize the encoder for specific content types:
| Tune | Best For | Effect |
|---|---|---|
film | Live-action film | Deblocking adjustments for natural content |
animation | Cartoons, anime | Higher deblocking, more reference frames |
grain | Film grain, vintage footage | Preserves grain texture |
stillimage | Slideshows, screencasts | Optimized for static content |
fastdecode | Low-power playback | Disables CABAC, fewer reference frames |
The zerolatency tune is not allowed (reserved for live streaming, which Transcodely does not support).
Advanced Parameters
| Parameter | Range | Default | Description |
|---|---|---|---|
bitrate | 100-240,000 kbps | None (CRF mode) | Target bitrate for size-based encoding |
maxrate | 100-240,000 kbps | None | Maximum bitrate for VBV buffering |
bufsize | 100-480,000 kbps | None | VBV buffer size |
keyint | 1-600 frames | 250 | Maximum keyframe interval (GOP size) |
min_keyint | 1-60 frames | 25 | Minimum keyframe interval |
bframes | 0-16 | Per preset | Number of B-frames between I and P frames |
ref | 1-16 | Per preset | Number of reference frames |
rc_lookahead | 0-250 frames | Per preset | Rate control lookahead distance |
aq_mode | 0-3 | 1 | Adaptive quantization mode |
aq_strength | 0.0-3.0 | 1.0 | Adaptive quantization strength |
psy_rd | "str:trellis" | Per tune | Psychovisual rate-distortion optimization |
deblock | "alpha:beta" | "0:0" | Deblocking filter strength (-6 to 6 each) |
Example: High-Quality Film Encode
{
"codec": "h264",
"resolution": "1080p",
"quality": "premium",
"h264": {
"profile": "high",
"preset": "slow",
"crf": 18,
"tune": "film",
"bframes": 8,
"ref": 6,
"aq_mode": 2,
"aq_strength": 1.2
}
}Example: Fast Mobile-Friendly Encode
{
"codec": "h264",
"resolution": "720p",
"quality": "economy",
"h264": {
"profile": "main",
"preset": "veryfast",
"crf": 28
}
}Container Compatibility
H.264 works with: MP4, MKV, MOV, TS, HLS, DASH
H.264 does not work with: WebM