After uploading videos to Cloudinary, they can be transformed in many ways.
The syntax for transforming and delivering videos is generally the same as 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.
This section introduces you to the basics of .NET video streaming and transformation. For complete details on all video transformation functionality, see Video transformations and the Transformation URL API Reference.
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:
- Transcode videos from one format to another
- Apply video effects such as fade-in/out, accelerating or decelerating, adjusting volume, playing in reverse
- Play video-in-video, trim videos, or concatenate multiple videos
- Set video and audio quality options such as bitrate, video codec, audio sampling frequency, or audio codec
- Adjust the visual tone of your video with 3D LUTs
- Generate thumbnails or animated images from video
- Deliver your video using adaptive bitrate streaming in HLS or MPEG-DASH
You can optionally specify all of the above transformations within a
UrlVideoUp method, which automatically generates an HTML5 video tag including the transformation URL sources for the main formats supported by web browsers (
ogv), as well as a poster thumbnail image. 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.
You can also add other, non-transformation parameters to the
UrlVideoUp method such as the asset version, configuration parameters and HTML5 video tag attributes.
versionparameter is added to the delivery URL as explained in Asset versions.
- Configuration parameters that you specify here override any that you have set globally.
- HTML5 video tag attributes are added to the resulting
<video>tag. The video is delivered from Cloudinary using the width and height in the transformation but is displayed at the dimensions specified in the tag.
This section provides examples of using .NET to apply some of the video transformation features mentioned in the previous section.
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.
cloudinary.Api.UrlVideoUp.Transform(new Transformation() .Width(0.4).Angle(20).Chain() .overlay("cloudinary_icon_white").width(60).opacity(50).Gravity("south_east").Y(15).X(60)).BuildVideoTag("dog", new StringDictionary("controls"));
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.
cloudinary.Api.UrlVideoUp.Transform(new Transformation() .Overlay("video:ski_jump").Flags("splice").Effect("reverse").Chain() .Overlay("video:ski_jump").Flags("splice").Effect("accelerate:-50").Chain() .Effect("brightness:10").Radius("max")).BuildVideoTag("ski_jump", new StringDictionary("controls"));
The following example generates a
<video> 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.
cloudinary.Api.UrlVideoUp.Transform(new Transformation() .Height(360).Width(480).Quality(70).Duration("10").Crop("pad")) .FallbackContent("Your browser does not support HTML5 video tags.") .BuildVideoTag("dog", new StringDictionary( "controls", "loop"));
The above statement results in the following HTML:
<video controls height='360' loop poster='https://res.cloudinary.com/demo/video/upload/c_pad,du_10,h_360,q_70,w_480/dog.jpg' width='480'> <source src='https://res.cloudinary.com/demo/video/upload/c_pad,du_10,h_360,q_70,w_480/dog.webm' type='video/webm'> <source src='https://res.cloudinary.com/demo/video/upload/c_pad,du_10,h_360,q_70,w_480/dog.mp4' type='video/mp4'> <source src='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>