Transcode

Description

Defines how to transcode a video to another format

Learn more: Transcoding video to other formats

Examples

			// See examples under each method
Details

Classes


new VideoCodecAction()


new KeyframeIntervalsAction()


new AudioCodecAction()


new AudioFrequencyAction()


new StreamingProfileAction()


new BitRateAction()


new FPSAction()


new ToAnimatedAction()


new FPSRangeAction()

Methods


<static> audioFrequency( freq ) → {Actions.Transcode.AudioFrequencyAction}

action

Description

Sets the audio sample frequency.

Learn more: Audio frequency control

Parameters
Name Type Description
freq AudioFrequencyType | string | number

The audio frequency.

Examples

			import {Cloudinary} from "@cloudinary/url-gen/instance/Cloudinary";
			import {FREQ11025} from '@cloudinary/url-gen/qualifiers/audioFrequency'
			import {audioFrequency} from '@cloudinary/url-gen/actions/transcode'
			
			const yourCldInstance = new Cloudinary({cloud:{cloudName:'demo'}});
			const video = yourCldInstance.video('dog');
			
			video.transcode(audioFrequency(FREQ11025()))
Details

<static> audioCodec( codec ) → {Actions.Transcode.AudioCodecAction}

action

Description

Sets the audio codec or removes the audio channel.

Parameters
Name Type Description
codec AudioCodecType | string

The audio codec or "none".

Examples

			import {Cloudinary} from "@cloudinary/url-gen/instance/Cloudinary";
			import {aac} from '@cloudinary/url-gen/qualifiers/audioCodec'
			import {audioCodec} from '@cloudinary/url-gen/actions/transcode'
			
			const yourCldInstance = new Cloudinary({cloud:{cloudName:'demo'}});
			const video = yourCldInstance.video('dog');
			
			video.transcode( audioCodec( aac() ) );
Details

<static> bitRate( bitRate ) → {Actions.Transcode.BitRateAction}

action

Description

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

Learn more: Bitrate control

Parameters
Name Type Description
bitRate string | number

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.

Examples

			import {Cloudinary} from "@cloudinary/url-gen/instance/Cloudinary";
			import {bitRate} from '@cloudinary/url-gen/actions/transcode'
			const yourCldInstance = new Cloudinary({cloud:{cloudName:'demo'}});
			const video = yourCldInstance.video('dog');
			
			video.transcode( bitRate(500).constant() );
Details

<static> fps( from ) → {Actions.Transcode.FPSAction}

action

Parameters
Name Type Description
from number

frame rate

Examples

			import {Cloudinary} from "@cloudinary/url-gen/instance/Cloudinary";
			import {fps} from '@cloudinary/url-gen/actions/transcode'
			
			const yourCldInstance = new Cloudinary({cloud:{cloudName:'demo'}});
			const video = yourCldInstance.video('dog');
			
			video.transcode( fps(15) );

<static> fpsRange( from, to ) → {Actions.Transcode.FPSRangeAction}

action

Description

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
from number

frame rate

to number

frame rate

Examples

			import {Cloudinary} from "@cloudinary/url-gen/instance/Cloudinary";
			import {fpsRange} from '@cloudinary/url-gen/actions/transcode'
			
			const yourCldInstance = new Cloudinary({cloud:{cloudName:'demo'}});
			const video = yourCldInstance.video('dog');
			
			video.transcode( fpsRange( 20, 25 ) );

<static> keyframeInterval( interval ) → {Actions.Transcode.KeyframeIntervalsAction}

action

Description

Sets the keyframe interval of the delivered video.

Parameters
Name Type Description
interval number | string

The keyframe interval in seconds.

Examples

			import {Cloudinary} from "@cloudinary/url-gen/instance/Cloudinary";
			import {keyframeInterval} from '@cloudinary/url-gen/actions/transcode'
			
			const yourCldInstance = new Cloudinary({cloud:{cloudName:'demo'}});
			const video = yourCldInstance.video('dog');
			
			video.transcode( keyframeInterval( 0.5 ) );

<static> streamingProfile( profile ) → {Actions.Transcode.StreamingProfileAction}

action

Description

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
profile string

The streaming profile.

Examples

			import {Cloudinary} from "@cloudinary/url-gen/instance/Cloudinary";
			import {fullHd} from "@cloudinary/url-gen/qualifiers/streamingProfile";
			import {streamingProfile} from '@cloudinary/url-gen/actions/transcode'
			
			const yourCldInstance = new Cloudinary({cloud:{cloudName:'demo'}});
			const video = yourCldInstance.video('dog');
			
			video.transcode( streamingProfile( fullHd() ) );

<static> toAnimated( animatedFormat ) → {Actions.Transcode.ToAnimatedAction}

action

Description

Converts a video to animated image.

Parameters
Name Type Description
animatedFormat string | AnimatedFormatType

The streaming profile.

Examples

			import {Cloudinary} from "@cloudinary/url-gen/instance/Cloudinary";
			import {gif} from '@cloudinary/url-gen/qualifiers/animatedFormat'
			import {toAnimated} from '@cloudinary/url-gen/actions/transcode'
			
			const yourCldInstance = new Cloudinary({cloud:{cloudName:'demo'}});
			const video = yourCldInstance.video('dog');
			
			video.transcode( toAnimated( gif() ) );

<static> videoCodec( videoCodecType ) → {Actions.Transcode.VideoCodecAction}

action

Description

Controls the video codec.

Parameters
Name Type Description
videoCodecType Qualifiers.VideoCodec.VideoCodecType | Qualifiers.VideoCodec.AdvVideoCodecType

CodecType

Examples

			import {Cloudinary} from "@cloudinary/url-gen";
			import {vp9} from '@cloudinary/url-gen/qualifiers/videoCodec'
			import {videoCodec} from '@cloudinary/url-gen/actions/transcode'
			
			const yourCldInstance = new Cloudinary({cloud:{cloudName:'demo'}});
			const video = yourCldInstance.video('dog');
			
			video.transcode( videoCodec( vp9() ) );