trait VideoQualifierTrait

Trait VideoQualifierTrait

Methods

bitRate(int|string $bitRate, null|string $type = null)

Controls the video bitrate.

fps(int|null $min = null, int|null $max = null)

Controls the range of acceptable FPS (Frames Per Second) to ensure that video (even when optimized) is delivered with an expected FPS level (helps with sync to audio).

fpsRange(int|null $min = null, int|null $max = null)

Controls the range of acceptable FPS (Frames Per Second) to ensure that video (even when optimized) is delivered with an expected FPS level (helps with sync to audio).

keyframeInterval(int $interval)

Sets the keyframe interval of the delivered video.

streamingProfile(string $streamingProfile)

Sets the streaming profile to apply to an HLS or MPEG-DASH adaptive bitrate streaming video.

videoSampling(int|string $value)

Sets the total number of frames to sample from the original video.

Details

static BitRate bitRate(int|string $bitRate, null|string $type = null)

Controls the video bitrate.

Supported codecs: h264, h265 (MPEG-4); vp8, vp9 (WebM).

Parameters

Name Type Description
$bitRate int|string The number of bits used to represent the video data per second. By default the video uses a variable bitrate (VBR), with this value indicating the maximum bitrate. The value can be an integer e.g. 120000, or a string supporting "k" and "m" (kilobits and megabits respectively) e.g. 250k or 2m.
$type null|string The type of bitrate. If "constant" is specified, the video plays with a constant bitrate (CBR). Use the constant defined in the BitRate class.

Return Value

BitRate

See also

BitRate

static Fps fps(int|null $min = null, int|null $max = null)

Controls the range of acceptable FPS (Frames Per Second) to ensure that video (even when optimized) is delivered with an expected FPS level (helps with sync to audio).

Parameters

Name Type Description
$min int|null The minimum frame rate.
$max int|null The maximum frame rate.

Return Value

Fps

static Fps fpsRange(int|null $min = null, int|null $max = null)

Controls the range of acceptable FPS (Frames Per Second) to ensure that video (even when optimized) is delivered with an expected FPS level (helps with sync to audio).

Parameters

Name Type Description
$min int|null The minimum frame rate.
$max int|null The maximum frame rate.

Return Value

Fps

static KeyframeInterval keyframeInterval(int $interval)

Sets the keyframe interval of the delivered video.

Parameters

Name Type Description
$interval int The keyframe interval in seconds.

Return Value

KeyframeInterval

static StreamingProfile streamingProfile(string $streamingProfile)

Sets the streaming profile to apply to an HLS or MPEG-DASH adaptive bitrate streaming video.

The value can be one of the pre-defined streaming profiles or a custom-defined one. You can use the streaming profiles methods of StreamingProfilesTrait to get a list of the available streaming profiles or to create new custom profiles.

Parameters

Name Type Description
$streamingProfile string The streaming profile.

Return Value

StreamingProfile

See also

StreamingProfilesTrait
https://cloudinary.com/documentation/video_manipulation_and_delivery#predefined_streaming_profiles

static VideoSampling videoSampling(int|string $value)

Sets the total number of frames to sample from the original video.

Relevant when converting videos to animated GIF or WebP format. If not specified, the resulting GIF or WebP samples the whole video (up to 400 frames, at up to 10 frames per second). By default the duration of the animated image is the same as the duration of the video, no matter how many frames are sampled from the original video (use the delay qualifier to adjust the amount of time between frames).

Parameters

Name Type Description
$value int|string Integer - The total number of frames to sample from the original video. The frames are spread out over the length of the video, e.g. 20 takes one frame every 5%. String - The number of seconds between each frame to sample from the original video. e.g. 2.3s takes one frame every 2.3 seconds.

Return Value

VideoSampling