Docs

WebM

Encode VP9 video and optional Opus audio into a WebM file.

Use webm_vp9 to create a VP9 video file. When the Source has audio, Chunkify encodes it as Opus at 48 kHz. Set disable_audio: true for video only.

Default video settings are CRF 24, quality: realtime, cpu_used: "5", and pixfmt: yuv420p. The cpu_used option controls VP9 encoding effort and its speed-quality tradeoff.

Create a WebM transcode

The example sets a height of 720 pixels and CRF 24. Width follows the Source aspect ratio.

Run these examples on your server after setting up your SDK and Source. Replace the token and Source ID.

These examples save the file in your Project's output storage. Set storage.path to the filename you want to use.

import Chunkify from '@chunkify/chunkify';

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

    const transcoding = await client.transcodings.create({
        source_id: 'src_2G6MJiNz71bHQGNzGwKx5cJwPFS',
        format: {
            id: "webm_vp9",
            height: 720,
            crf: 24,
        },
        storage: {
            path: 'exports/video-720p.webm',
        },
    });

    console.log(transcoding.id, transcoding.status);
}

main().catch((error) => {
    console.error(error);
    process.exitCode = 1;
});

Rate control

Set per_title: true to select a bitrate from the video content, or supply video_bitrate for an explicit target. Do not combine either with a manual CRF.

VP9 maxrate and bufsize require a target video_bitrate. minrate is supported only when it equals both video_bitrate and maxrate, selecting constant bitrate encoding.

Encoding parameters

webm_vp9 standalone file encoding settings.

id
"webm_vp9"
string
required

Id specifies the output format.

audio_bitrate
default: 128000
integer

AudioBitrate specifies the output audio bitrate in bits per second. Defaults to 128000.

Required range: 32000 <= x <= 512000
audio_samplerate
default: 48000
integer

AudioSamplerate specifies the output sample rate in Hz. Defaults to 48000. WebM Opus audio uses 48000.

Available options:
80001102512000160002205024000320004410048000640008820096000
bufsize
integer

Bufsize specifies the video buffer size in bits, from 100000 through 50000000. H.264 and H.265 require maxrate. AV1 and VP9 require a bitrate-controlled mode.

Required range: 100000 <= x <= 5e+07
channels
default: 2
integer

Channels specifies the output channel count. Defaults to stereo. Six channels means 5.1; eight means 7.1.

Available options:
1268
cpu_used
default: "5"
string

CpuUsed specifies the CPU usage level for VP9 encoding. Range: 0 to 8. Lower values mean better quality but slower encoding, higher values mean faster encoding but lower quality. Recommended values: 0-2 for high quality, 2-4 for good quality, 4-6 for balanced, 6-8 for speed

Available options:
012345678
Examples:
4
crf
default: 24
integer

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

Required range: 15 <= x <= 35
Examples:
23
disable_audio
boolean

DisableAudio omits the audio stream. Defaults to false. A source without audio produces video only.

disable_video
boolean

DisableVideo selects an audio-only AAC M4A export. Defaults to false. The source must contain audio.

duration
number

Duration specifies the requested output length in seconds. Defaults to the remaining source duration and is capped at the source end. Audio-only output must resolve to at least 0.001 seconds after trimming and sample rounding. The accepted interval determines the fixed price.

framerate
number

Framerate specifies the output video frame rate. Defaults to the source rate and must be between 0.001 and 240 fps.

Required range: 0.001 <= x <= 240
gop
integer

Gop specifies the maximum keyframe interval in frames. Defaults to four seconds at the accepted frame rate, capped at 960 frames.

Required range: 1 <= x <= 960
height
integer

Height specifies the output dimension in pixels. Use -2 or omit one dimension to preserve the source aspect ratio. Explicit dimensions must be 2 to 7680 and even. Omitting both preserves the source dimensions rounded down to even pixels.

Required range: -2 <= x <= 7680
maxrate
integer

Maxrate specifies the video buffer maximum rate in bits per second, from 100000 through 50000000. H.264 and H.265 require bufsize. VP9 requires video_bitrate; AV1 requires CRF mode.

Required range: 100000 <= x <= 5e+07
minrate
integer

Minrate selects VP9 constant bitrate when equal to video_bitrate and maxrate. Other minimum-rate combinations are unsupported.

Required range: 100000 <= x <= 5e+07
per_title
default: false
boolean

PerTitle enables independent content-based bitrate prediction for each part of the video. Analysis uses only the selected trim interval. Defaults to false. Explicit rate-control settings cannot be combined with it.

pixfmt
default: "yuv420p"
string

Pixfmt specifies the output pixel format. Defaults to yuv420p. The selected profile must support it.

Available options:
yuv420pyuv422pyuv440pyuv444pyuv420p10leyuv422p10leyuv440p10leyuv444p10leyuv420p12leyuv422p12leyuv440p12leyuv444p12le
quality
default: "realtime"
string

Quality specifies the VP9 encoding quality preset. Valid values:

  • good: Balanced quality preset, good for most applications
  • best: Best quality preset, slower encoding
  • realtime: Fast encoding preset, suitable for live streaming
Available options:
goodbestrealtime
Examples:
good
seek
number

Seek specifies the start in source seconds. Defaults to zero and must precede the source end. The accepted interval uses the output frame or sample timeline. Audio-only output must retain at least 0.001 seconds after sample rounding.

Required range: x >= 0
video_bitrate
integer

VideoBitrate specifies the target video bitrate in bits per second, from 1000 through 100000000. Omit it for CRF or per-title encoding.

Required range: 1000 <= x <= 1e+08
width
integer

Width specifies the output dimension in pixels. Use -2 or omit one dimension to preserve the source aspect ratio. Explicit dimensions must be 2 to 7680 and even. Omitting both preserves the source dimensions rounded down to even pixels.

Required range: -2 <= x <= 7680