abstract class Transcode

Defines how to transcode a video to another format

Learn more: Transcoding video to other formats

Methods

audioCodec(string $audioCodec)

Sets the audio codec or removes the audio channel.

audioFrequency(string $audioFrequency)

Sets the audio sample frequency.

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.

videoCodec(VideoCodec|string $codec)

Controls the video codec.

toAnimated($animatedImageFormat = null)

Converts a video to animated image.

Details

static AudioCodec audioCodec(string $audioCodec)

Sets the audio codec or removes the audio channel.

Parameters

Name Type Description
$audioCodec string The audio codec or "none". Use the constants defined in the AudioCodec class.

Return Value

AudioCodec

See also

AudioCodec

static AudioFrequency audioFrequency(string $audioFrequency)

Sets the audio sample frequency.

Parameters

Name Type Description
$audioFrequency string The audio frequency. Use the constants defined in the AudioFrequency class.

Return Value

AudioFrequency

See also

AudioFrequency

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

static BitRate videoCodec(VideoCodec|string $codec)

Controls the video codec.

Parameters

Name Type Description
$codec VideoCodec|string The video codec.

Return Value

BitRate

See also

BitRate

static ToAnimatedAction toAnimated($animatedImageFormat = null)

Converts a video to animated image.

Parameters

Name Type Description
$animatedImageFormat

Return Value

ToAnimatedAction

See also

BitRate