Video transformations

Cloudinary is a cloud-based service that provides an end-to-end media management solution for images and videos, including upload, storage, administration, manipulation, optimization and delivery.

Using Cloudinary's comprehensive API and easy to use manipulation URLs, uploaded videos can be automatically transcoded to all relevant formats suitable for web viewing, optimized for web browsers and mobile devices, and normalized and manipulated in real time to fit your graphic design. The videos can be easily embedded in your website using HTML5 video tags (or Flash) and then streamed to your users via a fast CDN. Get the most out of all the video functionality described on this page by embedding your videos using Cloudinary's video player.

The Video Transformation Reference summarizes all parameters available for manipulating videos as well as video transformation flags that adjust the default behavior of certain transformations.

Note
Your account's pricing plan is in part dependent on the total number of transformation operations performed during a billing cycle. These are primarily counted when Cloudinary generates a new 'derived resource' from an asset based on a transformation URL. For complete details on how transformations are counted, see Transformation Counts.

On-the-fly video encoding and delivery

You deliver video using Cloudinary HTTP or HTTPS URLs. You can add transformations to any Cloudinary URL and deliver your video, encoded to the specified format, on-the-fly. Multiple users can then stream the video even while it is being encoded and delivered via CDN. You can also deliver videos that were encoded in advance with eager or explicit transformations. Furthermore Cloudinary supports HTTP progressive download for media players capable of progressive download playback.

Video URL structure

The Public ID is the unique identifier of the video, and is either specified when uploading the video to your Cloudinary account, or automatically assigned by Cloudinary. For more details on the options for specifying the public ID, see Public ID - the image identifier.

A basic video delivery URL takes the following structure:

https://res.cloudinary.com/<cloud name>/video/upload/<public ID>.<video format file extension>

For example, here's how you would deliver a video from Cloudinary’s demo account with a public ID of dog in mp4 format:

Ruby:
cl_video_tag("dog")
PHP:
cl_video_tag("dog")
Python:
CloudinaryVideo("dog").video()
Node.js:
cloudinary.video("dog")
Java:
cloudinary.url().videoTag("dog");
JS:
cloudinary.videoTag('dog').toHtml();
jQuery:
$.cloudinary.video("dog")
React:
<Video publicId="dog" >

</Video>
Vue.js:
<cld-video publicId="dog" >

</cld-video>
Angular:
<cl-video public-id="dog" >

</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.BuildVideoTag("dog")
Android:
MediaManager.get().url().resourceType("video").generate("dog.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").generate("dog.mp4")

Manipulation (transformation) instructions are added in the delivery URL before the public ID. The video delivery URL with transformation parameters takes the following structure:

https://res.cloudinary.com/<cloud name>/video/upload/<manipulation parameters>/<public ID>.<video format file extension>

An example of a URL with video manipulation, where dog video is cropped to a width of 300 pixels and a height of 200 pixels, and encoded to mp4 format:

Ruby:
cl_video_tag("dog", :width=>300, :height=>200, :crop=>"crop")
PHP:
cl_video_tag("dog", array("width"=>300, "height"=>200, "crop"=>"crop"))
Python:
CloudinaryVideo("dog").video(width=300, height=200, crop="crop")
Node.js:
cloudinary.video("dog", {width: 300, height: 200, crop: "crop"})
Java:
cloudinary.url().transformation(new Transformation().width(300).height(200).crop("crop")).videoTag("dog");
JS:
cloudinary.videoTag('dog', {width: 300, height: 200, crop: "crop"}).toHtml();
jQuery:
$.cloudinary.video("dog", {width: 300, height: 200, crop: "crop"})
React:
<Video publicId="dog" >
  <Transformation width="300" height="200" crop="crop" />
</Video>
Vue.js:
<cld-video publicId="dog" >
  <cld-transformation width="300" height="200" crop="crop" />
</cld-video>
Angular:
<cl-video public-id="dog" >
  <cl-transformation width="300" height="200" crop="crop">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation().Width(300).Height(200).Crop("crop")).BuildVideoTag("dog")
Android:
MediaManager.get().url().transformation(new Transformation().width(300).height(200).crop("crop")).resourceType("video").generate("dog.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setWidth(300).setHeight(200).setCrop("crop")).generate("dog.mp4")

Notes

  • For details about other potential elements of the delivery URL, see Delivering media assets using dynamic URLs
  • You can deliver the video in other supported video formats by simply changing the video format file extension. For details, see Transcoding video to other formats.
  • You can append an SEO-friendly suffix to your URL by replacing the video/upload element of the URL with /videos and then appending the desired suffix with a slash (/) after the public ID. For example, if you have an instructional cooking video with a random public ID like: abc1def2, you can deliver your video as:
    https://res.cloudinary.com/<cloud name>/videos/abc1def2/my_cooking_video.mp4.
    For more details, see Dynamic SEO suffixes.
  • For customers with a Custom Domain Name (CNAME - available for Cloudinary's Advanced plan and above), the video delivery URL becomes: https://<custom domain name>/video/upload/<public ID>.<video format file extension>

Embedding videos in web pages

Cloudinary's video player is a JavaScript-based HTML5 video player bundled with many valuable customization and integration capabilities. If you use this video player to embed your videos, you'll define the source video or the playlist for your player as part of that process, and the video tags with all relevant video formats and other relevant settings are automatically generated. For details, see Video Player.

The easiest way to embed videos in your page without the Cloudinary video player is by using the video tag helper method available in the Cloudinary SDKs (e.g. cl_video_tag in Ruby on Rails). This method automatically generates an HTML5 video tag including the video source URLs of all relevant formats supported by web browsers (webm, mp4 and ogv), as well as a poster thumbnail image. The browser then automatically selects the video format it supports, while the video files are created dynamically and immediately streamed when first accessed by your users.

You can optionally control the generation of the HTML5 video tag and specify transformation parameters to manipulate the video to match your graphic design. The video tag helper method uses the following structure:

cl_video_tag(public_id, options = {})

public_id: (required) the unique identifier of the uploaded video.

Where possible options are:

  • source_types: an ordered array of the video source types to include in the HTML5 tag, where the type is mapped to the mime type. Default: ['webm', 'mp4', 'ogv']
  • manipulation params: the manipulation(s) to carry out on the video, such as cropping, resizing, etc (see the Video transformations reference table for more details on possible parameters and values)
  • source_transformation: to override the default transformation instructions for each specific video format. The source_type is mapped to a transformation struct. e.g., { mp4: { quality: 70}}
  • poster: a URI to an image to be shown while the video is downloading or until the user hits the play button. The URI can be one of the following:
    • The URL to an image.
    • A struct including the transformations to apply to the default image (you can include the public_id of an uploaded image to use instead of the default image).
    • Set to nil or false to use no poster.
    • Default: the middle frame of the source video in jpg format.
  • fallback_content: an HTML string to display in the case that the browser does not support any of the video formats included.
  • Any attribute of the HTML5 video tag. e.g., autoplay, controls, height, loop, muted, preload (see w3schools for details on HTML5 attributes).

Example 1: Simply creating an HTML5 video tag for the uploaded mp4 video named dog:

Ruby:
cl_video_tag("dog")
PHP:
<?php echo cl_video_tag("dog"); ?>
Python:
cloudinary.CloudinaryVideo("dog").video()
Node.js:
cloudinary.video("dog")
Java:
<cl:video src="dog"/>

Generates the following HTML5 video tag:

<video poster="https://res.cloudinary.com/demo/video/upload/dog.jpg">
  <source src="https://res.cloudinary.com/demo/video/upload/dog.webm" type="video/webm"/>
  <source src="https://res.cloudinary.com/demo/video/upload/dog.mp4" type="video/mp4"/>
  <source src="https://res.cloudinary.com/demo/video/upload/dog.ogv" type="video/ogg"/>
</video>

Example 2: Creating an HTML5 video tag for the uploaded mp4 video named dog, where the video is resized to a width of 300 pixels, a height of 300 pixels, padded with a blue background to fill the new dimensions, given a fallback string in the case that the video tag is not supported, specified that controls should be displayed and that the file should not be preloaded:

Ruby:
cl_video_tag("dog", :width => 300, :height => 300, 
  :crop => :pad, :background => "blue", 
  :preload => "none", :controls => true,
  :fallback_content => "Your browser does not support HTML5 video tags" )
PHP:
<?php echo cl_video_tag("dog", 
  array("width" => 300, "height" => 300, 
    "crop" => "pad", "background" => "blue", 
    "preload" => "none", "controls" => true,
    "fallback_content" => "Your browser does not support HTML5 video tags")); ?>
Python:
cloudinary.CloudinaryVideo("dog").video( 
  width = 300, height = 300, 
  crop = "pad", background = "blue", 
  preload = "none", controls = True,
  fallback_content = "Your browser does not support HTML5 video tags")
Node.js:
cloudinary.video("dog" { width: 300, height: 300, 
  crop: "pad", background: "blue", 
  preload: "none", controls: true,
  fallback_content: "Your browser does not support HTML5 video tags" })
Java:
<cl:video src="dog" width = "300", height = "300", 
  crop = "pad", background = "blue", 
  preload = "none", controls = "true",
  fallback_content = "Your browser does not support HTML5 video tags"/>

Generates the following HTML5 video tag:

<video poster="https://res.cloudinary.com/demo/video/upload/dog.jpg" preload="none" controls>
  <source src="https://res.cloudinary.com/demo/video/upload/w_300,h_300,c_pad,b_blue/dog.webm" type="video/webm"/>
  <source src="https://res.cloudinary.com/demo/video/upload/w_300,h_300,c_pad,b_blue/dog.mp4" type="video/mp4"/>
  <source src="https://res.cloudinary.com/demo/video/upload/w_300,h_300,c_pad,b_blue/dog.ogv" type="video/ogg"/>
   Your browser does not support HTML5 video tags
</video>

Example 3: Creating an HTML5 video tag for the uploaded mp4 video named dog, where the video is cropped to a width of 200 pixels and a height of 150 pixels, given a fallback string in the case that the video tag is not supported, not to use a poster image and that the file should autoplay in a loop:

Ruby:
cl_video_tag("dog", :width => 200, :height => 150, :crop => :crop,  
  :loop => true, :autoplay => true, :poster => false,
  :fallback_content => "Your browser does not support HTML5 video tags" )
PHP:
<?php echo cl_video_tag("dog", 
  array("width" => 200, "height" => 150, 
    "crop" => "crop", "loop" => true, 
    "autoplay" => true, "poster" => false,
    "fallback_content" => "Your browser does not support HTML5 video tags")); ?>
Python:
cloudinary.CloudinaryVideo("dog").video( 
  width = 200, height = 150, 
  crop = "crop", loop = True, 
  autoplay = True, poster = False,
  fallback_content = "Your browser does not support HTML5 video tags")
Node.js:
cloudinary.video("dog" { width: 200, height: 150, 
  crop: "crop", loop: true, 
  autoplay: true, poster: false,
  fallback_content: "Your browser does not support HTML5 video tags" })
Java:
<cl:video src="dog" width = "200", height = "150", 
  crop = "crop", loop = "true", 
  autoplay = "true", poster = "false",
  fallback_content = "Your browser does not support HTML5 video tags"/>

Generates the following HTML5 video tag:

<video loop autoplay>
  <source src="https://res.cloudinary.com/demo/video/upload/w_200,h_150,c_crop/dog.webm" type="video/webm"/>
  <source src="https://res.cloudinary.com/demo/video/upload/w_200,h_150,c_crop/dog.mp4" type="video/mp4"/>
  <source src="https://res.cloudinary.com/demo/video/upload/w_200,h_150,c_crop/dog.ogv" type="video/ogg"/>
   Your browser does not support HTML5 video tags
</video>

Transcoding video to other formats

Videos (and audio files) can be uploaded to Cloudinary in various formats (upload formats), and you can easily transcode these videos to other formats for displaying in your web site or application (delivery formats). Examples of situations where you might want to change the delivered video format:

  • Delivering a video where the original format is not supported for delivery by the browser. For example, you could deliver a 3PG (.3pg) video as an MPEG-4 (.mp4).
  • Delivering WebM if your users are on a Chrome browser or on a mobile app you control.

Transcoding the video to another format is done by simply specifying the new format as the file extension of the URL (client libraries can also use the format parameter to specify the new format). Furthermore, video files can be converted to audio files by stipulating a supported audio format.

For example, transcoding the format of the uploaded mp4 video named dog to WebM format by changing the file extension to .webm:

Ruby:
cl_video_tag("dog")
PHP:
cl_video_tag("dog")
Python:
CloudinaryVideo("dog").video()
Node.js:
cloudinary.video("dog")
Java:
cloudinary.url().videoTag("dog");
JS:
cloudinary.videoTag('dog').toHtml();
jQuery:
$.cloudinary.video("dog")
React:
<Video publicId="dog" >

</Video>
Vue.js:
<cld-video publicId="dog" >

</cld-video>
Angular:
<cl-video public-id="dog" >

</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.BuildVideoTag("dog")
Android:
MediaManager.get().url().resourceType("video").generate("dog.webm");
iOS:
cloudinary.createUrl().setResourceType("video").generate("dog.webm")

cloudinary_url("dog.webm", :resource_type => :video)

Which is equivalent to:

cloudinary_url("dog", :resource_type => :video, :format => "webm").

Another way to transcode the format of an uploaded video is to use the format parameter (f for URLs).

For example, transcoding the uploaded mp4 video named dog to WebM with a parameter:

Ruby:
cl_video_tag("dog", :format=>"webm")
PHP:
cl_video_tag("dog", array("format"=>"webm"))
Python:
CloudinaryVideo("dog").video(format="webm")
Node.js:
cloudinary.video("dog", {format: "webm"})
Java:
cloudinary.url().format("webm").videoTag("dog");
JS:
cloudinary.videoTag('dog', {format: "webm"}).toHtml();
jQuery:
$.cloudinary.video("dog", {format: "webm"})
React:
<Video publicId="dog" format="webm">

</Video>
Vue.js:
<cld-video publicId="dog" format="webm">

</cld-video>
Angular:
<cl-video public-id="dog" format="webm">

</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Format("webm").BuildVideoTag("dog")
Android:
MediaManager.get().url().format("webm").resourceType("video").generate("dog.mp4");
iOS:
cloudinary.createUrl().setFormat("webm").setResourceType("video").generate("dog.mp4")

Note
If a format is supported only for upload, then the delivery URL enables a user to download the original file in its original format, but you cannot apply transformation parameters.

The sections below summarize the supported video and audio format types.

Supported video formats

Format Extensions Supported for Upload Supported for Delivery
3G2 3g2 Yes
3GP (3rd Generation Partnership) 3gp Yes
AVI (Audio Video Interleave) avi Yes
FLV (Flash Video) flv Yes Yes
HLS adaptive streaming m3u8 Yes Yes
MPEG-2 Transport Stream ts, m2ts, mts Yes Yes
MOV mov Yes Yes
MKV (Matroska Multimedia Container) mkv Yes Yes
MP4 mp4 Yes Yes
MPEG-2 mpeg Yes
MPEG-DASH adaptive streaming mpd Yes Yes
OGV (Ogg Video) ogv Yes Yes
WebM webm Yes Yes
WMV (Windows Media Video) wmv Yes

See also: Supported audio formats

Resizing and cropping videos

You can resize and crop videos in order to match the graphic design of your web site or mobile app. Whether videos are uploaded in your server-side code or by your users, the originals are stored in the cloud. You can then dynamically create multiple resized, cropped and manipulated videos on-the-fly and deliver them via dynamic URLs or use code to either add video tags or build the URLs.

Change the size of a video with the width and height parameters (w and h in URLs). You can resize the video by using both the width and height parameters or with only one of them (the other dimension is automatically updated to maintain the aspect ratio).

  • Using an integer value sets the new dimension to that number in pixels. For example, w_150 sets the width to exactly 150 pixels.
  • Using a decimal value sets the new dimension as a multiple of the original dimension. For example, w_0.5 sets the width to half the original width.

Examples of resizing the uploaded mp4 video named dog:

  1. Resizing to a width of 150 pixels and a height of 100 pixels:

    Ruby:
    cl_video_tag("dog", :width=>150, :height=>100, :crop=>"scale")
    PHP:
    cl_video_tag("dog", array("width"=>150, "height"=>100, "crop"=>"scale"))
    Python:
    CloudinaryVideo("dog").video(width=150, height=100, crop="scale")
    Node.js:
    cloudinary.video("dog", {width: 150, height: 100, crop: "scale"})
    Java:
    cloudinary.url().transformation(new Transformation().width(150).height(100).crop("scale")).videoTag("dog");
    JS:
    cloudinary.videoTag('dog', {width: 150, height: 100, crop: "scale"}).toHtml();
    jQuery:
    $.cloudinary.video("dog", {width: 150, height: 100, crop: "scale"})
    React:
    <Video publicId="dog" >
      <Transformation width="150" height="100" crop="scale" />
    </Video>
    Vue.js:
    <cld-video publicId="dog" >
      <cld-transformation width="150" height="100" crop="scale" />
    </cld-video>
    Angular:
    <cl-video public-id="dog" >
      <cl-transformation width="150" height="100" crop="scale">
      </cl-transformation>
    </cl-video>
    .Net:
    cloudinary.Api.UrlVideoUp.Transform(new Transformation().Width(150).Height(100).Crop("scale")).BuildVideoTag("dog")
    Android:
    MediaManager.get().url().transformation(new Transformation().width(150).height(100).crop("scale")).resourceType("video").generate("dog.mp4");
    iOS:
    cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setWidth(150).setHeight(100).setCrop("scale")).generate("dog.mp4")

  2. Resizing the width to half the original width, maintaining the aspect ratio:

    Ruby:
    cl_video_tag("dog", :width=>0.5, :crop=>"scale")
    PHP:
    cl_video_tag("dog", array("width"=>0.5, "crop"=>"scale"))
    Python:
    CloudinaryVideo("dog").video(width=0.5, crop="scale")
    Node.js:
    cloudinary.video("dog", {width: "0.5", crop: "scale"})
    Java:
    cloudinary.url().transformation(new Transformation().width(0.5).crop("scale")).videoTag("dog");
    JS:
    cloudinary.videoTag('dog', {width: "0.5", crop: "scale"}).toHtml();
    jQuery:
    $.cloudinary.video("dog", {width: "0.5", crop: "scale"})
    React:
    <Video publicId="dog" >
      <Transformation width="0.5" crop="scale" />
    </Video>
    Vue.js:
    <cld-video publicId="dog" >
      <cld-transformation width="0.5" crop="scale" />
    </cld-video>
    Angular:
    <cl-video public-id="dog" >
      <cl-transformation width="0.5" crop="scale">
      </cl-transformation>
    </cl-video>
    .Net:
    cloudinary.Api.UrlVideoUp.Transform(new Transformation().Width(0.5).Crop("scale")).BuildVideoTag("dog")
    Android:
    MediaManager.get().url().transformation(new Transformation().width(0.5).crop("scale")).resourceType("video").generate("dog.mp4");
    iOS:
    cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setWidth(0.5).setCrop("scale")).generate("dog.mp4")

  3. Resizing the height to 200 pixels, maintaining the aspect ratio:

    Ruby:
    cl_video_tag("dog", :height=>200, :crop=>"scale")
    PHP:
    cl_video_tag("dog", array("height"=>200, "crop"=>"scale"))
    Python:
    CloudinaryVideo("dog").video(height=200, crop="scale")
    Node.js:
    cloudinary.video("dog", {height: 200, crop: "scale"})
    Java:
    cloudinary.url().transformation(new Transformation().height(200).crop("scale")).videoTag("dog");
    JS:
    cloudinary.videoTag('dog', {height: 200, crop: "scale"}).toHtml();
    jQuery:
    $.cloudinary.video("dog", {height: 200, crop: "scale"})
    React:
    <Video publicId="dog" >
      <Transformation height="200" crop="scale" />
    </Video>
    Vue.js:
    <cld-video publicId="dog" >
      <cld-transformation height="200" crop="scale" />
    </cld-video>
    Angular:
    <cl-video public-id="dog" >
      <cl-transformation height="200" crop="scale">
      </cl-transformation>
    </cl-video>
    .Net:
    cloudinary.Api.UrlVideoUp.Transform(new Transformation().Height(200).Crop("scale")).BuildVideoTag("dog")
    Android:
    MediaManager.get().url().transformation(new Transformation().height(200).crop("scale")).resourceType("video").generate("dog.mp4");
    iOS:
    cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setHeight(200).setCrop("scale")).generate("dog.mp4")

When changing the dimensions of an uploaded video by manipulating the video's height and/or width, you need to decide how to adapt or "crop" the video to fit into the requested size. Use the crop parameter for selecting the crop mode (c in URLs). Cloudinary supports the following video cropping modes: scale, fit, fill, limit, pad, lpad and crop.

scale

Change the size of the video exactly to the given width and height without necessarily retaining the original aspect ratio: all original video parts are visible but might be stretched or shrunk. If only the width or height is given, then the video is scaled to the new dimension while retaining the original aspect ratio (the other dimension is also scaled proportionately). This is the default cropping mode for resizing videos if the crop mode is not specified.

For example, the uploaded mp4 video named dog scaled to a width of 150 pixels while maintaining aspect ratio:

Ruby:
cl_video_tag("dog", :width=>150, :crop=>"scale")
PHP:
cl_video_tag("dog", array("width"=>150, "crop"=>"scale"))
Python:
CloudinaryVideo("dog").video(width=150, crop="scale")
Node.js:
cloudinary.video("dog", {width: 150, crop: "scale"})
Java:
cloudinary.url().transformation(new Transformation().width(150).crop("scale")).videoTag("dog");
JS:
cloudinary.videoTag('dog', {width: 150, crop: "scale"}).toHtml();
jQuery:
$.cloudinary.video("dog", {width: 150, crop: "scale"})
React:
<Video publicId="dog" >
  <Transformation width="150" crop="scale" />
</Video>
Vue.js:
<cld-video publicId="dog" >
  <cld-transformation width="150" crop="scale" />
</cld-video>
Angular:
<cl-video public-id="dog" >
  <cl-transformation width="150" crop="scale">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation().Width(150).Crop("scale")).BuildVideoTag("dog")
Android:
MediaManager.get().url().transformation(new Transformation().width(150).crop("scale")).resourceType("video").generate("dog.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setWidth(150).setCrop("scale")).generate("dog.mp4")

fit

Change video size to fit in the given width and height while retaining the original aspect ratio with all the original video parts visible. The new dimensions of the transformed video must not exceed the specified width and/or height, but may be enlarged if the video is smaller than the new dimensions. However, the video may be smaller than the specified values in order to keep the original proportions.

For example, the uploaded mp4 video named dog fitted to a width and height of 250 pixels while retaining the aspect ratio:

Ruby:
cl_video_tag("dog", :width=>250, :height=>250, :crop=>"fit")
PHP:
cl_video_tag("dog", array("width"=>250, "height"=>250, "crop"=>"fit"))
Python:
CloudinaryVideo("dog").video(width=250, height=250, crop="fit")
Node.js:
cloudinary.video("dog", {width: 250, height: 250, crop: "fit"})
Java:
cloudinary.url().transformation(new Transformation().width(250).height(250).crop("fit")).videoTag("dog");
JS:
cloudinary.videoTag('dog', {width: 250, height: 250, crop: "fit"}).toHtml();
jQuery:
$.cloudinary.video("dog", {width: 250, height: 250, crop: "fit"})
React:
<Video publicId="dog" >
  <Transformation width="250" height="250" crop="fit" />
</Video>
Vue.js:
<cld-video publicId="dog" >
  <cld-transformation width="250" height="250" crop="fit" />
</cld-video>
Angular:
<cl-video public-id="dog" >
  <cl-transformation width="250" height="250" crop="fit">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation().Width(250).Height(250).Crop("fit")).BuildVideoTag("dog")
Android:
MediaManager.get().url().transformation(new Transformation().width(250).height(250).crop("fit")).resourceType("video").generate("dog.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setWidth(250).setHeight(250).setCrop("fit")).generate("dog.mp4")

fill

Create a video with the exact given width and height while retaining original proportions. This option first scales up or down as much as needed to at least fill both of the given dimensions. If the requested aspect ratio is different than the original, cropping will occur on the dimension that exceeds the requested size after scaling. You can specify which part of the original video you want to keep if cropping occurs using the gravity parameter. Specify the gravity manually or use auto-gravity to automatically show the most interesting area.

For example, the uploaded mp4 video named dog filled to a width and height of 250 pixels while retaining the aspect ratio:

Ruby:
cl_video_tag("dog", :width=>250, :height=>250, :crop=>"fill")
PHP:
cl_video_tag("dog", array("width"=>250, "height"=>250, "crop"=>"fill"))
Python:
CloudinaryVideo("dog").video(width=250, height=250, crop="fill")
Node.js:
cloudinary.video("dog", {width: 250, height: 250, crop: "fill"})
Java:
cloudinary.url().transformation(new Transformation().width(250).height(250).crop("fill")).videoTag("dog");
JS:
cloudinary.videoTag('dog', {width: 250, height: 250, crop: "fill"}).toHtml();
jQuery:
$.cloudinary.video("dog", {width: 250, height: 250, crop: "fill"})
React:
<Video publicId="dog" >
  <Transformation width="250" height="250" crop="fill" />
</Video>
Vue.js:
<cld-video publicId="dog" >
  <cld-transformation width="250" height="250" crop="fill" />
</cld-video>
Angular:
<cl-video public-id="dog" >
  <cl-transformation width="250" height="250" crop="fill">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation().Width(250).Height(250).Crop("fill")).BuildVideoTag("dog")
Android:
MediaManager.get().url().transformation(new Transformation().width(250).height(250).crop("fill")).resourceType("video").generate("dog.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setWidth(250).setHeight(250).setCrop("fill")).generate("dog.mp4")

limit

The limit mode is used for creating a video that does not exceed the given width and height. If the original video is smaller than the given limits, the generated video uses the same dimensions as the original one. If the original is bigger than the given limits, it will be scaled down to fit the given dimensions while retaining original proportions (similar to the fit mode in this case).

For example, the uploaded mp4 video named dog limited to a width and height of 250 pixels while retaining the aspect ratio:

Ruby:
cl_video_tag("dog", :width=>250, :height=>250, :crop=>"limit")
PHP:
cl_video_tag("dog", array("width"=>250, "height"=>250, "crop"=>"limit"))
Python:
CloudinaryVideo("dog").video(width=250, height=250, crop="limit")
Node.js:
cloudinary.video("dog", {width: 250, height: 250, crop: "limit"})
Java:
cloudinary.url().transformation(new Transformation().width(250).height(250).crop("limit")).videoTag("dog");
JS:
cloudinary.videoTag('dog', {width: 250, height: 250, crop: "limit"}).toHtml();
jQuery:
$.cloudinary.video("dog", {width: 250, height: 250, crop: "limit"})
React:
<Video publicId="dog" >
  <Transformation width="250" height="250" crop="limit" />
</Video>
Vue.js:
<cld-video publicId="dog" >
  <cld-transformation width="250" height="250" crop="limit" />
</cld-video>
Angular:
<cl-video public-id="dog" >
  <cl-transformation width="250" height="250" crop="limit">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation().Width(250).Height(250).Crop("limit")).BuildVideoTag("dog")
Android:
MediaManager.get().url().transformation(new Transformation().width(250).height(250).crop("limit")).resourceType("video").generate("dog.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setWidth(250).setHeight(250).setCrop("limit")).generate("dog.mp4")

pad

Resize the video to fill the given width and height while retaining the original aspect ratio.

If the proportions of the original video do not match the required ones, padding is added to the video to reach the required size. You can also specify which part of the original video to use for filling the required dimensions in case the proportions do not match by using the gravity parameter, and specify the color of the background in the case that padding is added.

For example, the uploaded mp4 video named dog padded to a width and height of 250 pixels while retaining the aspect ratio:

Ruby:
cl_video_tag("dog", :width=>250, :height=>250, :background=>"black", :crop=>"pad")
PHP:
cl_video_tag("dog", array("width"=>250, "height"=>250, "background"=>"black", "crop"=>"pad"))
Python:
CloudinaryVideo("dog").video(width=250, height=250, background="black", crop="pad")
Node.js:
cloudinary.video("dog", {width: 250, height: 250, background: "black", crop: "pad"})
Java:
cloudinary.url().transformation(new Transformation().width(250).height(250).background("black").crop("pad")).videoTag("dog");
JS:
cloudinary.videoTag('dog', {width: 250, height: 250, background: "black", crop: "pad"}).toHtml();
jQuery:
$.cloudinary.video("dog", {width: 250, height: 250, background: "black", crop: "pad"})
React:
<Video publicId="dog" >
  <Transformation width="250" height="250" background="black" crop="pad" />
</Video>
Vue.js:
<cld-video publicId="dog" >
  <cld-transformation width="250" height="250" background="black" crop="pad" />
</cld-video>
Angular:
<cl-video public-id="dog" >
  <cl-transformation width="250" height="250" background="black" crop="pad">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation().Width(250).Height(250).Background("black").Crop("pad")).BuildVideoTag("dog")
Android:
MediaManager.get().url().transformation(new Transformation().width(250).height(250).background("black").crop("pad")).resourceType("video").generate("dog.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setWidth(250).setHeight(250).setBackground("black").setCrop("pad")).generate("dog.mp4")

pad with blurred video background

You may sometimes need to deliver a video with an aspect ratio very different than the target video player dimensions, for example delivering a portrait video in a landscape-oriented video player. In these cases, you can use a blurred version of the same video as the padding background. To do this, specify the blurred value instead of a color as the background. You can also optionally specify the intensity of the blur effect (range: 1-2000, default 100) and the brightness of the background video (range: -300-100, default 0).

For example, deliver this video of a talented kid solving a rubiks cube in a 320*480 HTML5 video player by padding the portrait video with a blurred version of the same video at an intensity of 400 and a brightness of 15.

Ruby:
cl_video_tag("cld_rubiks_guy", :height=>320, :width=>480, :background=>"blurred:400:15", :crop=>"pad")
PHP:
cl_video_tag("cld_rubiks_guy", array("height"=>320, "width"=>480, "background"=>"blurred:400:15", "crop"=>"pad"))
Python:
CloudinaryVideo("cld_rubiks_guy").video(height=320, width=480, background="blurred:400:15", crop="pad")
Node.js:
cloudinary.video("cld_rubiks_guy", {height: 320, width: 480, background: "blurred:400:15", crop: "pad"})
Java:
cloudinary.url().transformation(new Transformation().height(320).width(480).background("blurred:400:15").crop("pad")).videoTag("cld_rubiks_guy");
JS:
cloudinary.videoTag('cld_rubiks_guy', {height: 320, width: 480, background: "blurred:400:15", crop: "pad"}).toHtml();
jQuery:
$.cloudinary.video("cld_rubiks_guy", {height: 320, width: 480, background: "blurred:400:15", crop: "pad"})
React:
<Video publicId="cld_rubiks_guy" >
  <Transformation height="320" width="480" background="blurred:400:15" crop="pad" />
</Video>
Vue.js:
<cld-video publicId="cld_rubiks_guy" >
  <cld-transformation height="320" width="480" background="blurred:400:15" crop="pad" />
</cld-video>
Angular:
<cl-video public-id="cld_rubiks_guy" >
  <cl-transformation height="320" width="480" background="blurred:400:15" crop="pad">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation().Height(320).Width(480).Background("blurred:400:15").Crop("pad")).BuildVideoTag("cld_rubiks_guy")
Android:
MediaManager.get().url().transformation(new Transformation().height(320).width(480).background("blurred:400:15").crop("pad")).resourceType("video").generate("cld_rubiks_guy.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setHeight(320).setWidth(480).setBackground("blurred:400:15").setCrop("pad")).generate("cld_rubiks_guy.mp4")

lpad

Same as the pad mode above, but doesn't scale the video up if your requested dimensions are larger than the original video's.

For example, the uploaded mp4 video named dog lpadded to a width and height of 250 pixels while retaining the aspect ratio and limiting the size to no larger than the original video:

Ruby:
cl_video_tag("dog", :width=>250, :height=>250, :background=>"black", :crop=>"lpad")
PHP:
cl_video_tag("dog", array("width"=>250, "height"=>250, "background"=>"black", "crop"=>"lpad"))
Python:
CloudinaryVideo("dog").video(width=250, height=250, background="black", crop="lpad")
Node.js:
cloudinary.video("dog", {width: 250, height: 250, background: "black", crop: "lpad"})
Java:
cloudinary.url().transformation(new Transformation().width(250).height(250).background("black").crop("lpad")).videoTag("dog");
JS:
cloudinary.videoTag('dog', {width: 250, height: 250, background: "black", crop: "lpad"}).toHtml();
jQuery:
$.cloudinary.video("dog", {width: 250, height: 250, background: "black", crop: "lpad"})
React:
<Video publicId="dog" >
  <Transformation width="250" height="250" background="black" crop="lpad" />
</Video>
Vue.js:
<cld-video publicId="dog" >
  <cld-transformation width="250" height="250" background="black" crop="lpad" />
</cld-video>
Angular:
<cl-video public-id="dog" >
  <cl-transformation width="250" height="250" background="black" crop="lpad">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation().Width(250).Height(250).Background("black").Crop("lpad")).BuildVideoTag("dog")
Android:
MediaManager.get().url().transformation(new Transformation().width(250).height(250).background("black").crop("lpad")).resourceType("video").generate("dog.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setWidth(250).setHeight(250).setBackground("black").setCrop("lpad")).generate("dog.mp4")

crop

Extract only part of a given width and height out of the original video. The original proportions are retained and you can also specify which part of the original video to use for filling the required dimensions by giving the x and y coordinates of the top left corner, or by using the gravity parameter.

For example, cropping the uploaded mp4 video named dog to a width of 350 pixels and a height of 200 pixels, starting at the x = 230 pixels and y = 20 pixels coordinate:

Ruby:
cl_video_tag("dog", :width=>350, :height=>200, :x=>230, :y=>20, :crop=>"crop")
PHP:
cl_video_tag("dog", array("width"=>350, "height"=>200, "x"=>230, "y"=>20, "crop"=>"crop"))
Python:
CloudinaryVideo("dog").video(width=350, height=200, x=230, y=20, crop="crop")
Node.js:
cloudinary.video("dog", {width: 350, height: 200, x: 230, y: 20, crop: "crop"})
Java:
cloudinary.url().transformation(new Transformation().width(350).height(200).x(230).y(20).crop("crop")).videoTag("dog");
JS:
cloudinary.videoTag('dog', {width: 350, height: 200, x: 230, y: 20, crop: "crop"}).toHtml();
jQuery:
$.cloudinary.video("dog", {width: 350, height: 200, x: 230, y: 20, crop: "crop"})
React:
<Video publicId="dog" >
  <Transformation width="350" height="200" x="230" y="20" crop="crop" />
</Video>
Vue.js:
<cld-video publicId="dog" >
  <cld-transformation width="350" height="200" x="230" y="20" crop="crop" />
</cld-video>
Angular:
<cl-video public-id="dog" >
  <cl-transformation width="350" height="200" x="230" y="20" crop="crop">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation().Width(350).Height(200).X(230).Y(20).Crop("crop")).BuildVideoTag("dog")
Android:
MediaManager.get().url().transformation(new Transformation().width(350).height(200).x(230).y(20).crop("crop")).resourceType("video").generate("dog.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setWidth(350).setHeight(200).setX(230).setY(20).setCrop("crop")).generate("dog.mp4")

Aspect ratio

Use the aspect_ratio parameter (ar in URLs) to resize the video to a new aspect ratio. This parameter is used together with a specified crop mode that determines how the video is adjusted to the new dimensions. This parameter can also be used when changing the dimensions of a video with only the width or height parameters (w and h in URLs) - the other dimension is then automatically updated to maintain the given aspect ratio.

The aspect_ratio parameter accepts a value in one of the following forms:

  • a:b where a signifies the relative width and b the relative height (e.g., 4:3 or 16:9).
  • a decimal value representing the ratio of the width divided by the height (e.g., 1.33 or 2.5).

Examples with the uploaded mp4 video named dog:

  1. Cropped to an aspect ratio of 2.5:

    Ruby:
    cl_video_tag("dog", :aspect_ratio=>"2.5", :crop=>"crop")
    PHP:
    cl_video_tag("dog", array("aspect_ratio"=>"2.5", "crop"=>"crop"))
    Python:
    CloudinaryVideo("dog").video(aspect_ratio="2.5", crop="crop")
    Node.js:
    cloudinary.video("dog", {aspect_ratio: "2.5", crop: "crop"})
    Java:
    cloudinary.url().transformation(new Transformation().aspectRatio("2.5").crop("crop")).videoTag("dog");
    JS:
    cloudinary.videoTag('dog', {aspectRatio: "2.5", crop: "crop"}).toHtml();
    jQuery:
    $.cloudinary.video("dog", {aspect_ratio: "2.5", crop: "crop"})
    React:
    <Video publicId="dog" >
      <Transformation aspectRatio="2.5" crop="crop" />
    </Video>
    Vue.js:
    <cld-video publicId="dog" >
      <cld-transformation aspectRatio="2.5" crop="crop" />
    </cld-video>
    Angular:
    <cl-video public-id="dog" >
      <cl-transformation aspect-ratio="2.5" crop="crop">
      </cl-transformation>
    </cl-video>
    .Net:
    cloudinary.Api.UrlVideoUp.Transform(new Transformation().AspectRatio("2.5").Crop("crop")).BuildVideoTag("dog")
    Android:
    MediaManager.get().url().transformation(new Transformation().aspectRatio("2.5").crop("crop")).resourceType("video").generate("dog.mp4");
    iOS:
    cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setAspectRatio("2.5").setCrop("crop")).generate("dog.mp4")

  2. Filled to a width of 400 pixels with an aspect ratio of 4:3:

    Ruby:
    cl_video_tag("dog", :width=>400, :aspect_ratio=>"4:3", :crop=>"fill")
    PHP:
    cl_video_tag("dog", array("width"=>400, "aspect_ratio"=>"4:3", "crop"=>"fill"))
    Python:
    CloudinaryVideo("dog").video(width=400, aspect_ratio="4:3", crop="fill")
    Node.js:
    cloudinary.video("dog", {width: 400, aspect_ratio: "4:3", crop: "fill"})
    Java:
    cloudinary.url().transformation(new Transformation().width(400).aspectRatio("4:3").crop("fill")).videoTag("dog");
    JS:
    cloudinary.videoTag('dog', {width: 400, aspectRatio: "4:3", crop: "fill"}).toHtml();
    jQuery:
    $.cloudinary.video("dog", {width: 400, aspect_ratio: "4:3", crop: "fill"})
    React:
    <Video publicId="dog" >
      <Transformation width="400" aspectRatio="4:3" crop="fill" />
    </Video>
    Vue.js:
    <cld-video publicId="dog" >
      <cld-transformation width="400" aspectRatio="4:3" crop="fill" />
    </cld-video>
    Angular:
    <cl-video public-id="dog" >
      <cl-transformation width="400" aspect-ratio="4:3" crop="fill">
      </cl-transformation>
    </cl-video>
    .Net:
    cloudinary.Api.UrlVideoUp.Transform(new Transformation().Width(400).AspectRatio("4:3").Crop("fill")).BuildVideoTag("dog")
    Android:
    MediaManager.get().url().transformation(new Transformation().width(400).aspectRatio("4:3").crop("fill")).resourceType("video").generate("dog.mp4");
    iOS:
    cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setWidth(400).setAspectRatio("4:3").setCrop("fill")).generate("dog.mp4")

Set Device Pixel Ratio (DPR)

Different devices support different DPR values, which is defined as the ratio between physical pixels and logical pixels. This means that a device with support for a higher DPR uses more physical pixels for displaying a video, resulting in a clearer, sharper video.

DPR illustration

Use the dpr parameter to set the DPR value of the delivered video. The parameter accepts a float value specifying the DPR multiplier.

For example, the following URL dynamically generates the video named dog scaled to a width of 100 pixels. Setting the dpr value to 1.0, 2.0 (as in the code example) or 3.0 generates the following videos, while resizing the video to match the required DPR.

Ruby:
cl_video_tag("dog", :transformation=>[
  {:width=>100, :crop=>"scale"},
  {:dpr=>2.0}
  ])
PHP:
cl_video_tag("dog", array("transformation"=>array(
  array("width"=>100, "crop"=>"scale"),
  array("dpr"=>2.0)
  )))
Python:
CloudinaryVideo("dog").video(transformation=[
  {'width': 100, 'crop': "scale"},
  {'dpr': 2.0}
  ])
Node.js:
cloudinary.video("dog", {transformation: [
  {width: 100, crop: "scale"},
  {dpr: "2.0"}
  ]})
Java:
cloudinary.url().transformation(new Transformation()
  .width(100).crop("scale").chain()
  .dpr(2.0)).videoTag("dog");
JS:
cloudinary.videoTag('dog', {transformation: [
  {width: 100, crop: "scale"},
  {dpr: "2.0"}
  ]}).toHtml();
jQuery:
$.cloudinary.video("dog", {transformation: [
  {width: 100, crop: "scale"},
  {dpr: "2.0"}
  ]})
React:
<Video publicId="dog" >
  <Transformation width="100" crop="scale" />
  <Transformation dpr="2.0" />
</Video>
Vue.js:
<cld-video publicId="dog" >
  <cld-transformation width="100" crop="scale" />
  <cld-transformation dpr="2.0" />
</cld-video>
Angular:
<cl-video public-id="dog" >
  <cl-transformation width="100" crop="scale">
  </cl-transformation>
  <cl-transformation dpr="2.0">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation()
  .Width(100).Crop("scale").Chain()
  .Dpr(2.0)).BuildVideoTag("dog")
Android:
MediaManager.get().url().transformation(new Transformation()
  .width(100).crop("scale").chain()
  .dpr(2.0)).resourceType("video").generate("dog.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation()
  .setWidth(100).setCrop("scale").chain()
  .setDpr(2.0)).generate("dog.mp4")

    DPR 1.0                                        DPR 2.0                                                               DPR 3.0

Now you can create a HTML video tag with the required dimensions and deliver a video with the resolution that best matches the specified pixel density of your users' devices. The three videos below are all displayed with a width of 200 pixels using the <video> tag width attribute, while you see more details and a better visual result for the last two videos (dpr 2 and dpr 3 respectively) if you view this documentation using a device that supports a higher DPR.

<video poster="https://res.cloudinary.com/demo/video/upload/w_200,dpr_2.0/dog.jpg" width="200">
  <source src="https://res.cloudinary.com/demo/video/upload/w_200,dpr_2.0/dog.webm" type="video/webm"/>
  <source src="https://res.cloudinary.com/demo/video/upload/w_200,dpr_2.0/dog.mp4" type="video/mp4"/>
  <source src="https://res.cloudinary.com/demo/video/upload/w_200,dpr_2.0/dog.ogv" type="video/ogg"/>
</video>

   DPR 1.0 (200 width, 331KB)              DPR 2.0 (400 width, 437KB)               DPR 3.0 (600 width, 474KB)

Gravity

Gravity specifies which part of the original video to use for certain cropping modes, for filling the required dimensions in case the proportions do not match. This is accomplished by using the gravity parameter (g in URLs). The supported fixed location gravity values are: north_east, north, north_west, west, south_west, south, south_east, east, or center (the default value). You can also specify a gravity value of auto to automatically crop your video.

For example, the uploaded mp4 video named dog filled to a width and height of 250 pixels while retaining the aspect ratio, with gravity set to north:

Ruby:
cl_video_tag("dog", :width=>250, :height=>250, :gravity=>"north", :crop=>"fill")
PHP:
cl_video_tag("dog", array("width"=>250, "height"=>250, "gravity"=>"north", "crop"=>"fill"))
Python:
CloudinaryVideo("dog").video(width=250, height=250, gravity="north", crop="fill")
Node.js:
cloudinary.video("dog", {width: 250, height: 250, gravity: "north", crop: "fill"})
Java:
cloudinary.url().transformation(new Transformation().width(250).height(250).gravity("north").crop("fill")).videoTag("dog");
JS:
cloudinary.videoTag('dog', {width: 250, height: 250, gravity: "north", crop: "fill"}).toHtml();
jQuery:
$.cloudinary.video("dog", {width: 250, height: 250, gravity: "north", crop: "fill"})
React:
<Video publicId="dog" >
  <Transformation width="250" height="250" gravity="north" crop="fill" />
</Video>
Vue.js:
<cld-video publicId="dog" >
  <cld-transformation width="250" height="250" gravity="north" crop="fill" />
</cld-video>
Angular:
<cl-video public-id="dog" >
  <cl-transformation width="250" height="250" gravity="north" crop="fill">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation().Width(250).Height(250).Gravity("north").Crop("fill")).BuildVideoTag("dog")
Android:
MediaManager.get().url().transformation(new Transformation().width(250).height(250).gravity("north").crop("fill")).resourceType("video").generate("dog.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setWidth(250).setHeight(250).setGravity("north").setCrop("fill")).generate("dog.mp4")

Automatic Cropping (Beta)

Automatic gravity selection ensures that the most interesting areas are selected as the main focus throughout the duration of each video. Each video is analyzed to find the optimal region, allowing you to adjust the size or aspect ratio to fit all of your requirements. As the optimal region of the video could be moving from frame to frame, the cropped area will adjust accordingly.

Apply automatic content-aware gravity by cropping your video with the fill crop mode and setting the gravity transformation parameter to auto (g_auto in URLs).

For example, to crop this video to a square aspect ratio whilst keeping the ship as the main focus throughout:

Ruby:
cl_video_tag("ship", :width=>300, :gravity=>"auto", :aspect_ratio=>"1:1", :crop=>"fill")
PHP:
cl_video_tag("ship", array("width"=>300, "gravity"=>"auto", "aspect_ratio"=>"1:1", "crop"=>"fill"))
Python:
CloudinaryVideo("ship").video(width=300, gravity="auto", aspect_ratio="1:1", crop="fill")
Node.js:
cloudinary.video("ship", {width: 300, gravity: "auto", aspect_ratio: "1:1", crop: "fill"})
Java:
cloudinary.url().transformation(new Transformation().width(300).gravity("auto").aspectRatio("1:1").crop("fill")).videoTag("ship");
JS:
cloudinary.videoTag('ship', {width: 300, gravity: "auto", aspectRatio: "1:1", crop: "fill"}).toHtml();
jQuery:
$.cloudinary.video("ship", {width: 300, gravity: "auto", aspect_ratio: "1:1", crop: "fill"})
React:
<Video publicId="ship" >
  <Transformation width="300" gravity="auto" aspectRatio="1:1" crop="fill" />
</Video>
Vue.js:
<cld-video publicId="ship" >
  <cld-transformation width="300" gravity="auto" aspectRatio="1:1" crop="fill" />
</cld-video>
Angular:
<cl-video public-id="ship" >
  <cl-transformation width="300" gravity="auto" aspect-ratio="1:1" crop="fill">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation().Width(300).Gravity("auto").AspectRatio("1:1").Crop("fill")).BuildVideoTag("ship")
Android:
MediaManager.get().url().transformation(new Transformation().width(300).gravity("auto").aspectRatio("1:1").crop("fill")).resourceType("video").generate("ship.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setWidth(300).setGravity("auto").setAspectRatio("1:1").setCrop("fill")).generate("ship.mp4")

Comparison with default gravity

Below is a comparison between the original video of a dog catching a frisbee, and the same video with the aspect ratio inverted. The left video was cropped using default center gravity and the other using automatic gravity. Watch how the auto cropped (right-hand) video keeps the main subject (the dog) in view at all times, even as it moves across the frame in the original video.

Click any video below to see the comparison in action or use our automatic cropping demo to try it on a variety of samples or on your own videos.

Original video
Default crop
(Center gravity)
Auto-gravity

Notes and Tips:

  • The automatic cropping algorithm analyzes the entire video to determine the areas to focus on, which means it can take several seconds or minutes, depending on the length of the original video (an HTTP 423 error will be returned until the analysis is complete). Therefore, it's recommended to generate the transformation eagerly during upload or using an explicit method call for existing videos, along with an eager_notification_url parameter to notify your application when the content aware cropping transformation is ready for delivery.
  • Once a video has been analyzed by the automatic cropping algorithm, any subsequent transformations will happen on-the-fly as usual. This includes adjusting the size and aspect ratio.
  • Automatic cropping works best when there's a single subject in your video.
  • You can only use automatic gravity once per transformation and not within a layer.

Background color

Use the background parameter (b in URLs) to set the color in the case of padding added with the “pad” crop mode. The color can be set as an RGB hex triplet (e.g. b_rgb:3e2222), a 3 character RGB hex (e.g. b_rgb:777) or a named color (e.g. b_green). Cloudinary's client libraries also support a # shortcut for RGB (e.g. setting background to #3e2222 which is then translated to b_rgb:3e2222).

For example, the uploaded mp4 video named dog padded to a width and height of 300 pixels with a green background:

Ruby:
cl_video_tag("dog", :width=>300, :height=>300, :background=>"green", :crop=>"pad")
PHP:
cl_video_tag("dog", array("width"=>300, "height"=>300, "background"=>"green", "crop"=>"pad"))
Python:
CloudinaryVideo("dog").video(width=300, height=300, background="green", crop="pad")
Node.js:
cloudinary.video("dog", {width: 300, height: 300, background: "green", crop: "pad"})
Java:
cloudinary.url().transformation(new Transformation().width(300).height(300).background("green").crop("pad")).videoTag("dog");
JS:
cloudinary.videoTag('dog', {width: 300, height: 300, background: "green", crop: "pad"}).toHtml();
jQuery:
$.cloudinary.video("dog", {width: 300, height: 300, background: "green", crop: "pad"})
React:
<Video publicId="dog" >
  <Transformation width="300" height="300" background="green" crop="pad" />
</Video>
Vue.js:
<cld-video publicId="dog" >
  <cld-transformation width="300" height="300" background="green" crop="pad" />
</cld-video>
Angular:
<cl-video public-id="dog" >
  <cl-transformation width="300" height="300" background="green" crop="pad">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation().Width(300).Height(300).Background("green").Crop("pad")).BuildVideoTag("dog")
Android:
MediaManager.get().url().transformation(new Transformation().width(300).height(300).background("green").crop("pad")).resourceType("video").generate("dog.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setWidth(300).setHeight(300).setBackground("green").setCrop("pad")).generate("dog.mp4")

Trimming videos

Trim a video (and discard the rest) by using a combination of the following 3 parameters to specify the section of video to keep after trimming:

  • start_offset (so in URLs) specifies the start.
  • end_offset (eo in URLs) specifies the end.
  • duration (du in URLs) specifies the duration.

Possible values:

  • A float representing the time in seconds e.g. 5.44 (5 seconds and 440 milliseconds)
  • A string representing the percentage of the video length. This string consists of a number with a p appended e.g. 35p (0p is the first frame and 100p is the last frame). The client libraries also support appending a % instead of a p.

Examples with the uploaded mp4 video named dog:

  1. Trimming the video to the section that starts at 6.5 seconds and ends at 10 seconds:

    Ruby:
    cl_video_tag("dog", :start_offset=>"6.5", :end_offset=>"10")
    PHP:
    cl_video_tag("dog", array("start_offset"=>"6.5", "end_offset"=>"10"))
    Python:
    CloudinaryVideo("dog").video(start_offset="6.5", end_offset="10")
    Node.js:
    cloudinary.video("dog", {start_offset: "6.5", end_offset: "10"})
    Java:
    cloudinary.url().transformation(new Transformation().startOffset("6.5").endOffset("10")).videoTag("dog");
    JS:
    cloudinary.videoTag('dog', {startOffset: "6.5", endOffset: "10"}).toHtml();
    jQuery:
    $.cloudinary.video("dog", {start_offset: "6.5", end_offset: "10"})
    React:
    <Video publicId="dog" >
      <Transformation startOffset="6.5" endOffset="10" />
    </Video>
    Vue.js:
    <cld-video publicId="dog" >
      <cld-transformation startOffset="6.5" endOffset="10" />
    </cld-video>
    Angular:
    <cl-video public-id="dog" >
      <cl-transformation start-offset="6.5" end-offset="10">
      </cl-transformation>
    </cl-video>
    .Net:
    cloudinary.Api.UrlVideoUp.Transform(new Transformation().StartOffset("6.5").EndOffset("10")).BuildVideoTag("dog")
    Android:
    MediaManager.get().url().transformation(new Transformation().startOffset("6.5").endOffset("10")).resourceType("video").generate("dog.mp4");
    iOS:
    cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setStartOffset("6.5").setEndOffset("10")).generate("dog.mp4")

  2. Trimming the video to the section that starts at 10 percent with a duration of 30 percent (effectively from the 10 percent mark to the 40 percent mark):

    Ruby:
    cl_video_tag("dog", :start_offset=>"10p", :duration=>"30p")
    PHP:
    cl_video_tag("dog", array("start_offset"=>"10p", "duration"=>"30p"))
    Python:
    CloudinaryVideo("dog").video(start_offset="10p", duration="30p")
    Node.js:
    cloudinary.video("dog", {start_offset: "10p", duration: "30p"})
    Java:
    cloudinary.url().transformation(new Transformation().startOffset("10p").duration("30p")).videoTag("dog");
    JS:
    cloudinary.videoTag('dog', {startOffset: "10p", duration: "30p"}).toHtml();
    jQuery:
    $.cloudinary.video("dog", {start_offset: "10p", duration: "30p"})
    React:
    <Video publicId="dog" >
      <Transformation startOffset="10p" duration="30p" />
    </Video>
    Vue.js:
    <cld-video publicId="dog" >
      <cld-transformation startOffset="10p" duration="30p" />
    </cld-video>
    Angular:
    <cl-video public-id="dog" >
      <cl-transformation start-offset="10p" duration="30p">
      </cl-transformation>
    </cl-video>
    .Net:
    cloudinary.Api.UrlVideoUp.Transform(new Transformation().StartOffset("10p").Duration("30p")).BuildVideoTag("dog")
    Android:
    MediaManager.get().url().transformation(new Transformation().startOffset("10p").duration("30p")).resourceType("video").generate("dog.mp4");
    iOS:
    cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setStartOffset("10p").setDuration("30p")).generate("dog.mp4")

Client libraries also support the offset shortcut parameter to combine the 2 values representing the start and end of the video to keep e.g. [2.5, 9.5] or ['10p', '30p']. In frameworks that support ranges you can use: 2.66..3.21 or '35%..70%'. An equivalent of the offset shortcut is not available for URLs.

For example, trimming the uploaded mp4 video named dog to the section that starts at 6.5 seconds and ends at 10 seconds:

Ruby:
cl_video_tag("dog", :start_offset=>"6.5", :end_offset=>"10")
PHP:
cl_video_tag("dog", array("start_offset"=>"6.5", "end_offset"=>"10"))
Python:
CloudinaryVideo("dog").video(start_offset="6.5", end_offset="10")
Node.js:
cloudinary.video("dog", {start_offset: "6.5", end_offset: "10"})
Java:
cloudinary.url().transformation(new Transformation().startOffset("6.5").endOffset("10")).videoTag("dog");
JS:
cloudinary.videoTag('dog', {startOffset: "6.5", endOffset: "10"}).toHtml();
jQuery:
$.cloudinary.video("dog", {start_offset: "6.5", end_offset: "10"})
React:
<Video publicId="dog" >
  <Transformation startOffset="6.5" endOffset="10" />
</Video>
Vue.js:
<cld-video publicId="dog" >
  <cld-transformation startOffset="6.5" endOffset="10" />
</cld-video>
Angular:
<cl-video public-id="dog" >
  <cl-transformation start-offset="6.5" end-offset="10">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation().StartOffset("6.5").EndOffset("10")).BuildVideoTag("dog")
Android:
MediaManager.get().url().transformation(new Transformation().startOffset("6.5").endOffset("10")).resourceType("video").generate("dog.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setStartOffset("6.5").setEndOffset("10")).generate("dog.mp4")

Concatenating videos

Cloudinary supports the concatenation of videos by using the overlay video parameter (l_video: in URLs) to specify the name of another uploaded video and then the splice flag (fl_splice in URLs) to indicate that the video should be concatenated on to the container video and not added as an overlay.

You can also concatenate videos with custom transitions using the transition effect (e_transition in URLs).

Note
Videos spliced together or concatenated with a custom transition must be the same width and height. You can use size transformation parameters to ensure that both videos match in size (w and h). If using a transition video, this will be automatically scaled to the same size.

For example, to concatenate the video named dog on to the end of the video named kitten_fighting, with both videos set to a width of 300 pixels and a height of 200 pixels:

Ruby:
cl_video_tag("kitten_fighting", :transformation=>[
  {:width=>300, :height=>200, :crop=>"fill"},
  {:overlay=>"video:dog", :flags=>"splice", :width=>300, :height=>200, :crop=>"fill"}
  ])
PHP:
cl_video_tag("kitten_fighting", array("transformation"=>array(
  array("width"=>300, "height"=>200, "crop"=>"fill"),
  array("overlay"=>"video:dog", "flags"=>"splice", "width"=>300, "height"=>200, "crop"=>"fill")
  )))
Python:
CloudinaryVideo("kitten_fighting").video(transformation=[
  {'width': 300, 'height': 200, 'crop': "fill"},
  {'overlay': "video:dog", 'flags': "splice", 'width': 300, 'height': 200, 'crop': "fill"}
  ])
Node.js:
cloudinary.video("kitten_fighting", {transformation: [
  {width: 300, height: 200, crop: "fill"},
  {overlay: "video:dog", flags: "splice", width: 300, height: 200, crop: "fill"}
  ]})
Java:
cloudinary.url().transformation(new Transformation()
  .width(300).height(200).crop("fill").chain()
  .overlay(new Layer().publicId("video:dog")).flags("splice").width(300).height(200).crop("fill")).videoTag("kitten_fighting");
JS:
cloudinary.videoTag('kitten_fighting', {transformation: [
  {width: 300, height: 200, crop: "fill"},
  {overlay: new cloudinary.Layer().publicId("video:dog"), flags: "splice", width: 300, height: 200, crop: "fill"}
  ]}).toHtml();
jQuery:
$.cloudinary.video("kitten_fighting", {transformation: [
  {width: 300, height: 200, crop: "fill"},
  {overlay: new cloudinary.Layer().publicId("video:dog"), flags: "splice", width: 300, height: 200, crop: "fill"}
  ]})
React:
<Video publicId="kitten_fighting" >
  <Transformation width="300" height="200" crop="fill" />
  <Transformation overlay="video:dog" flags="splice" width="300" height="200" crop="fill" />
</Video>
Vue.js:
<cld-video publicId="kitten_fighting" >
  <cld-transformation width="300" height="200" crop="fill" />
  <cld-transformation overlay="video:dog" flags="splice" width="300" height="200" crop="fill" />
</cld-video>
Angular:
<cl-video public-id="kitten_fighting" >
  <cl-transformation width="300" height="200" crop="fill">
  </cl-transformation>
  <cl-transformation overlay="video:dog" flags="splice" width="300" height="200" crop="fill">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation()
  .Width(300).Height(200).Crop("fill").Chain()
  .Overlay(new Layer().PublicId("video:dog")).Flags("splice").Width(300).Height(200).Crop("fill")).BuildVideoTag("kitten_fighting")
Android:
MediaManager.get().url().transformation(new Transformation()
  .width(300).height(200).crop("fill").chain()
  .overlay(new Layer().publicId("video:dog")).flags("splice").width(300).height(200).crop("fill")).resourceType("video").generate("kitten_fighting.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation()
  .setWidth(300).setHeight(200).setCrop("fill").chain()
  .setOverlay("video:dog").setFlags("splice").setWidth(300).setHeight(200).setCrop("fill")).generate("kitten_fighting.mp4")

By default, the video is spliced on to the end of the container video: to splice the video on to the beginning, add the start_offset parameter and set it to 0 (so_0 in URLs). For example, to concatenate the video named dog on to the beginning of the video named kitten_fighting, with both videos set to a width of 300 pixels and a height of 200 pixels:

Ruby:
cl_video_tag("kitten_fighting", :transformation=>[
  {:width=>300, :height=>200, :crop=>"fill"},
  {:overlay=>"video:dog", :flags=>"splice", :width=>300, :height=>200, :start_offset=>"0", :crop=>"fill"}
  ])
PHP:
cl_video_tag("kitten_fighting", array("transformation"=>array(
  array("width"=>300, "height"=>200, "crop"=>"fill"),
  array("overlay"=>"video:dog", "flags"=>"splice", "width"=>300, "height"=>200, "start_offset"=>"0", "crop"=>"fill")
  )))
Python:
CloudinaryVideo("kitten_fighting").video(transformation=[
  {'width': 300, 'height': 200, 'crop': "fill"},
  {'overlay': "video:dog", 'flags': "splice", 'width': 300, 'height': 200, 'start_offset': "0", 'crop': "fill"}
  ])
Node.js:
cloudinary.video("kitten_fighting", {transformation: [
  {width: 300, height: 200, crop: "fill"},
  {overlay: "video:dog", flags: "splice", width: 300, height: 200, start_offset: "0", crop: "fill"}
  ]})
Java:
cloudinary.url().transformation(new Transformation()
  .width(300).height(200).crop("fill").chain()
  .overlay(new Layer().publicId("video:dog")).flags("splice").width(300).height(200).startOffset("0").crop("fill")).videoTag("kitten_fighting");
JS:
cloudinary.videoTag('kitten_fighting', {transformation: [
  {width: 300, height: 200, crop: "fill"},
  {overlay: new cloudinary.Layer().publicId("video:dog"), flags: "splice", width: 300, height: 200, startOffset: "0", crop: "fill"}
  ]}).toHtml();
jQuery:
$.cloudinary.video("kitten_fighting", {transformation: [
  {width: 300, height: 200, crop: "fill"},
  {overlay: new cloudinary.Layer().publicId("video:dog"), flags: "splice", width: 300, height: 200, start_offset: "0", crop: "fill"}
  ]})
React:
<Video publicId="kitten_fighting" >
  <Transformation width="300" height="200" crop="fill" />
  <Transformation overlay="video:dog" flags="splice" width="300" height="200" startOffset="0" crop="fill" />
</Video>
Vue.js:
<cld-video publicId="kitten_fighting" >
  <cld-transformation width="300" height="200" crop="fill" />
  <cld-transformation overlay="video:dog" flags="splice" width="300" height="200" startOffset="0" crop="fill" />
</cld-video>
Angular:
<cl-video public-id="kitten_fighting" >
  <cl-transformation width="300" height="200" crop="fill">
  </cl-transformation>
  <cl-transformation overlay="video:dog" flags="splice" width="300" height="200" start-offset="0" crop="fill">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation()
  .Width(300).Height(200).Crop("fill").Chain()
  .Overlay(new Layer().PublicId("video:dog")).Flags("splice").Width(300).Height(200).StartOffset("0").Crop("fill")).BuildVideoTag("kitten_fighting")
Android:
MediaManager.get().url().transformation(new Transformation()
  .width(300).height(200).crop("fill").chain()
  .overlay(new Layer().publicId("video:dog")).flags("splice").width(300).height(200).startOffset("0").crop("fill")).resourceType("video").generate("kitten_fighting.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation()
  .setWidth(300).setHeight(200).setCrop("fill").chain()
  .setOverlay("video:dog").setFlags("splice").setWidth(300).setHeight(200).setStartOffset("0").setCrop("fill")).generate("kitten_fighting.mp4")

To concatenate only a section of a video on to another video use the offset parameters (see Trimming videos for more information on the parameters and their possible values) together with the layer_apply flag (fl_layer_apply in URLs). For example, to splice the first 5 seconds of the video named dog to the end of the same video named dog rotated by 180 degrees, with both videos set to a width of 300 pixels and a height of 200 pixels.

Ruby:
cl_video_tag("dog", :transformation=>[
  {:angle=>180},
  {:width=>300, :height=>200, :crop=>"fill"},
  {:overlay=>"video:dog", :flags=>"splice", :width=>300, :height=>200, :start_offset=>"0", :duration=>"5", :crop=>"fill"},
  {:flags=>"layer_apply"}
  ])
PHP:
cl_video_tag("dog", array("transformation"=>array(
  array("angle"=>180),
  array("width"=>300, "height"=>200, "crop"=>"fill"),
  array("overlay"=>"video:dog", "flags"=>"splice", "width"=>300, "height"=>200, "start_offset"=>"0", "duration"=>"5", "crop"=>"fill"),
  array("flags"=>"layer_apply")
  )))
Python:
CloudinaryVideo("dog").video(transformation=[
  {'angle': 180},
  {'width': 300, 'height': 200, 'crop': "fill"},
  {'overlay': "video:dog", 'flags': "splice", 'width': 300, 'height': 200, 'start_offset': "0", 'duration': "5", 'crop': "fill"},
  {'flags': "layer_apply"}
  ])
Node.js:
cloudinary.video("dog", {transformation: [
  {angle: 180},
  {width: 300, height: 200, crop: "fill"},
  {overlay: "video:dog", flags: "splice", width: 300, height: 200, start_offset: "0", duration: "5", crop: "fill"},
  {flags: "layer_apply"}
  ]})
Java:
cloudinary.url().transformation(new Transformation()
  .angle(180).chain()
  .width(300).height(200).crop("fill").chain()
  .overlay(new Layer().publicId("video:dog")).flags("splice").width(300).height(200).startOffset("0").duration("5").crop("fill").chain()
  .flags("layer_apply")).videoTag("dog");
JS:
cloudinary.videoTag('dog', {transformation: [
  {angle: 180},
  {width: 300, height: 200, crop: "fill"},
  {overlay: new cloudinary.Layer().publicId("video:dog"), flags: "splice", width: 300, height: 200, startOffset: "0", duration: "5", crop: "fill"},
  {flags: "layer_apply"}
  ]}).toHtml();
jQuery:
$.cloudinary.video("dog", {transformation: [
  {angle: 180},
  {width: 300, height: 200, crop: "fill"},
  {overlay: new cloudinary.Layer().publicId("video:dog"), flags: "splice", width: 300, height: 200, start_offset: "0", duration: "5", crop: "fill"},
  {flags: "layer_apply"}
  ]})
React:
<Video publicId="dog" >
  <Transformation angle="180" />
  <Transformation width="300" height="200" crop="fill" />
  <Transformation overlay="video:dog" flags="splice" width="300" height="200" startOffset="0" duration="5" crop="fill" />
  <Transformation flags="layer_apply" />
</Video>
Vue.js:
<cld-video publicId="dog" >
  <cld-transformation angle="180" />
  <cld-transformation width="300" height="200" crop="fill" />
  <cld-transformation overlay="video:dog" flags="splice" width="300" height="200" startOffset="0" duration="5" crop="fill" />
  <cld-transformation flags="layer_apply" />
</cld-video>
Angular:
<cl-video public-id="dog" >
  <cl-transformation angle="180">
  </cl-transformation>
  <cl-transformation width="300" height="200" crop="fill">
  </cl-transformation>
  <cl-transformation overlay="video:dog" flags="splice" width="300" height="200" start-offset="0" duration="5" crop="fill">
  </cl-transformation>
  <cl-transformation flags="layer_apply">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation()
  .Angle(180).Chain()
  .Width(300).Height(200).Crop("fill").Chain()
  .Overlay(new Layer().PublicId("video:dog")).Flags("splice").Width(300).Height(200).StartOffset("0").Duration("5").Crop("fill").Chain()
  .Flags("layer_apply")).BuildVideoTag("dog")
Android:
MediaManager.get().url().transformation(new Transformation()
  .angle(180).chain()
  .width(300).height(200).crop("fill").chain()
  .overlay(new Layer().publicId("video:dog")).flags("splice").width(300).height(200).startOffset("0").duration("5").crop("fill").chain()
  .flags("layer_apply")).resourceType("video").generate("dog.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation()
  .setAngle(180).chain()
  .setWidth(300).setHeight(200).setCrop("fill").chain()
  .setOverlay("video:dog").setFlags("splice").setWidth(300).setHeight(200).setStartOffset("0").setDuration("5").setCrop("fill").chain()
  .setFlags("layer_apply")).generate("dog.mp4")

Concatenate videos with images

Cloudinary also supports the concatenation of videos with images by using the following combination of parameters:

  • overlay (l: in URLs) to specify the name of an uploaded image,
  • splice flag (fl_splice in URLs) to indicate that the image should be concatenated on to the container video and not added as an overlay,
  • duration parameter (du in URLs) to specify the amount of time in seconds to display the image.
  • start_offset (optional) set to 0 (so_0 in URLs) to concatenate the image at the beginning of the video instead of at the end.
  • layer_apply flag (fl_layer_apply) to indicate that the above parameters are applied to the image (with the overlay parameter) and not the base video.

For example, to concatenate the image named sample to the start of the video named dog for a duration of 3 seconds (both the video and image are scaled to a width of 300 pixels and a height of 200 pixels):

Ruby:
cl_video_tag("dog", :transformation=>[
  {:width=>300, :height=>200, :crop=>"scale"},
  {:width=>300, :height=>200, :overlay=>"sample", :flags=>"splice", :duration=>"3"},
  {:start_offset=>"0", :flags=>"layer_apply"}
  ])
PHP:
cl_video_tag("dog", array("transformation"=>array(
  array("width"=>300, "height"=>200, "crop"=>"scale"),
  array("width"=>300, "height"=>200, "overlay"=>"sample", "flags"=>"splice", "duration"=>"3"),
  array("start_offset"=>"0", "flags"=>"layer_apply")
  )))
Python:
CloudinaryVideo("dog").video(transformation=[
  {'width': 300, 'height': 200, 'crop': "scale"},
  {'width': 300, 'height': 200, 'overlay': "sample", 'flags': "splice", 'duration': "3"},
  {'start_offset': "0", 'flags': "layer_apply"}
  ])
Node.js:
cloudinary.video("dog", {transformation: [
  {width: 300, height: 200, crop: "scale"},
  {width: 300, height: 200, overlay: "sample", flags: "splice", duration: "3"},
  {start_offset: "0", flags: "layer_apply"}
  ]})
Java:
cloudinary.url().transformation(new Transformation()
  .width(300).height(200).crop("scale").chain()
  .width(300).height(200).overlay(new Layer().publicId("sample")).flags("splice").duration("3").chain()
  .startOffset("0").flags("layer_apply")).videoTag("dog");
JS:
cloudinary.videoTag('dog', {transformation: [
  {width: 300, height: 200, crop: "scale"},
  {width: 300, height: 200, overlay: new cloudinary.Layer().publicId("sample"), flags: "splice", duration: "3"},
  {startOffset: "0", flags: "layer_apply"}
  ]}).toHtml();
jQuery:
$.cloudinary.video("dog", {transformation: [
  {width: 300, height: 200, crop: "scale"},
  {width: 300, height: 200, overlay: new cloudinary.Layer().publicId("sample"), flags: "splice", duration: "3"},
  {start_offset: "0", flags: "layer_apply"}
  ]})
React:
<Video publicId="dog" >
  <Transformation width="300" height="200" crop="scale" />
  <Transformation width="300" height="200" overlay="sample" flags="splice" duration="3" />
  <Transformation startOffset="0" flags="layer_apply" />
</Video>
Vue.js:
<cld-video publicId="dog" >
  <cld-transformation width="300" height="200" crop="scale" />
  <cld-transformation width="300" height="200" overlay="sample" flags="splice" duration="3" />
  <cld-transformation startOffset="0" flags="layer_apply" />
</cld-video>
Angular:
<cl-video public-id="dog" >
  <cl-transformation width="300" height="200" crop="scale">
  </cl-transformation>
  <cl-transformation width="300" height="200" overlay="sample" flags="splice" duration="3">
  </cl-transformation>
  <cl-transformation start-offset="0" flags="layer_apply">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation()
  .Width(300).Height(200).Crop("scale").Chain()
  .Width(300).Height(200).Overlay(new Layer().PublicId("sample")).Flags("splice").Duration("3").Chain()
  .StartOffset("0").Flags("layer_apply")).BuildVideoTag("dog")
Android:
MediaManager.get().url().transformation(new Transformation()
  .width(300).height(200).crop("scale").chain()
  .width(300).height(200).overlay(new Layer().publicId("sample")).flags("splice").duration("3").chain()
  .startOffset("0").flags("layer_apply")).resourceType("video").generate("dog.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation()
  .setWidth(300).setHeight(200).setCrop("scale").chain()
  .setWidth(300).setHeight(200).setOverlay("sample").setFlags("splice").setDuration("3").chain()
  .setStartOffset("0").setFlags("layer_apply")).generate("dog.mp4")

Concatenate videos with custom transitions

Cloudinary supports the concatenation of videos with a custom transition by including a transition video as an additional layer and specifying the transition effect (e_transition in URLs).

Note
The splice flag is not required when concatenating with a custom transition.

To add a custom transition:

  1. Add your base video as normal.
  2. Add the second video using the overlay video parameter (l_video: in URLs), ensuring height and width are the same as the base video.
  3. Specify the video to use as a transition as follows:
    1. Add a luma matte transition video using the overlay video parameter (l_video: in URLs).
    2. Specify the transition effect to indicate that this video overlay is to be used as a transition between the base and second video.
    3. Add the layer_apply flag (fl_layer_apply) to close the transition layer.
  4. Add a second layer_apply flag to close the second video layer. For more information, see the documentation on layer_apply.

Here's an example showing the kitten_fighting video transitioning to the dog video:

Ruby:
cl_video_tag("kitten_fighting", :transformation=>[
  {:width=>300, :height=>200, :duration=>"5", :crop=>"scale"},
  {:overlay=>"video:dog", :width=>300, :height=>200},
  {:duration=>"5"},
  {:overlay=>"video:transition1", :effect=>"transition"},
  {:flags=>"layer_apply"},
  {:flags=>"layer_apply"}
  ])
PHP:
cl_video_tag("kitten_fighting", array("transformation"=>array(
  array("width"=>300, "height"=>200, "duration"=>"5", "crop"=>"scale"),
  array("overlay"=>"video:dog", "width"=>300, "height"=>200),
  array("duration"=>"5"),
  array("overlay"=>"video:transition1", "effect"=>"transition"),
  array("flags"=>"layer_apply"),
  array("flags"=>"layer_apply")
  )))
Python:
CloudinaryVideo("kitten_fighting").video(transformation=[
  {'width': 300, 'height': 200, 'duration': "5", 'crop': "scale"},
  {'overlay': "video:dog", 'width': 300, 'height': 200},
  {'duration': "5"},
  {'overlay': "video:transition1", 'effect': "transition"},
  {'flags': "layer_apply"},
  {'flags': "layer_apply"}
  ])
Node.js:
cloudinary.video("kitten_fighting", {transformation: [
  {width: 300, height: 200, duration: "5", crop: "scale"},
  {overlay: "video:dog", width: 300, height: 200},
  {duration: "5"},
  {overlay: "video:transition1", effect: "transition"},
  {flags: "layer_apply"},
  {flags: "layer_apply"}
  ]})
Java:
cloudinary.url().transformation(new Transformation()
  .width(300).height(200).duration("5").crop("scale").chain()
  .overlay(new Layer().publicId("video:dog")).width(300).height(200).chain()
  .duration("5").chain()
  .overlay(new Layer().publicId("video:transition1")).effect("transition").chain()
  .flags("layer_apply").chain()
  .flags("layer_apply")).videoTag("kitten_fighting");
JS:
cloudinary.videoTag('kitten_fighting', {transformation: [
  {width: 300, height: 200, duration: "5", crop: "scale"},
  {overlay: new cloudinary.Layer().publicId("video:dog"), width: 300, height: 200},
  {duration: "5"},
  {overlay: new cloudinary.Layer().publicId("video:transition1"), effect: "transition"},
  {flags: "layer_apply"},
  {flags: "layer_apply"}
  ]}).toHtml();
jQuery:
$.cloudinary.video("kitten_fighting", {transformation: [
  {width: 300, height: 200, duration: "5", crop: "scale"},
  {overlay: new cloudinary.Layer().publicId("video:dog"), width: 300, height: 200},
  {duration: "5"},
  {overlay: new cloudinary.Layer().publicId("video:transition1"), effect: "transition"},
  {flags: "layer_apply"},
  {flags: "layer_apply"}
  ]})
React:
<Video publicId="kitten_fighting" >
  <Transformation width="300" height="200" duration="5" crop="scale" />
  <Transformation overlay="video:dog" width="300" height="200" />
  <Transformation duration="5" />
  <Transformation overlay="video:transition1" effect="transition" />
  <Transformation flags="layer_apply" />
  <Transformation flags="layer_apply" />
</Video>
Vue.js:
<cld-video publicId="kitten_fighting" >
  <cld-transformation width="300" height="200" duration="5" crop="scale" />
  <cld-transformation overlay="video:dog" width="300" height="200" />
  <cld-transformation duration="5" />
  <cld-transformation overlay="video:transition1" effect="transition" />
  <cld-transformation flags="layer_apply" />
  <cld-transformation flags="layer_apply" />
</cld-video>
Angular:
<cl-video public-id="kitten_fighting" >
  <cl-transformation width="300" height="200" duration="5" crop="scale">
  </cl-transformation>
  <cl-transformation overlay="video:dog" width="300" height="200">
  </cl-transformation>
  <cl-transformation duration="5">
  </cl-transformation>
  <cl-transformation overlay="video:transition1" effect="transition">
  </cl-transformation>
  <cl-transformation flags="layer_apply">
  </cl-transformation>
  <cl-transformation flags="layer_apply">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation()
  .Width(300).Height(200).Duration("5").Crop("scale").Chain()
  .Overlay(new Layer().PublicId("video:dog")).Width(300).Height(200).Chain()
  .Duration("5").Chain()
  .Overlay(new Layer().PublicId("video:transition1")).Effect("transition").Chain()
  .Flags("layer_apply").Chain()
  .Flags("layer_apply")).BuildVideoTag("kitten_fighting")
Android:
MediaManager.get().url().transformation(new Transformation()
  .width(300).height(200).duration("5").crop("scale").chain()
  .overlay(new Layer().publicId("video:dog")).width(300).height(200).chain()
  .duration("5").chain()
  .overlay(new Layer().publicId("video:transition1")).effect("transition").chain()
  .flags("layer_apply").chain()
  .flags("layer_apply")).resourceType("video").generate("kitten_fighting.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation()
  .setWidth(300).setHeight(200).setDuration("5").setCrop("scale").chain()
  .setOverlay("video:dog").setWidth(300).setHeight(200).chain()
  .setDuration("5").chain()
  .setOverlay("video:transition1").setEffect("transition").chain()
  .setFlags("layer_apply").chain()
  .setFlags("layer_apply")).generate("kitten_fighting.mp4")

A luma matte transition video is a grayscale video that uses lightness values to indicate the transparency (alpha channel) of two transitioning videos. For example, the base video will be transparent in the completely white areas and opaque in the completely black areas of the matte. The second video will then be visible in the areas of transparency of the base video; anywhere between will show both videos with the opacity of each determined by the lightness values.

You need to add your own luma matte transition videos to your account. The example below has been uploaded to the Cloudinary demo account (and used in the example above):

Ruby:
cl_video_tag("transition1", :width=>300, :crop=>"scale")
PHP:
cl_video_tag("transition1", array("width"=>300, "crop"=>"scale"))
Python:
CloudinaryVideo("transition1").video(width=300, crop="scale")
Node.js:
cloudinary.video("transition1", {width: 300, crop: "scale"})
Java:
cloudinary.url().transformation(new Transformation().width(300).crop("scale")).videoTag("transition1");
JS:
cloudinary.videoTag('transition1', {width: 300, crop: "scale"}).toHtml();
jQuery:
$.cloudinary.video("transition1", {width: 300, crop: "scale"})
React:
<Video publicId="transition1" >
  <Transformation width="300" crop="scale" />
</Video>
Vue.js:
<cld-video publicId="transition1" >
  <cld-transformation width="300" crop="scale" />
</cld-video>
Angular:
<cl-video public-id="transition1" >
  <cl-transformation width="300" crop="scale">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation().Width(300).Crop("scale")).BuildVideoTag("transition1")
Android:
MediaManager.get().url().transformation(new Transformation().width(300).crop("scale")).resourceType("video").generate("transition1.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setWidth(300).setCrop("scale")).generate("transition1.mp4")

The transition you see above starts black and adds increasing areas of white. When applied as a transition video, the base video will display first and the second video will take up increasing space until none of the base video is visible.

As the luma matte is a video itself, you can also add transformations in the same way you would with any other uploaded video. For example, you can use the accelerate effect (e_accelerate) to adjust the speed of the transition or flip the transition using the angle parameter (a in URLs). You'll need to be careful when applying transformations to the matte as this could cause issues with the transition, particularly if you change the aspect ratio. Here's the same video as above with the transition slowed to 5 seconds and flipped 180 degrees:

Ruby:
cl_video_tag("kitten_fighting", :transformation=>[
  {:duration=>"5", :width=>300, :height=>200, :crop=>"scale"},
  {:overlay=>"video:dog", :width=>300, :height=>200},
  {:duration=>"5"},
  {:overlay=>"video:transition1", :effect=>"transition"},
  {:effect=>"accelerate:5s", :angle=>180},
  {:flags=>"layer_apply"},
  {:flags=>"layer_apply"}
  ])
PHP:
cl_video_tag("kitten_fighting", array("transformation"=>array(
  array("duration"=>"5", "width"=>300, "height"=>200, "crop"=>"scale"),
  array("overlay"=>"video:dog", "width"=>300, "height"=>200),
  array("duration"=>"5"),
  array("overlay"=>"video:transition1", "effect"=>"transition"),
  array("effect"=>"accelerate:5s", "angle"=>180),
  array("flags"=>"layer_apply"),
  array("flags"=>"layer_apply")
  )))
Python:
CloudinaryVideo("kitten_fighting").video(transformation=[
  {'duration': "5", 'width': 300, 'height': 200, 'crop': "scale"},
  {'overlay': "video:dog", 'width': 300, 'height': 200},
  {'duration': "5"},
  {'overlay': "video:transition1", 'effect': "transition"},
  {'effect': "accelerate:5s", 'angle': 180},
  {'flags': "layer_apply"},
  {'flags': "layer_apply"}
  ])
Node.js:
cloudinary.video("kitten_fighting", {transformation: [
  {duration: "5", width: 300, height: 200, crop: "scale"},
  {overlay: "video:dog", width: 300, height: 200},
  {duration: "5"},
  {overlay: "video:transition1", effect: "transition"},
  {effect: "accelerate:5s", angle: 180},
  {flags: "layer_apply"},
  {flags: "layer_apply"}
  ]})
Java:
cloudinary.url().transformation(new Transformation()
  .duration("5").width(300).height(200).crop("scale").chain()
  .overlay(new Layer().publicId("video:dog")).width(300).height(200).chain()
  .duration("5").chain()
  .overlay(new Layer().publicId("video:transition1")).effect("transition").chain()
  .effect("accelerate:5s").angle(180).chain()
  .flags("layer_apply").chain()
  .flags("layer_apply")).videoTag("kitten_fighting");
JS:
cloudinary.videoTag('kitten_fighting', {transformation: [
  {duration: "5", width: 300, height: 200, crop: "scale"},
  {overlay: new cloudinary.Layer().publicId("video:dog"), width: 300, height: 200},
  {duration: "5"},
  {overlay: new cloudinary.Layer().publicId("video:transition1"), effect: "transition"},
  {effect: "accelerate:5s", angle: 180},
  {flags: "layer_apply"},
  {flags: "layer_apply"}
  ]}).toHtml();
jQuery:
$.cloudinary.video("kitten_fighting", {transformation: [
  {duration: "5", width: 300, height: 200, crop: "scale"},
  {overlay: new cloudinary.Layer().publicId("video:dog"), width: 300, height: 200},
  {duration: "5"},
  {overlay: new cloudinary.Layer().publicId("video:transition1"), effect: "transition"},
  {effect: "accelerate:5s", angle: 180},
  {flags: "layer_apply"},
  {flags: "layer_apply"}
  ]})
React:
<Video publicId="kitten_fighting" >
  <Transformation duration="5" width="300" height="200" crop="scale" />
  <Transformation overlay="video:dog" width="300" height="200" />
  <Transformation duration="5" />
  <Transformation overlay="video:transition1" effect="transition" />
  <Transformation effect="accelerate:5s" angle="180" />
  <Transformation flags="layer_apply" />
  <Transformation flags="layer_apply" />
</Video>
Vue.js:
<cld-video publicId="kitten_fighting" >
  <cld-transformation duration="5" width="300" height="200" crop="scale" />
  <cld-transformation overlay="video:dog" width="300" height="200" />
  <cld-transformation duration="5" />
  <cld-transformation overlay="video:transition1" effect="transition" />
  <cld-transformation effect="accelerate:5s" angle="180" />
  <cld-transformation flags="layer_apply" />
  <cld-transformation flags="layer_apply" />
</cld-video>
Angular:
<cl-video public-id="kitten_fighting" >
  <cl-transformation duration="5" width="300" height="200" crop="scale">
  </cl-transformation>
  <cl-transformation overlay="video:dog" width="300" height="200">
  </cl-transformation>
  <cl-transformation duration="5">
  </cl-transformation>
  <cl-transformation overlay="video:transition1" effect="transition">
  </cl-transformation>
  <cl-transformation effect="accelerate:5s" angle="180">
  </cl-transformation>
  <cl-transformation flags="layer_apply">
  </cl-transformation>
  <cl-transformation flags="layer_apply">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation()
  .Duration("5").Width(300).Height(200).Crop("scale").Chain()
  .Overlay(new Layer().PublicId("video:dog")).Width(300).Height(200).Chain()
  .Duration("5").Chain()
  .Overlay(new Layer().PublicId("video:transition1")).Effect("transition").Chain()
  .Effect("accelerate:5s").Angle(180).Chain()
  .Flags("layer_apply").Chain()
  .Flags("layer_apply")).BuildVideoTag("kitten_fighting")
Android:
MediaManager.get().url().transformation(new Transformation()
  .duration("5").width(300).height(200).crop("scale").chain()
  .overlay(new Layer().publicId("video:dog")).width(300).height(200).chain()
  .duration("5").chain()
  .overlay(new Layer().publicId("video:transition1")).effect("transition").chain()
  .effect("accelerate:5s").angle(180).chain()
  .flags("layer_apply").chain()
  .flags("layer_apply")).resourceType("video").generate("kitten_fighting.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation()
  .setDuration("5").setWidth(300).setHeight(200).setCrop("scale").chain()
  .setOverlay("video:dog").setWidth(300).setHeight(200).chain()
  .setDuration("5").chain()
  .setOverlay("video:transition1").setEffect("transition").chain()
  .setEffect("accelerate:5s").setAngle(180).chain()
  .setFlags("layer_apply").chain()
  .setFlags("layer_apply")).generate("kitten_fighting.mp4")

You can concatenate multiple videos with (and without) transitions by chaining additional videos and transition overlays. Here's an example of two transitions followed by a standard fl_splice concatenation (with no transition):

Ruby:
cl_video_tag("kitten_fighting", :transformation=>[
  {:width=>300, :height=>200, :duration=>"5", :crop=>"scale"},
  {:overlay=>"video:dog", :width=>300, :height=>200},
  {:duration=>"5"},
  {:overlay=>"video:transition1", :effect=>"transition"},
  {:flags=>"layer_apply"},
  {:flags=>"layer_apply"},
  {:overlay=>"video:snow_deer", :width=>300, :height=>200},
  {:duration=>"5"},
  {:overlay=>"video:transition2", :effect=>"transition"},
  {:flags=>"layer_apply"},
  {:flags=>"layer_apply"},
  {:overlay=>"video:dog", :flags=>"splice", :width=>300, :height=>200},
  {:duration=>"5"},
  {:flags=>"layer_apply"}
  ])
PHP:
cl_video_tag("kitten_fighting", array("transformation"=>array(
  array("width"=>300, "height"=>200, "duration"=>"5", "crop"=>"scale"),
  array("overlay"=>"video:dog", "width"=>300, "height"=>200),
  array("duration"=>"5"),
  array("overlay"=>"video:transition1", "effect"=>"transition"),
  array("flags"=>"layer_apply"),
  array("flags"=>"layer_apply"),
  array("overlay"=>"video:snow_deer", "width"=>300, "height"=>200),
  array("duration"=>"5"),
  array("overlay"=>"video:transition2", "effect"=>"transition"),
  array("flags"=>"layer_apply"),
  array("flags"=>"layer_apply"),
  array("overlay"=>"video:dog", "flags"=>"splice", "width"=>300, "height"=>200),
  array("duration"=>"5"),
  array("flags"=>"layer_apply")
  )))
Python:
CloudinaryVideo("kitten_fighting").video(transformation=[
  {'width': 300, 'height': 200, 'duration': "5", 'crop': "scale"},
  {'overlay': "video:dog", 'width': 300, 'height': 200},
  {'duration': "5"},
  {'overlay': "video:transition1", 'effect': "transition"},
  {'flags': "layer_apply"},
  {'flags': "layer_apply"},
  {'overlay': "video:snow_deer", 'width': 300, 'height': 200},
  {'duration': "5"},
  {'overlay': "video:transition2", 'effect': "transition"},
  {'flags': "layer_apply"},
  {'flags': "layer_apply"},
  {'overlay': "video:dog", 'flags': "splice", 'width': 300, 'height': 200},
  {'duration': "5"},
  {'flags': "layer_apply"}
  ])
Node.js:
cloudinary.video("kitten_fighting", {transformation: [
  {width: 300, height: 200, duration: "5", crop: "scale"},
  {overlay: "video:dog", width: 300, height: 200},
  {duration: "5"},
  {overlay: "video:transition1", effect: "transition"},
  {flags: "layer_apply"},
  {flags: "layer_apply"},
  {overlay: "video:snow_deer", width: 300, height: 200},
  {duration: "5"},
  {overlay: "video:transition2", effect: "transition"},
  {flags: "layer_apply"},
  {flags: "layer_apply"},
  {overlay: "video:dog", flags: "splice", width: 300, height: 200},
  {duration: "5"},
  {flags: "layer_apply"}
  ]})
Java:
cloudinary.url().transformation(new Transformation()
  .width(300).height(200).duration("5").crop("scale").chain()
  .overlay(new Layer().publicId("video:dog")).width(300).height(200).chain()
  .duration("5").chain()
  .overlay(new Layer().publicId("video:transition1")).effect("transition").chain()
  .flags("layer_apply").chain()
  .flags("layer_apply").chain()
  .overlay(new Layer().publicId("video:snow_deer")).width(300).height(200).chain()
  .duration("5").chain()
  .overlay(new Layer().publicId("video:transition2")).effect("transition").chain()
  .flags("layer_apply").chain()
  .flags("layer_apply").chain()
  .overlay(new Layer().publicId("video:dog")).flags("splice").width(300).height(200).chain()
  .duration("5").chain()
  .flags("layer_apply")).videoTag("kitten_fighting");
JS:
cloudinary.videoTag('kitten_fighting', {transformation: [
  {width: 300, height: 200, duration: "5", crop: "scale"},
  {overlay: new cloudinary.Layer().publicId("video:dog"), width: 300, height: 200},
  {duration: "5"},
  {overlay: new cloudinary.Layer().publicId("video:transition1"), effect: "transition"},
  {flags: "layer_apply"},
  {flags: "layer_apply"},
  {overlay: new cloudinary.Layer().publicId("video:snow_deer"), width: 300, height: 200},
  {duration: "5"},
  {overlay: new cloudinary.Layer().publicId("video:transition2"), effect: "transition"},
  {flags: "layer_apply"},
  {flags: "layer_apply"},
  {overlay: new cloudinary.Layer().publicId("video:dog"), flags: "splice", width: 300, height: 200},
  {duration: "5"},
  {flags: "layer_apply"}
  ]}).toHtml();
jQuery:
$.cloudinary.video("kitten_fighting", {transformation: [
  {width: 300, height: 200, duration: "5", crop: "scale"},
  {overlay: new cloudinary.Layer().publicId("video:dog"), width: 300, height: 200},
  {duration: "5"},
  {overlay: new cloudinary.Layer().publicId("video:transition1"), effect: "transition"},
  {flags: "layer_apply"},
  {flags: "layer_apply"},
  {overlay: new cloudinary.Layer().publicId("video:snow_deer"), width: 300, height: 200},
  {duration: "5"},
  {overlay: new cloudinary.Layer().publicId("video:transition2"), effect: "transition"},
  {flags: "layer_apply"},
  {flags: "layer_apply"},
  {overlay: new cloudinary.Layer().publicId("video:dog"), flags: "splice", width: 300, height: 200},
  {duration: "5"},
  {flags: "layer_apply"}
  ]})
React:
<Video publicId="kitten_fighting" >
  <Transformation width="300" height="200" duration="5" crop="scale" />
  <Transformation overlay="video:dog" width="300" height="200" />
  <Transformation duration="5" />
  <Transformation overlay="video:transition1" effect="transition" />
  <Transformation flags="layer_apply" />
  <Transformation flags="layer_apply" />
  <Transformation overlay="video:snow_deer" width="300" height="200" />
  <Transformation duration="5" />
  <Transformation overlay="video:transition2" effect="transition" />
  <Transformation flags="layer_apply" />
  <Transformation flags="layer_apply" />
  <Transformation overlay="video:dog" flags="splice" width="300" height="200" />
  <Transformation duration="5" />
  <Transformation flags="layer_apply" />
</Video>
Vue.js:
<cld-video publicId="kitten_fighting" >
  <cld-transformation width="300" height="200" duration="5" crop="scale" />
  <cld-transformation overlay="video:dog" width="300" height="200" />
  <cld-transformation duration="5" />
  <cld-transformation overlay="video:transition1" effect="transition" />
  <cld-transformation flags="layer_apply" />
  <cld-transformation flags="layer_apply" />
  <cld-transformation overlay="video:snow_deer" width="300" height="200" />
  <cld-transformation duration="5" />
  <cld-transformation overlay="video:transition2" effect="transition" />
  <cld-transformation flags="layer_apply" />
  <cld-transformation flags="layer_apply" />
  <cld-transformation overlay="video:dog" flags="splice" width="300" height="200" />
  <cld-transformation duration="5" />
  <cld-transformation flags="layer_apply" />
</cld-video>
Angular:
<cl-video public-id="kitten_fighting" >
  <cl-transformation width="300" height="200" duration="5" crop="scale">
  </cl-transformation>
  <cl-transformation overlay="video:dog" width="300" height="200">
  </cl-transformation>
  <cl-transformation duration="5">
  </cl-transformation>
  <cl-transformation overlay="video:transition1" effect="transition">
  </cl-transformation>
  <cl-transformation flags="layer_apply">
  </cl-transformation>
  <cl-transformation flags="layer_apply">
  </cl-transformation>
  <cl-transformation overlay="video:snow_deer" width="300" height="200">
  </cl-transformation>
  <cl-transformation duration="5">
  </cl-transformation>
  <cl-transformation overlay="video:transition2" effect="transition">
  </cl-transformation>
  <cl-transformation flags="layer_apply">
  </cl-transformation>
  <cl-transformation flags="layer_apply">
  </cl-transformation>
  <cl-transformation overlay="video:dog" flags="splice" width="300" height="200">
  </cl-transformation>
  <cl-transformation duration="5">
  </cl-transformation>
  <cl-transformation flags="layer_apply">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation()
  .Width(300).Height(200).Duration("5").Crop("scale").Chain()
  .Overlay(new Layer().PublicId("video:dog")).Width(300).Height(200).Chain()
  .Duration("5").Chain()
  .Overlay(new Layer().PublicId("video:transition1")).Effect("transition").Chain()
  .Flags("layer_apply").Chain()
  .Flags("layer_apply").Chain()
  .Overlay(new Layer().PublicId("video:snow_deer")).Width(300).Height(200).Chain()
  .Duration("5").Chain()
  .Overlay(new Layer().PublicId("video:transition2")).Effect("transition").Chain()
  .Flags("layer_apply").Chain()
  .Flags("layer_apply").Chain()
  .Overlay(new Layer().PublicId("video:dog")).Flags("splice").Width(300).Height(200).Chain()
  .Duration("5").Chain()
  .Flags("layer_apply")).BuildVideoTag("kitten_fighting")
Android:
MediaManager.get().url().transformation(new Transformation()
  .width(300).height(200).duration("5").crop("scale").chain()
  .overlay(new Layer().publicId("video:dog")).width(300).height(200).chain()
  .duration("5").chain()
  .overlay(new Layer().publicId("video:transition1")).effect("transition").chain()
  .flags("layer_apply").chain()
  .flags("layer_apply").chain()
  .overlay(new Layer().publicId("video:snow_deer")).width(300).height(200).chain()
  .duration("5").chain()
  .overlay(new Layer().publicId("video:transition2")).effect("transition").chain()
  .flags("layer_apply").chain()
  .flags("layer_apply").chain()
  .overlay(new Layer().publicId("video:dog")).flags("splice").width(300).height(200).chain()
  .duration("5").chain()
  .flags("layer_apply")).resourceType("video").generate("kitten_fighting.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation()
  .setWidth(300).setHeight(200).setDuration("5").setCrop("scale").chain()
  .setOverlay("video:dog").setWidth(300).setHeight(200).chain()
  .setDuration("5").chain()
  .setOverlay("video:transition1").setEffect("transition").chain()
  .setFlags("layer_apply").chain()
  .setFlags("layer_apply").chain()
  .setOverlay("video:snow_deer").setWidth(300).setHeight(200).chain()
  .setDuration("5").chain()
  .setOverlay("video:transition2").setEffect("transition").chain()
  .setFlags("layer_apply").chain()
  .setFlags("layer_apply").chain()
  .setOverlay("video:dog").setFlags("splice").setWidth(300).setHeight(200).chain()
  .setDuration("5").chain()
  .setFlags("layer_apply")).generate("kitten_fighting.mp4")

Note
Total video duration is calculated as the combined duration of all videos minus the duration of the transitions (as two videos are playing during the transition).

Rotating videos

Rotate the video by any arbitrary angle in degrees with the angle parameter (a in URLs). If the angle is not a multiple of 90 then a rectangular bounding box is added containing the rotated video and empty space.

Examples with the uploaded mp4 video named dog:

  1. Rotating the video by 90 degrees:

    Ruby:
    cl_video_tag("dog", :angle=>90)
    PHP:
    cl_video_tag("dog", array("angle"=>90))
    Python:
    CloudinaryVideo("dog").video(angle=90)
    Node.js:
    cloudinary.video("dog", {angle: 90})
    Java:
    cloudinary.url().transformation(new Transformation().angle(90)).videoTag("dog");
    JS:
    cloudinary.videoTag('dog', {angle: 90}).toHtml();
    jQuery:
    $.cloudinary.video("dog", {angle: 90})
    React:
    <Video publicId="dog" >
      <Transformation angle="90" />
    </Video>
    Vue.js:
    <cld-video publicId="dog" >
      <cld-transformation angle="90" />
    </cld-video>
    Angular:
    <cl-video public-id="dog" >
      <cl-transformation angle="90">
      </cl-transformation>
    </cl-video>
    .Net:
    cloudinary.Api.UrlVideoUp.Transform(new Transformation().Angle(90)).BuildVideoTag("dog")
    Android:
    MediaManager.get().url().transformation(new Transformation().angle(90)).resourceType("video").generate("dog.mp4");
    iOS:
    cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setAngle(90)).generate("dog.mp4")

  2. Rotating the video by 20 degrees (automatically adds a bounding box):

    Ruby:
    cl_video_tag("dog", :angle=>20)
    PHP:
    cl_video_tag("dog", array("angle"=>20))
    Python:
    CloudinaryVideo("dog").video(angle=20)
    Node.js:
    cloudinary.video("dog", {angle: 20})
    Java:
    cloudinary.url().transformation(new Transformation().angle(20)).videoTag("dog");
    JS:
    cloudinary.videoTag('dog', {angle: 20}).toHtml();
    jQuery:
    $.cloudinary.video("dog", {angle: 20})
    React:
    <Video publicId="dog" >
      <Transformation angle="20" />
    </Video>
    Vue.js:
    <cld-video publicId="dog" >
      <cld-transformation angle="20" />
    </cld-video>
    Angular:
    <cl-video public-id="dog" >
      <cl-transformation angle="20">
      </cl-transformation>
    </cl-video>
    .Net:
    cloudinary.Api.UrlVideoUp.Transform(new Transformation().Angle(20)).BuildVideoTag("dog")
    Android:
    MediaManager.get().url().transformation(new Transformation().angle(20)).resourceType("video").generate("dog.mp4");
    iOS:
    cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setAngle(20)).generate("dog.mp4")

Rounding corners and creating circular videos

Transforming a video to a rounded version is done using the radius parameter (r in URLs) set to the number of pixels the radius of all four corners should be. For example, the uploaded mp4 video named dog resized to a width of 300 pixels and with rounded corners set to a radius of 20 pixels:

Ruby:
cl_video_tag("dog", :width=>300, :radius=>30, :crop=>"scale")
PHP:
cl_video_tag("dog", array("width"=>300, "radius"=>30, "crop"=>"scale"))
Python:
CloudinaryVideo("dog").video(width=300, radius=30, crop="scale")
Node.js:
cloudinary.video("dog", {width: 300, radius: 30, crop: "scale"})
Java:
cloudinary.url().transformation(new Transformation().width(300).radius(30).crop("scale")).videoTag("dog");
JS:
cloudinary.videoTag('dog', {width: 300, radius: 30, crop: "scale"}).toHtml();
jQuery:
$.cloudinary.video("dog", {width: 300, radius: 30, crop: "scale"})
React:
<Video publicId="dog" >
  <Transformation width="300" radius="30" crop="scale" />
</Video>
Vue.js:
<cld-video publicId="dog" >
  <cld-transformation width="300" radius="30" crop="scale" />
</cld-video>
Angular:
<cl-video public-id="dog" >
  <cl-transformation width="300" radius="30" crop="scale">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation().Width(300).Radius(30).Crop("scale")).BuildVideoTag("dog")
Android:
MediaManager.get().url().transformation(new Transformation().width(300).radius(30).crop("scale")).resourceType("video").generate("dog.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setWidth(300).setRadius(30).setCrop("scale")).generate("dog.mp4")

Cloudinary also supports cropping videos to the shape of an ellipse. Simply pass max as the value of the radius parameter. For example, the uploaded mp4 video named dog resized to a width of 300 pixels and with maximum radius cropping:

Ruby:
cl_video_tag("dog", :width=>300, :radius=>"max", :crop=>"scale")
PHP:
cl_video_tag("dog", array("width"=>300, "radius"=>"max", "crop"=>"scale"))
Python:
CloudinaryVideo("dog").video(width=300, radius="max", crop="scale")
Node.js:
cloudinary.video("dog", {width: 300, radius: "max", crop: "scale"})
Java:
cloudinary.url().transformation(new Transformation().width(300).radius("max").crop("scale")).videoTag("dog");
JS:
cloudinary.videoTag('dog', {width: 300, radius: "max", crop: "scale"}).toHtml();
jQuery:
$.cloudinary.video("dog", {width: 300, radius: "max", crop: "scale"})
React:
<Video publicId="dog" >
  <Transformation width="300" radius="max" crop="scale" />
</Video>
Vue.js:
<cld-video publicId="dog" >
  <cld-transformation width="300" radius="max" crop="scale" />
</cld-video>
Angular:
<cl-video public-id="dog" >
  <cl-transformation width="300" radius="max" crop="scale">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation().Width(300).Radius("max").Crop("scale")).BuildVideoTag("dog")
Android:
MediaManager.get().url().transformation(new Transformation().width(300).radius("max").crop("scale")).resourceType("video").generate("dog.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setWidth(300).setRadius("max").setCrop("scale")).generate("dog.mp4")

You can also change the background color of the video from the default white color using the background parameter. Likewise, if the width and height of the video are identical (i.e., the same value) then setting the radius parameter to max generates a circular video. For example, the uploaded mp4 video named dog with width and height set to 300 pixels, and with maximum radius cropping using a blue background:

Ruby:
cl_video_tag("dog", :width=>300, :height=>300, :background=>"blue", :radius=>"max", :crop=>"fill")
PHP:
cl_video_tag("dog", array("width"=>300, "height"=>300, "background"=>"blue", "radius"=>"max", "crop"=>"fill"))
Python:
CloudinaryVideo("dog").video(width=300, height=300, background="blue", radius="max", crop="fill")
Node.js:
cloudinary.video("dog", {width: 300, height: 300, background: "blue", radius: "max", crop: "fill"})
Java:
cloudinary.url().transformation(new Transformation().width(300).height(300).background("blue").radius("max").crop("fill")).videoTag("dog");
JS:
cloudinary.videoTag('dog', {width: 300, height: 300, background: "blue", radius: "max", crop: "fill"}).toHtml();
jQuery:
$.cloudinary.video("dog", {width: 300, height: 300, background: "blue", radius: "max", crop: "fill"})
React:
<Video publicId="dog" >
  <Transformation width="300" height="300" background="blue" radius="max" crop="fill" />
</Video>
Vue.js:
<cld-video publicId="dog" >
  <cld-transformation width="300" height="300" background="blue" radius="max" crop="fill" />
</cld-video>
Angular:
<cl-video public-id="dog" >
  <cl-transformation width="300" height="300" background="blue" radius="max" crop="fill">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation().Width(300).Height(300).Background("blue").Radius("max").Crop("fill")).BuildVideoTag("dog")
Android:
MediaManager.get().url().transformation(new Transformation().width(300).height(300).background("blue").radius("max").crop("fill")).resourceType("video").generate("dog.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setWidth(300).setHeight(300).setBackground("blue").setRadius("max").setCrop("fill")).generate("dog.mp4")

The radius parameter can also be used to round the corners of overlays, which are then also given a transparent background. For example, the uploaded mp4 video named dog overlaid on the same video named dog with width set to 100 pixels, maximum radius cropping and north east gravity:

Ruby:
cl_video_tag("dog", :transformation=>[
  {:width=>300, :crop=>"scale"},
  {:overlay=>"video:dog", :width=>100, :gravity=>"north_east", :radius=>"max"}
  ])
PHP:
cl_video_tag("dog", array("transformation"=>array(
  array("width"=>300, "crop"=>"scale"),
  array("overlay"=>"video:dog", "width"=>100, "gravity"=>"north_east", "radius"=>"max")
  )))
Python:
CloudinaryVideo("dog").video(transformation=[
  {'width': 300, 'crop': "scale"},
  {'overlay': "video:dog", 'width': 100, 'gravity': "north_east", 'radius': "max"}
  ])
Node.js:
cloudinary.video("dog", {transformation: [
  {width: 300, crop: "scale"},
  {overlay: "video:dog", width: 100, gravity: "north_east", radius: "max"}
  ]})
Java:
cloudinary.url().transformation(new Transformation()
  .width(300).crop("scale").chain()
  .overlay(new Layer().publicId("video:dog")).width(100).gravity("north_east").radius("max")).videoTag("dog");
JS:
cloudinary.videoTag('dog', {transformation: [
  {width: 300, crop: "scale"},
  {overlay: new cloudinary.Layer().publicId("video:dog"), width: 100, gravity: "north_east", radius: "max"}
  ]}).toHtml();
jQuery:
$.cloudinary.video("dog", {transformation: [
  {width: 300, crop: "scale"},
  {overlay: new cloudinary.Layer().publicId("video:dog"), width: 100, gravity: "north_east", radius: "max"}
  ]})
React:
<Video publicId="dog" >
  <Transformation width="300" crop="scale" />
  <Transformation overlay="video:dog" width="100" gravity="north_east" radius="max" />
</Video>
Vue.js:
<cld-video publicId="dog" >
  <cld-transformation width="300" crop="scale" />
  <cld-transformation overlay="video:dog" width="100" gravity="north_east" radius="max" />
</cld-video>
Angular:
<cl-video public-id="dog" >
  <cl-transformation width="300" crop="scale">
  </cl-transformation>
  <cl-transformation overlay="video:dog" width="100" gravity="north_east" radius="max">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation()
  .Width(300).Crop("scale").Chain()
  .Overlay(new Layer().PublicId("video:dog")).Width(100).Gravity("north_east").Radius("max")).BuildVideoTag("dog")
Android:
MediaManager.get().url().transformation(new Transformation()
  .width(300).crop("scale").chain()
  .overlay(new Layer().publicId("video:dog")).width(100).gravity("north_east").radius("max")).resourceType("video").generate("dog.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation()
  .setWidth(300).setCrop("scale").chain()
  .setOverlay("video:dog").setWidth(100).setGravity("north_east").setRadius("max")).generate("dog.mp4")

Video settings

The video settings are used for adjusting the video properties of the delivered video including:

For all available video settings, see the Video settings section of the Video Transformation Reference.

Quality control

Control the video quality with the quality parameter (q in URLs). This parameter represents a mapping between the actual low-level settings of each different video format normalized to a quality value between 1 (lowest) and 100 (highest). Reducing the quality is a tradeoff between visual quality and file size. See video_codec in the Video transformations reference table for the default settings for each format.

For example, reducing the quality of the uploaded mp4 video named dog to 50 results in a file size of 1.1 MB compared to the original file size of 9.8MB:

Ruby:
cl_video_tag("dog", :quality=>50)
PHP:
cl_video_tag("dog", array("quality"=>50))
Python:
CloudinaryVideo("dog").video(quality=50)
Node.js:
cloudinary.video("dog", {quality: 50})
Java:
cloudinary.url().transformation(new Transformation().quality(50)).videoTag("dog");
JS:
cloudinary.videoTag('dog', {quality: 50}).toHtml();
jQuery:
$.cloudinary.video("dog", {quality: 50})
React:
<Video publicId="dog" >
  <Transformation quality="50" />
</Video>
Vue.js:
<cld-video publicId="dog" >
  <cld-transformation quality="50" />
</cld-video>
Angular:
<cl-video public-id="dog" >
  <cl-transformation quality="50">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation().Quality(50)).BuildVideoTag("dog")
Android:
MediaManager.get().url().transformation(new Transformation().quality(50)).resourceType("video").generate("dog.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setQuality(50)).generate("dog.mp4")

Automatic quality

Instead of defining a specific quality value, you can use Cloudinary's intelligent quality and encoding algorithm. The algorithm analyses each video to decide on the optimal encoding characteristics that will produce the best visual quality while minimizing the file size.

The quality transformation parameter can be set to auto (q_auto in URLs) in order to perform automatic quality encoding. Further control of the automatic quality selection is supported as follows:

  • q_auto - The optimal balance between file size and visual quality. By default, this is the same as q_auto:good.
  • q_auto:best - Less aggressive algorithm. Generates bigger files with potentially better visual quality.
  • q_auto:good - Ensuring a relatively small file size with good visual quality. Example of a target audience: stock media sites that display videos with a high visual quality.
  • q_auto:eco - More aggressive algorithm, which results in smaller files of slightly lower visual quality. Example of a target audience: popular sites and social networks with a huge amount of traffic.
  • q_auto:low - Most aggressive algorithm, which results in the smallest files of low visual quality. Example of a target audience: sites using thumbnail preview videos that then link to higher quality videos.

Examples of the resulting file size when encoding a video, using various regular and automatic quality parameter values:

Original (8.67MB)

q_80 (1.27MB) q_auto:best (1.52MB) q_auto:good (801.7KB) q_auto:eco (633.9.6KB) q_auto:low (478.1KB)

Notes

  • Automatic quality is only supported for videos using the h264 codec.
  • Cloudinary already performs some basic content-aware encoding when delivering a transformed video. See the video_codec section of the Video transformations reference table for the default settings for each format, which includes setting quality to 70. Using q_auto overrides this default setting, producing slightly different results depending on the complexity of the video.
  • q_auto cannot be used within named transformations, however q_auto:[Mode] (e.g., q_auto:good) is supported within named transformations.

Control the quality of WEBM transcoding

In some cases, transcoding videos from mp4 to webm (VP8/9 encoding) may give a pixelated result. In these cases, you can control the final quality by setting a maximum quantization percentage (1-100 range) value:qmax in addition to a fixed quality value. This can help ensure that the video is not over-quantized.

For example, you could set the quality parameter to: "80:qmax_90" to ensure that the transcoded video is quantized no more than 90% of the maximum possible quantization. When you set a qmax value, the quality value is relative to the quantization value.

For example, if you transcode the video below to .webm format without setting a max quantization value, the quality drops fairly significantly compared to its .mp4 counterpart, but by setting the max quantization to 70, you get a better visual quality.

Ruby:
cl_video_tag("Liverpool_vs_Roma_full", :duration=>"30", :quality=>"70:qmax_20")
PHP:
cl_video_tag("Liverpool_vs_Roma_full", array("duration"=>"30", "quality"=>"70:qmax_20"))
Python:
CloudinaryVideo("Liverpool_vs_Roma_full").video(duration="30", quality="70:qmax_20")
Node.js:
cloudinary.video("Liverpool_vs_Roma_full", {duration: "30", quality: "70:qmax_20"})
Java:
cloudinary.url().transformation(new Transformation().duration("30").quality("70:qmax_20")).videoTag("Liverpool_vs_Roma_full");
JS:
cloudinary.videoTag('Liverpool_vs_Roma_full', {duration: "30", quality: "70:qmax_20"}).toHtml();
jQuery:
$.cloudinary.video("Liverpool_vs_Roma_full", {duration: "30", quality: "70:qmax_20"})
React:
<Video publicId="Liverpool_vs_Roma_full" >
  <Transformation duration="30" quality="70:qmax_20" />
</Video>
Vue.js:
<cld-video publicId="Liverpool_vs_Roma_full" >
  <cld-transformation duration="30" quality="70:qmax_20" />
</cld-video>
Angular:
<cl-video public-id="Liverpool_vs_Roma_full" >
  <cl-transformation duration="30" quality="70:qmax_20">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation().Duration("30").Quality("70:qmax_20")).BuildVideoTag("Liverpool_vs_Roma_full")
Android:
MediaManager.get().url().transformation(new Transformation().duration("30").quality("70:qmax_20")).resourceType("video").generate("Liverpool_vs_Roma_full.webm");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setDuration("30").setQuality("70:qmax_20")).generate("Liverpool_vs_Roma_full.webm")

Keep in mind that the lower you set the qmax value, the higher the bitrate, and the larger the resulting file size.

If you don't supply a qmax value, then the maximum quantization is 100%, although the actual applied quantization will be determined by other factors such as the quality value you set (or your account's default quality setting), the content of the actual video, and other transformation and optimization options you include.

Bitrate control

Use the bit_rate parameter (br in URLs) for advanced control of the video bitrate. This parameter controls the number of bits used to represent the video data. By default, the br_ value uses variable bitrate (VBR), where the specified value indicates the maximum bitrate. The actual bitrate and quality are optimized according to the video content, to conserve bandwidth and storage. You can also specify a constant bitrate value (CBR): br_[value]:constant in URLs. In this case, the specified bitrate will be used even in cases where that high of a rate is not necessary for good quality viewing. When you specify a constant bitrate, the quality parameter is ignored.

bit_rate can take one of the following values:

  • An integer e.g. 120000.
  • A string supporting ‘k’ and ‘m’ (kilobits and megabits respectively) e.g. 250k or 2m.

For example, setting the maximum bitrate of the uploaded mp4 video named dog to 250 kilobits (also reducing file size down to ~550 KB):

Ruby:
cl_video_tag("dog", :bit_rate=>"250k")
PHP:
cl_video_tag("dog", array("bit_rate"=>"250k"))
Python:
CloudinaryVideo("dog").video(bit_rate="250k")
Node.js:
cloudinary.video("dog", {bit_rate: "250k"})
Java:
cloudinary.url().transformation(new Transformation().bitRate("250k")).videoTag("dog");
JS:
cloudinary.videoTag('dog', {bitRate: "250k"}).toHtml();
jQuery:
$.cloudinary.video("dog", {bit_rate: "250k"})
React:
<Video publicId="dog" >
  <Transformation bitRate="250k" />
</Video>
Vue.js:
<cld-video publicId="dog" >
  <cld-transformation bitRate="250k" />
</cld-video>
Angular:
<cl-video public-id="dog" >
  <cl-transformation bit-rate="250k">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation().BitRate("250k")).BuildVideoTag("dog")
Android:
MediaManager.get().url().transformation(new Transformation().bitRate("250k")).resourceType("video").generate("dog.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setBitRate("250k")).generate("dog.mp4")

Note
If you define a maximum or constant bitrate as well as a maximum quantization (qmax), and there is a conflict between these two settings, the maximum or constant bitrate will take precedence.

Video codec settings

The video_codec parameter (vc in URLs) is used to determine the video codec, video profile and level to use in the form <codec>[:<profile>:[<level>]] e.g. vc_h264:baseline:3.1 or vc_h264 or vc_h264:high. You can set this parameter to auto instead, to normalize and optimize the video for web (including audio settings).

By default, any transformation applied to the video (e.g., resizing) implicitly also uses the auto settings when delivering the transformed video, so using the auto setting is only needed when delivering the same format as originally uploaded with optimization but without any additional transformations. See video_codec in the Video transformations reference table for the default settings for each format.

Examples with the uploaded mp4 video named dog:

  1. Setting the video codec to h264, the profile to baseline and the level to 3.1:

    Ruby:
    cl_video_tag("dog", :video_codec=>"h264:baseline:3.1")
    PHP:
    cl_video_tag("dog", array("video_codec"=>"h264:baseline:3.1"))
    Python:
    CloudinaryVideo("dog").video(video_codec="h264:baseline:3.1")
    Node.js:
    cloudinary.video("dog", {video_codec: "h264:baseline:3.1"})
    Java:
    cloudinary.url().transformation(new Transformation().videoCodec("h264:baseline:3.1")).videoTag("dog");
    JS:
    cloudinary.videoTag('dog', {videoCodec: "h264:baseline:3.1"}).toHtml();
    jQuery:
    $.cloudinary.video("dog", {video_codec: "h264:baseline:3.1"})
    React:
    <Video publicId="dog" >
      <Transformation videoCodec="h264:baseline:3.1" />
    </Video>
    Vue.js:
    <cld-video publicId="dog" >
      <cld-transformation videoCodec="h264:baseline:3.1" />
    </cld-video>
    Angular:
    <cl-video public-id="dog" >
      <cl-transformation video-codec="h264:baseline:3.1">
      </cl-transformation>
    </cl-video>
    .Net:
    cloudinary.Api.UrlVideoUp.Transform(new Transformation().VideoCodec("h264:baseline:3.1")).BuildVideoTag("dog")
    Android:
    MediaManager.get().url().transformation(new Transformation().videoCodec("h264:baseline:3.1")).resourceType("video").generate("dog.mp4");
    iOS:
    cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setVideoCodec("h264:baseline:3.1")).generate("dog.mp4")

  2. Normalizing the video for web with the default settings:

    Ruby:
    cl_video_tag("dog", :video_codec=>"auto")
    PHP:
    cl_video_tag("dog", array("video_codec"=>"auto"))
    Python:
    CloudinaryVideo("dog").video(video_codec="auto")
    Node.js:
    cloudinary.video("dog", {video_codec: "auto"})
    Java:
    cloudinary.url().transformation(new Transformation().videoCodec("auto")).videoTag("dog");
    JS:
    cloudinary.videoTag('dog', {videoCodec: "auto"}).toHtml();
    jQuery:
    $.cloudinary.video("dog", {video_codec: "auto"})
    React:
    <Video publicId="dog" >
      <Transformation videoCodec="auto" />
    </Video>
    Vue.js:
    <cld-video publicId="dog" >
      <cld-transformation videoCodec="auto" />
    </cld-video>
    Angular:
    <cl-video public-id="dog" >
      <cl-transformation video-codec="auto">
      </cl-transformation>
    </cl-video>
    .Net:
    cloudinary.Api.UrlVideoUp.Transform(new Transformation().VideoCodec("auto")).BuildVideoTag("dog")
    Android:
    MediaManager.get().url().transformation(new Transformation().videoCodec("auto")).resourceType("video").generate("dog.mp4");
    iOS:
    cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setVideoCodec("auto")).generate("dog.mp4")

Notes

  • Supported for: vp9, prores, h264 or h265. Only the h264 codec (mp4) has profile or level parameters, with profile: baseline, main or high and level: 3.0,3.1,4.0,4.1, 4.2, 5.0, 5.1 or 5.2.
  • The prores parameter value delivers videos encoded with the Apple ProRes 422HQ codec.
  • Client libraries can optionally enter the parameter as a structure. For example, in Ruby: video_codec: { codec: 'h264', profile: 'baseline', level: '3.1' }

Control access to videos

When uploading videos to Cloudinary, both the original videos and their transformed versions are publicly available through a CDN, by default. You can use random Public IDs to make it harder to guess video URLs, but you might want more than that. Controlling access to your videos is identical to controlling access to your images - see Controlling access to assets for more information on:

Video Effects

Video effects can be applied to an uploaded video file and allow you to manipulate the appearance of the delivered video file. For example, you can:

For all video effects, see the Effects section of the Video Transformation Reference

Change video playback speed

Use the accelerate video effect (e_accelerate in URLs) to either speed up or slow down the video playback speed. The effect accepts an integer value between -50 and 100 that determines how to change the playback speed (in percent), with a positive value for speeding up the video, and a negative value for slowing down the video.

For example, the uploaded mp4 video named dog resized to a width of 300 pixels and accelerated by 100% (twice normal speed):

Ruby:
cl_video_tag("dog", :width=>300, :effect=>"accelerate:100", :crop=>"scale")
PHP:
cl_video_tag("dog", array("width"=>300, "effect"=>"accelerate:100", "crop"=>"scale"))
Python:
CloudinaryVideo("dog").video(width=300, effect="accelerate:100", crop="scale")
Node.js:
cloudinary.video("dog", {width: 300, effect: "accelerate:100", crop: "scale"})
Java:
cloudinary.url().transformation(new Transformation().width(300).effect("accelerate:100").crop("scale")).videoTag("dog");
JS:
cloudinary.videoTag('dog', {width: 300, effect: "accelerate:100", crop: "scale"}).toHtml();
jQuery:
$.cloudinary.video("dog", {width: 300, effect: "accelerate:100", crop: "scale"})
React:
<Video publicId="dog" >
  <Transformation width="300" effect="accelerate:100" crop="scale" />
</Video>
Vue.js:
<cld-video publicId="dog" >
  <cld-transformation width="300" effect="accelerate:100" crop="scale" />
</cld-video>
Angular:
<cl-video public-id="dog" >
  <cl-transformation width="300" effect="accelerate:100" crop="scale">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation().Width(300).Effect("accelerate:100").Crop("scale")).BuildVideoTag("dog")
Android:
MediaManager.get().url().transformation(new Transformation().width(300).effect("accelerate:100").crop("scale")).resourceType("video").generate("dog.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setWidth(300).setEffect("accelerate:100").setCrop("scale")).generate("dog.mp4")

Reverse playback

Use the reverse effect (e_reverse in URLs) to play a video or audio file backwards.

For example, in the following reversed video, you can watch a woman un-sketch her phone design:

Ruby:
cl_video_tag("pencil_sketch", :width=>500, :effect=>"reverse", :crop=>"scale")
PHP:
cl_video_tag("pencil_sketch", array("width"=>500, "effect"=>"reverse", "crop"=>"scale"))
Python:
CloudinaryVideo("pencil_sketch").video(width=500, effect="reverse", crop="scale")
Node.js:
cloudinary.video("pencil_sketch", {width: 500, effect: "reverse", crop: "scale"})
Java:
cloudinary.url().transformation(new Transformation().width(500).effect("reverse").crop("scale")).videoTag("pencil_sketch");
JS:
cloudinary.videoTag('pencil_sketch', {width: 500, effect: "reverse", crop: "scale"}).toHtml();
jQuery:
$.cloudinary.video("pencil_sketch", {width: 500, effect: "reverse", crop: "scale"})
React:
<Video publicId="pencil_sketch" >
  <Transformation width="500" effect="reverse" crop="scale" />
</Video>
Vue.js:
<cld-video publicId="pencil_sketch" >
  <cld-transformation width="500" effect="reverse" crop="scale" />
</cld-video>
Angular:
<cl-video public-id="pencil_sketch" >
  <cl-transformation width="500" effect="reverse" crop="scale">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation().Width(500).Effect("reverse").Crop("scale")).BuildVideoTag("pencil_sketch")
Android:
MediaManager.get().url().transformation(new Transformation().width(500).effect("reverse").crop("scale")).resourceType("video").generate("pencil_sketch.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setWidth(500).setEffect("reverse").setCrop("scale")).generate("pencil_sketch.mp4")

Create a boomerang video clip

A boomerang video is a (usually very short) video clip that plays forwards and then backwards. This effect has become quite popular on many social media and video editing apps. You can create a boomerang effect on any video by adding the boomerang effect to your transformation.

To ensure your video is short enough to produce the desired effect, you can use the boomerang effect in conjunction with the duration, start_offset, or end_offset trimming parameters. Keep in mind that the total length of a single repetition of the boomerang effect will be double the length you set for the video using the trimming parameters.

By default, the boomerang effect runs a single time. To get the repetitive effect that is characteristic of boomerang videos, you need to add looping functionality. To do this, you can either:

  • Include the HTML5 loop attribute in the relevant video_tag SDK method call or when embedding a Cloudinary video player in your webpage. If delivering your boomerang clip in a video format, this is the recommended method.

  • Use the loop transformation effect. If delivering your boomerang video as an animated gif, this is the recommended method.

For example, the following transformation delivers a selected 2 second clip of the snow_deer video as an animated gif with an infinitely looping boomerang effect:

Ruby:
cl_image_tag("snow_deer.gif", :resource_type=>"video", :transformation=>[
  {:width=>480, :start_offset=>"3", :end_offset=>"5", :effect=>"boomerang", :crop=>"scale"},
  {:effect=>"loop"}
  ])
PHP:
cl_image_tag("snow_deer.gif", array("resource_type"=>"video", "transformation"=>array(
  array("width"=>480, "start_offset"=>"3", "end_offset"=>"5", "effect"=>"boomerang", "crop"=>"scale"),
  array("effect"=>"loop")
  )))
Python:
CloudinaryVideo("snow_deer.gif").image(transformation=[
  {'width': 480, 'start_offset': "3", 'end_offset': "5", 'effect': "boomerang", 'crop': "scale"},
  {'effect': "loop"}
  ])
Node.js:
cloudinary.image("snow_deer.gif", {resource_type: "video", transformation: [
  {width: 480, start_offset: "3", end_offset: "5", effect: "boomerang", crop: "scale"},
  {effect: "loop"}
  ]})
Java:
cloudinary.url().transformation(new Transformation()
  .width(480).startOffset("3").endOffset("5").effect("boomerang").crop("scale").chain()
  .effect("loop")).resourceType("video").imageTag("snow_deer.gif");
JS:
cloudinary.videoTag('snow_deer.gif', {transformation: [
  {width: 480, startOffset: "3", endOffset: "5", effect: "boomerang", crop: "scale"},
  {effect: "loop"}
  ]}).toHtml();
jQuery:
$.cloudinary.image("snow_deer.gif", {resource_type: "video", transformation: [
  {width: 480, start_offset: "3", end_offset: "5", effect: "boomerang", crop: "scale"},
  {effect: "loop"}
  ]})
React:
<Video publicId="snow_deer.gif" resourceType="video">
  <Transformation width="480" startOffset="3" endOffset="5" effect="boomerang" crop="scale" />
  <Transformation effect="loop" />
</Video>
Vue.js:
<cld-video publicId="snow_deer.gif" resourceType="video">
  <cld-transformation width="480" startOffset="3" endOffset="5" effect="boomerang" crop="scale" />
  <cld-transformation effect="loop" />
</cld-video>
Angular:
<cl-video public-id="snow_deer.gif" resource-type="video">
  <cl-transformation width="480" start-offset="3" end-offset="5" effect="boomerang" crop="scale">
  </cl-transformation>
  <cl-transformation effect="loop">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation()
  .Width(480).StartOffset("3").EndOffset("5").Effect("boomerang").Crop("scale").Chain()
  .Effect("loop")).BuildImageTag("snow_deer.gif")
Android:
MediaManager.get().url().transformation(new Transformation()
  .width(480).startOffset("3").endOffset("5").effect("boomerang").crop("scale").chain()
  .effect("loop")).resourceType("video").generate("snow_deer.gif");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation()
  .setWidth(480).setStartOffset("3").setEndOffset("5").setEffect("boomerang").setCrop("scale").chain()
  .setEffect("loop")).generate("snow_deer.gif")
boomerang animated gif

Control video looping

Use the loop effect (e_loop in URLs) to deliver a video that loops a specified number of times. The loop parameter value indicates the number of times the video repeats (after the initial run). For example, if you want to deliver a video that plays a total of 3 times in a row, set the loop value to 2.

Note
This parameter differs from the loop attribute of the HTML5 tag, which instructs the video player to play the delivered video in an infinite loop.

For example, delivering a video that contains 3 iterations of the ski_jump video. The original video is 5 seconds long. This delivered video is 15 seconds:

Ruby:
cl_video_tag("ski_jump", :effect=>"loop:2")
PHP:
cl_video_tag("ski_jump", array("effect"=>"loop:2"))
Python:
CloudinaryVideo("ski_jump").video(effect="loop:2")
Node.js:
cloudinary.video("ski_jump", {effect: "loop:2"})
Java:
cloudinary.url().transformation(new Transformation().effect("loop:2")).videoTag("ski_jump");
JS:
cloudinary.videoTag('ski_jump', {effect: "loop:2"}).toHtml();
jQuery:
$.cloudinary.video("ski_jump", {effect: "loop:2"})
React:
<Video publicId="ski_jump" >
  <Transformation effect="loop:2" />
</Video>
Vue.js:
<cld-video publicId="ski_jump" >
  <cld-transformation effect="loop:2" />
</cld-video>
Angular:
<cl-video public-id="ski_jump" >
  <cl-transformation effect="loop:2">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation().Effect("loop:2")).BuildVideoTag("ski_jump")
Android:
MediaManager.get().url().transformation(new Transformation().effect("loop:2")).resourceType("video").generate("ski_jump.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setEffect("loop:2")).generate("ski_jump.mp4")

Tip
You can also use the loop parameter when you convert a video to an animated gif so that it will run infinitely (or a specified number of times). For details, see Delivering animated GIFs.

Apply video transparency

You can convert any relatively solid color in a video overlay to be fully transparent, thus making the base video visible in the transparent areas. This means you can remove plain colored backgrounds from a video overlay or remove a solid colored element from the subject of a video overlay, such that the content of the video behind that element shows through. This functionality works like a green-screen effect, but can be applied to any HEX color.

To make a color transparent in your video overlay, apply both the make_transparent effect (e_make_transparent in URLs) and the color parameter (co_ in URLs) to your video overlay component. You can also specify a tolerance value for the make_transparent effect to allow for minor differences in the shade of the specified color.

Note
The make_transparent parameter is supported only for videos within an overlay component. You cannot apply this parameter to a video without an overlay.

For example, suppose you have the following product video that was produced with a blue screen background:

You could use that product video as an overlay on top of a video showing a nice background scene. You could then make the blue background of your overlay video transparent using the make_transparent parameter together with the color parameter set to the Hex color #0e80d8 (the specific shade of blue used in this video).

Ruby:
cl_video_tag("docs/sunset_waves", :transformation=>[
  {:width=>500, :crop=>"scale"},
  {:overlay=>"video:docs:bluescreen_watches", :effect=>"make_transparent:20", :color=>"#0e80d8", :width=>0.6, :flags=>"relative", :gravity=>"north"},
  {:duration=>"15"}
  ])
PHP:
cl_video_tag("docs/sunset_waves", array("transformation"=>array(
  array("width"=>500, "crop"=>"scale"),
  array("overlay"=>"video:docs:bluescreen_watches", "effect"=>"make_transparent:20", "color"=>"#0e80d8", "width"=>0.6, "flags"=>"relative", "gravity"=>"north"),
  array("duration"=>"15")
  )))
Python:
CloudinaryVideo("docs/sunset_waves").video(transformation=[
  {'width': 500, 'crop': "scale"},
  {'overlay': "video:docs:bluescreen_watches", 'effect': "make_transparent:20", 'color': "#0e80d8", 'width': 0.6, 'flags': "relative", 'gravity': "north"},
  {'duration': "15"}
  ])
Node.js:
cloudinary.video("docs/sunset_waves", {transformation: [
  {width: 500, crop: "scale"},
  {overlay: "video:docs:bluescreen_watches", effect: "make_transparent:20", color: "#0e80d8", width: "0.6", flags: "relative", gravity: "north"},
  {duration: "15"}
  ]})
Java:
cloudinary.url().transformation(new Transformation()
  .width(500).crop("scale").chain()
  .overlay(new Layer().publicId("video:docs:bluescreen_watches")).effect("make_transparent:20").color("#0e80d8").width(0.6).flags("relative").gravity("north").chain()
  .duration("15")).videoTag("docs/sunset_waves");
JS:
cloudinary.videoTag('docs/sunset_waves', {transformation: [
  {width: 500, crop: "scale"},
  {overlay: new cloudinary.Layer().publicId("video:docs:bluescreen_watches"), effect: "make_transparent:20", color: "#0e80d8", width: "0.6", flags: "relative", gravity: "north"},
  {duration: "15"}
  ]}).toHtml();
jQuery:
$.cloudinary.video("docs/sunset_waves", {transformation: [
  {width: 500, crop: "scale"},
  {overlay: new cloudinary.Layer().publicId("video:docs:bluescreen_watches"), effect: "make_transparent:20", color: "#0e80d8", width: "0.6", flags: "relative", gravity: "north"},
  {duration: "15"}
  ]})
React:
<Video publicId="docs/sunset_waves" >
  <Transformation width="500" crop="scale" />
  <Transformation overlay="video:docs:bluescreen_watches" effect="make_transparent:20" color="#0e80d8" width="0.6" flags="relative" gravity="north" />
  <Transformation duration="15" />
</Video>
Vue.js:
<cld-video publicId="docs/sunset_waves" >
  <cld-transformation width="500" crop="scale" />
  <cld-transformation overlay="video:docs:bluescreen_watches" effect="make_transparent:20" color="#0e80d8" width="0.6" flags="relative" gravity="north" />
  <cld-transformation duration="15" />
</cld-video>
Angular:
<cl-video public-id="docs/sunset_waves" >
  <cl-transformation width="500" crop="scale">
  </cl-transformation>
  <cl-transformation overlay="video:docs:bluescreen_watches" effect="make_transparent:20" color="#0e80d8" width="0.6" flags="relative" gravity="north">
  </cl-transformation>
  <cl-transformation duration="15">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation()
  .Width(500).Crop("scale").Chain()
  .Overlay(new Layer().PublicId("video:docs:bluescreen_watches")).Effect("make_transparent:20").Color("#0e80d8").Width(0.6).Flags("relative").Gravity("north").Chain()
  .Duration("15")).BuildVideoTag("docs/sunset_waves")
Android:
MediaManager.get().url().transformation(new Transformation()
  .width(500).crop("scale").chain()
  .overlay(new Layer().publicId("video:docs:bluescreen_watches")).effect("make_transparent:20").color("#0e80d8").width(0.6).flags("relative").gravity("north").chain()
  .duration("15")).resourceType("video").generate("docs/sunset_waves.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation()
  .setWidth(500).setCrop("scale").chain()
  .setOverlay("video:docs:bluescreen_watches").setEffect("make_transparent:20").setColor("#0e80d8").setWidth(0.6).setFlags("relative").setGravity("north").chain()
  .setDuration("15")).generate("docs/sunset_waves.mp4")

Tip
It's often useful to set the size of your overlay video to be relative to the base video. For example, note the use of w_0.6 and fl_relative, along with g_north in the URL above, which makes the overlay video 60% smaller than the background video and places the overlay over the north part of the background video, in order to get the desired effect.

The make_transparent parameter is not limited to removing backgrounds. For example, in the above video, instead of setting the transparency color to the blue background color, you could set it to the color of the green stripe inside the watches, and then the background video would show only in place of the green stripes.
(For this use case, w_1.0, fl_relative was used so that the overlay video would completely cover the background video, except where the overlay is transparent.)

Ruby:
cl_video_tag("docs/sunset_waves", :transformation=>[
  {:width=>500, :crop=>"scale"},
  {:overlay=>"video:docs:bluescreen_watches", :effect=>"make_transparent:10", :color=>"#3d8d48", :width=>1.0, :flags=>"relative"},
  {:duration=>"15"}
  ])
PHP:
cl_video_tag("docs/sunset_waves", array("transformation"=>array(
  array("width"=>500, "crop"=>"scale"),
  array("overlay"=>"video:docs:bluescreen_watches", "effect"=>"make_transparent:10", "color"=>"#3d8d48", "width"=>1.0, "flags"=>"relative"),
  array("duration"=>"15")
  )))
Python:
CloudinaryVideo("docs/sunset_waves").video(transformation=[
  {'width': 500, 'crop': "scale"},
  {'overlay': "video:docs:bluescreen_watches", 'effect': "make_transparent:10", 'color': "#3d8d48", 'width': 1.0, 'flags': "relative"},
  {'duration': "15"}
  ])
Node.js:
cloudinary.video("docs/sunset_waves", {transformation: [
  {width: 500, crop: "scale"},
  {overlay: "video:docs:bluescreen_watches", effect: "make_transparent:10", color: "#3d8d48", width: "1.0", flags: "relative"},
  {duration: "15"}
  ]})
Java:
cloudinary.url().transformation(new Transformation()
  .width(500).crop("scale").chain()
  .overlay(new Layer().publicId("video:docs:bluescreen_watches")).effect("make_transparent:10").color("#3d8d48").width(1.0).flags("relative").chain()
  .duration("15")).videoTag("docs/sunset_waves");
JS:
cloudinary.videoTag('docs/sunset_waves', {transformation: [
  {width: 500, crop: "scale"},
  {overlay: new cloudinary.Layer().publicId("video:docs:bluescreen_watches"), effect: "make_transparent:10", color: "#3d8d48", width: "1.0", flags: "relative"},
  {duration: "15"}
  ]}).toHtml();
jQuery:
$.cloudinary.video("docs/sunset_waves", {transformation: [
  {width: 500, crop: "scale"},
  {overlay: new cloudinary.Layer().publicId("video:docs:bluescreen_watches"), effect: "make_transparent:10", color: "#3d8d48", width: "1.0", flags: "relative"},
  {duration: "15"}
  ]})
React:
<Video publicId="docs/sunset_waves" >
  <Transformation width="500" crop="scale" />
  <Transformation overlay="video:docs:bluescreen_watches" effect="make_transparent:10" color="#3d8d48" width="1.0" flags="relative" />
  <Transformation duration="15" />
</Video>
Vue.js:
<cld-video publicId="docs/sunset_waves" >
  <cld-transformation width="500" crop="scale" />
  <cld-transformation overlay="video:docs:bluescreen_watches" effect="make_transparent:10" color="#3d8d48" width="1.0" flags="relative" />
  <cld-transformation duration="15" />
</cld-video>
Angular:
<cl-video public-id="docs/sunset_waves" >
  <cl-transformation width="500" crop="scale">
  </cl-transformation>
  <cl-transformation overlay="video:docs:bluescreen_watches" effect="make_transparent:10" color="#3d8d48" width="1.0" flags="relative">
  </cl-transformation>
  <cl-transformation duration="15">
  </cl-transformation>
</cl-video>
.Net:
cloudinary.Api.UrlVideoUp.Transform(new Transformation()
  .Width(500).Crop("scale").Chain()
  .Overlay(new Layer().PublicId("video:docs:bluescreen_watches")).Effect("make_transparent:10").Color("#3d8d48").Width(1.0).Flags("relative").Chain()
  .Duration("15")).BuildVideoTag("docs/sunset_waves")
Android:
MediaManager.get().url().transformation(new Transformation()
  .width(500).crop("scale").chain()
  .overlay(new Layer().publicId("video:docs:bluescreen_watches")).effect("make_transparent:10").color("#3d8d48").width(1.0).flags("relative").chain()
  .duration("15")).resourceType("video").generate("docs/sunset_waves.mp4");
iOS:
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation()
  .setWidth(500).setCrop("scale").chain()
  .setOverlay("video:docs:bluescreen_watches").setEffect("make_transparent:10").setColor("#3d8d48").setWidth(1.0).setFlags("relative").chain()
  .setDuration("15")).generate("docs/sunset_waves.mp4")

Generate an AI-based video preview

A video preview is a short excerpt from a video that can be used to engage your audience and help them select the video content that interests them.

The preview transformation effect (e_preview in URLs) generates video previews automatically by activating deep learning algorithms that identify the most interesting video chunks. You can optionally control the length of the generated preview using the duration option (default: 5 seconds).

The following transformation generates a 10 second preview from this ImageCon lecture about responsive images by Jason Grigsby:

Ruby:
cl_video_tag("imagecon_grigsby_intro_autotag", :effect=>"preview:duration_10")
PHP:
cl_video_tag("imagecon_grigsby_intro_autotag", array("effect"=>"preview:duration_10"))
Python:
CloudinaryVideo("imagecon_grigsby_intro_autotag").video(effect="preview:duration_10")
Node.js:
cloudinary.video("imagecon_grigsby_intro_autotag", {effect: "preview:duration_10"})
Java:
cloudinary.url().transformation(new Transformation().effect("preview:duration_10")).videoTag("imagecon_grigsby_intro_autotag");
JS:
cloudinary.videoTag('imagecon_grigsby_intro_autotag', {effect: "preview:duration_10"}).toHtml();
jQuery:
$.cloudinary.video("imagecon_grigsby_intro_autotag", {effect: "preview:duration_10"})
React:
<Video publicId="imagecon_grigsby_intro_autotag" >
  <Transformation effect="preview:duration_10" />
</Video>
Vue.js:
<cld-video publicId="imagecon_grigsby_intro_autotag" >
  <cld-transformation effect="preview:duration_10" />
</cld-video>
Angular:
<cl-video public-id="imagecon_grigsby_intro_autotag" >
  <cl-transformation effect="preview:duration_10"