Search Documentation
Search across all documentation pages
H.264

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.

PresetSpeedCompressionAllowed
ultrafastFastestLowestYes
superfastVery fastLowYes
veryfastFastBelow averageYes
fasterAbove averageAverageYes
fastAverageAbove averageYes
mediumBelow averageGoodYes (default for standard tier)
slowSlowVery goodYes (default for premium tier)
slowerVery slowExcellentYes
veryslowExtremely slowNear-optimalNot allowed
placeboImpracticalNegligible gainNot allowed

The veryslow and placebo presets are blocked because they provide minimal quality improvement at extreme encoding cost.

Default by quality tier:

Quality TierDefault PresetDefault CRF
economyveryfast26
standardmedium23
premiumslow20

Profiles

Profiles define which H.264 features the encoder can use. Higher profiles enable better compression but require more capable decoders.

ProfileFeaturesCompatibility
baselineNo B-frames, no CABACLegacy devices, video conferencing
mainB-frames, CABACMainstream devices
high8x8 transforms, quantization scalingModern 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.

LevelMax ResolutionMax FramerateMax Bitrate
3.0720x57625 fps10 Mbps
3.11280x72030 fps14 Mbps
4.02048x102430 fps20 Mbps
4.12048x102430 fps50 Mbps
4.22048x108860 fps50 Mbps
5.03672x153630 fps135 Mbps
5.14096x216030 fps240 Mbps
5.24096x216060 fps240 Mbps

CRF (Constant Rate Factor)

CRF controls quality-based encoding. Lower values produce higher quality and larger files.

CRF RangeQualityUse Case
15-18Visually losslessArchival, mastering
19-22High qualityPremium streaming
23-25Good qualityStandard streaming (default: 23)
26-30AcceptableMobile, previews
31-35Lower qualityThumbnails, 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:

TuneBest ForEffect
filmLive-action filmDeblocking adjustments for natural content
animationCartoons, animeHigher deblocking, more reference frames
grainFilm grain, vintage footagePreserves grain texture
stillimageSlideshows, screencastsOptimized for static content
fastdecodeLow-power playbackDisables CABAC, fewer reference frames

The zerolatency tune is not allowed (reserved for live streaming, which Transcodely does not support).

Advanced Parameters

ParameterRangeDefaultDescription
bitrate100-240,000 kbpsNone (CRF mode)Target bitrate for size-based encoding
maxrate100-240,000 kbpsNoneMaximum bitrate for VBV buffering
bufsize100-480,000 kbpsNoneVBV buffer size
keyint1-600 frames250Maximum keyframe interval (GOP size)
min_keyint1-60 frames25Minimum keyframe interval
bframes0-16Per presetNumber of B-frames between I and P frames
ref1-16Per presetNumber of reference frames
rc_lookahead0-250 framesPer presetRate control lookahead distance
aq_mode0-31Adaptive quantization mode
aq_strength0.0-3.01.0Adaptive quantization strength
psy_rd"str:trellis"Per tunePsychovisual 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