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, 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 video-specific manipulation functionality using iOS.
For complete details on all video manipulation functionality, see Video manipulation and delivery 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
createUrl method to generate a video URL. Make sure to include the
resourceType parameter set to "video".
cloudinary.createUrl().resourceType("video").generate("sample.mp4") // returns: http://res.cloudinary.com/demo/video/upload/sample.mp4
You can also include transformation parameters in the request, for example, to return the URL for a video padded to a width of 400 pixels:
cloudinary.createUrl().resourceType.("video") .setTransformation(CLDTransformation() .setWidth(400).setCrop("pad")) .generate("sample.mp4") // returns: http://res.cloudinary.com/demo/video/upload/c_pad,w_400/sample.mp4
This section provides examples of using iOS code 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.createUrl().resourceType("video") .setTransformation(CLDTransformation() .setWidth(0.4).setAngle(20).chain() .setOverlay("cloudinary_icon_white") .setWidth(60).setOpacity(50).setGravity("south_east").setY(15).setX(60)) .generate("dog.mp4")
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 then plays forward again, but in slow motion.
cloudinary.createUrl().resourceType("video") .setTransformation(CLDTransformation() .setOverlay("video:ski_jump").setFlags("splice").setEffect("reverse").chain() .setOverlay("video:ski_jump").setFlags("splice").setEffect("accelerate:-50").chain() .setEffect("brightness:10").setRadius("max")) .generate("ski_jump.mp4")
The following example returns a the for the first 10 seconds of the
dog video. The video is also cropped to 360X480 using the pad cropping method, and it is generated at 70% quality to control file size.