Docs

MP4

Transcode videos to MP4 with H.264, H.265, or AV1 codecs. Configure encoding parameters for optimal quality.

This guide documents the legacy Jobs API (/jobs). Existing Jobs API integrations remain supported during the transition. For automatic file encoding, see the transcode guides.

MP4 transcoding

This example creates an MP4 file with H.264 video and custom encoding settings.

import Chunkify from '@chunkify/chunkify';

const client = new Chunkify({
    projectAccessToken: 'My Project Access Token',
});

// Transcode using h264 format with custom format parameters
const job = await client.jobs.create({
    source_id: source.id,
    format: {
        id: 'mp4_h264',
        crf: 21,
        height: 1080,
        profilev: 'main',
    },
});

All Available Parameters by Codec

A complete list of all the parameters available for each codec.

FFmpeg encoding parameters specific to H.264/AVC encoding.

crf
default: 21
integer

Crf (Constant Rate Factor) controls the quality of the output video. Lower values mean better quality but larger file size. Range: 16 to 35. Recommended values: 18-28 for high quality, 23-28 for good quality, 28-35 for acceptable quality.

Required range: 16 <= x <= 35
Examples:
23
level
integer

Level specifies the H.264 profile level. Valid values: 10-13 (baseline), 20-22 (main), 30-32 (high), 40-42 (high), 50-51 (high). Higher levels support higher resolutions and bitrates but require more processing power.

Available options:
101112132021223031324041425051
Examples:
41
movflags
string
preset
default: "veryfast"
string

Preset specifies the encoding speed preset. Valid values (from fastest to slowest):

  • ultrafast: Fastest encoding, lowest quality
  • superfast: Very fast encoding, lower quality
  • veryfast: Fast encoding, moderate quality
  • faster: Faster encoding, good quality
  • fast: Fast encoding, better quality
  • medium: Balanced preset, best quality
Available options:
ultrafastsuperfastveryfastfasterfastmedium
Examples:
medium
profilev
string

Profilev specifies the H.264 profile. Valid values:

  • baseline: Basic profile, good for mobile devices
  • main: Main profile, good for most applications
  • high: High profile, best quality but requires more processing
  • high10: High 10-bit profile, supports 10-bit color
  • high422: High 4:2:2 profile, supports 4:2:2 color sampling
  • high444: High 4:4:4 profile, supports 4:4:4 color sampling
Available options:
baselinemainhighhigh10high422high444
Examples:
high
x264_keyint
integer

X264KeyInt specifies the maximum number of frames between keyframes for H.264 encoding. Range: 1 to 960. Higher values can improve compression but may affect seeking.

Required range: 1 <= x <= 960
Examples:
60