Angular video manipulation

After uploading videos to Cloudinary, they can be manipulated in many ways.

The syntax for transforming and delivering videos is generally similar to that for images, and you can apply the majority of available image transformations to video as well. For example, you can resize, crop, rotate, set video quality and format or use auto quality and/or auto format, add text or image overlays to your videos, and more.

There are also a number of special options you can use for transforming and delivering video content. For example, you can adjust their size, shape, speed, duration, quality, and appearance. There are also some features that are specific to audio.

The video transformation reference shows all transformation options using snake_case, but the Angular SDK transformation attributes support kebab-case. You can apply the kebab-case style to all transformation attributes.

If you find that any of the Cloudinary transformation attributes conflict with attribute directives from another package, you can prefix the transformation attributes with cld. For example, instead of responsive you can use cld-responsive.

In addition to transformation features that are equally relevant for images and video, such as resizing, cropping, rotating, adding text or image overlays, and setting video quality or format, there are a variety of special transformations you can use for video. For example, you can:

You can specify transformations using the cl-video component, which automatically generates an HTML5 video tag including the URL sources for the main formats supported by web browsers (webm, mp4 and ogv), as well as a poster thumbnail image, which is automatically generated from a frame in the video. This enables the browser to automatically select and play the video format it supports. The video files are created dynamically when first accessed by your users.

As with the cl-image component, you can optionally include cl-transformation tags to define chained transformations.

Instead of using the <cl-video> component to generate a complete <video> tag, you can use the clSrc and clHref (or cl-src and cl-href for AngularJS) attribute directives to directly transform the given public ID or remote URI to a cloudinary video src or link href attribute. This is done the same way for videos and images. For an example, see Image attribute directives.

The following example resizes the dog video to 40% of it's original size and rotates it by 20 degrees. It also adds a semi-transparent cloudinary logo in the bottom right corner, using a southeast gravity with adjusted x and y coordinates to reach the corner of the rotated video.

The following example adjusts the brightness of a skiing video, and sets its radius to max in order to give a telescope-like effect. It then appends a copy of the video in reverse, and the plays forward again, but in slow motion.

The following example generates a <video> HTML5 tag for a video whose first 10 seconds will loop continuously in an HTML5 video player with default controls. The video is cropped to 360X480 using the pad cropping method, and it is generated at 70% quality to control file size.

<cl-videopublic-id="dog"controls="true"loop="true"fallback-content="Your browser does not support HTML5 video tags."><cl-transformationheight="360"width="480"quality="70"duration="10"crop="pad"></cl-transformation></cl-video>

The above statement will be compiled by Angular to:

<cl-video_ngcontent-c0=""class="my-videos"controls="true"loop="true"public-id="dog"ng-reflect-public-id="dog"><video_ngcontent_c0=""public_id="dog"ng_reflect_public_id="dog"poster="https://res.cloudinary.com/demo/video/upload/c_pad,du_10,h_360,q_70,w_480/dog.jpg"controls="true"loop="true"><sourcesrc="https://res.cloudinary.com/demo/video/upload/c_pad,du_10,h_360,q_70,w_480/dog.webm"type="video/webm"><sourcesrc="https://res.cloudinary.com/demo/video/upload/c_pad,du_10,h_360,q_70,w_480/dog.mp4"type="video/mp4"><sourcesrc="https://res.cloudinary.com/demo/video/upload/c_pad,du_10,h_360,q_70,w_480/dog.ogv"type="video/ogg">
Your browser does not support HTML5 video tags.
</video></cl-video>

You can also have a look at a more complex example in the Angular photo-album demo app. This example includes transformations on the poster image and for individual output types.