FFmpeg H264
Reference
Type definitions
type FfmpegH264EncoderOptions = { type: "ffmpeg_h264"; bitrate?: | number | { averageBitrate: number; maxBitrate: number; }; keyframeIntervalMs?: number; preset?: | "ultrafast" | "superfast" | "veryfast" | "faster" | "fast" | "medium" | "slow" | "slower" | "veryslow" | "placebo"; pixelFormat?: "yuv420p" | "yuv422p" | "yuv444p"; ffmpegOptions?: Record<string, string>;};Properties
bitrate
Desired bitrate of the output stream, in bits per second. If only a number is specified then it defines the averageBitrate.
The maxBitrate is then set to 1.25x this value.
- Type:
number | { averageBitrate: number; maxBitrate: number; } - Default value: Dependent on the encoder used:
- libx264: Constant quality mode with the
crfequal to 23. Visit FFmpeg docs to learn more. - libopenh264, h264_videotoolbox: Calculated based on framerate and resolution. Eg. for 30 FPS in 1080p
the
averageBitratewould be 5000 kb/s andmaxBitrate6250 kb/s.
- libx264: Constant quality mode with the
Properties
averageBitrate
Average bitrate measured in bits per second. Encoder will try to keep the bitrate around the provided average, but may temporarily increase it to the provided max bitrate.
- Type:
number
maxBitrate
Max bitrate measured in bits per second.
- Type:
number
keyframeIntervalMs
Maximal interval between 2 consecutive keyframes, in milliseconds.
- Type:
number - Default value:
5000
preset
Video output encoder preset. Visit FFmpeg docs to learn more.
- Type:
"ultrafast" | "superfast" | "veryfast" | "faster" | "fast" | "medium" | "slow" | "slower" | "veryslow" | "placebo" - Default value:
fast - Supported values:
ultrafastsuperfastveryfastfasterfastmediumslowslowerveryslowplacebo
pixelFormat
Encoder pixel format.
- Type:
"yuv420p" | "yuv422p" | "yuv444p"; - Default value:
yuv420p - Supported values: Dependent on the encoder used:
- libx264:
yuv420p,yuv422p,yuv444p - libopenh264:
yuv420p - h264_videotoolbox:
yuv420p
- libx264:
ffmpegOptions
Raw FFmpeg encoder options. Visit FFmpeg docs to learn more.
- Type:
Record<string, string>