> ## Documentation Index
> Fetch the complete documentation index at: https://cloudinary.com/documentation/llms.txt
> Use this file to discover all available pages before exploring further.

# JavaScript SDK (Legacy) video transformations


## Overview

After uploading videos to Cloudinary, they can be transformed 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.  
 
This section introduces you to the basics of JavaScript video streaming and transformations. 
For complete details on all video transformation functionality, see [Video transformations](video_manipulation_and_delivery) and the [Transformation URL API Reference](transformation_reference).

## Video transformation functionality
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](video_manipulation_and_delivery#transcoding_videos_to_other_formats) from one format to another
* Apply [video effects](video_effects_and_enhancements) such as fade-in/out, accelerating or decelerating, adjusting volume, playing in reverse
* Play [video-in-video](video_layers#video_overlays), [trim](video_trimming_and_concatenating#trimming_videos) videos, or [concatenate](video_trimming_and_concatenating#concatenating_media) multiple videos
* Set [video](video_manipulation_and_delivery#video_codec_settings) and [audio](audio_transformations#audio_settings) quality options such as bitrate, video codec, audio sampling frequency, or audio codec
* Adjust the visual tone of your video with [3-color-dimension LUTs](video_effects_and_enhancements#3_color_dimension_luts_3d_luts)
* Generate [thumbnails](video_effects_and_enhancements#video_thumbnails) or [animated](videos_to_animated_images) images from video
* Deliver your video using [adaptive bitrate streaming](adaptive_bitrate_streaming) in HLS or MPEG-DASH

You can optionally specify all of the above transformations to videos using methods that generate image tags or via direct URL-building directives.
 
### videoTag method

You can specify transformations using the `videoTag` method, 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 `imageTag` method, you can optionally include the transformations.
 
For example, 
 
```js
cl.videoTag("watchme", {secure: true, controls: true}).transformation()
	.overlay("text:arial_60:watchme").gravity("north").y(20)
	.toHtml()
```
 
The code above generates the following HTML video tag:

```html
<video poster="https://res.cloudinary.com/demo/video/upload/g_north,l_text:arial_60:watchme,y_20/watchme.jpg" controls>
	<source src="https://res.cloudinary.com/demo/video/upload/g_north,l_text:arial_60:watchme,y_20/watchme.webm" type="video/webm">
	<source src="https://res.cloudinary.com/demo/video/upload/g_north,l_text:arial_60:watchme,y_20/watchme.mp4" type="video/mp4">
	<source src="https://res.cloudinary.com/demo/video/upload/g_north,l_text:arial_60:watchme,y_20/watchme.ogv" type="video/ogg">
</video>
``` 

You can also add other, non-transformation parameters to the `videoTag` method such as the asset version, configuration parameters and HTML5 video tag attributes. 
* The `version` parameter is added to the delivery URL as explained in [Asset versions](advanced_url_delivery_options#asset_versions).
* [Configuration parameters](cloudinary_sdks#configuration_parameters) that you specify here override any that you have set globally.
* [HTML5 video tag attributes](https://www.w3schools.com/tags/tag_video.asp) 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.

For details, see the [video tag](video_manipulation_and_delivery#embedding_videos_in_web_pages_using_sdks) documentation and the [HTML5 Video Player](https://cloudinary.com/blog/how_to_get_the_most_from_the_html5_video_player) blog post.
 
### Direct URL building
 
Use the `video_url` method to return the video's URL as a string value. 
 
```
var tag = cl.video_url("dog.mp4");
```

The code above returns the following string:
 
`https://res.cloudinary.com/demo/video/upload/dog.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:
 
```js
cl.video_url("dog.mp4", { width: 400, crop: "pad"})
```

The code above returns the following string:
 
`https://res.cloudinary.com/demo/video/upload/c_pad,w_400/dog.mp4`

### Transparent videos

The JavaScript SDK includes an `injectTransparentVideoElement` method for delivering transparent videos on most modern web browsers, including those that don't currently support transparent webm files. See [Deliver transparent videos](video_effects_and_enhancements#transparent_delivery) for more information.
 
## Video transformation examples

This section provides examples of using JavaScript code to apply some of the video transformation features mentioned in the previous section.
 
### Example 1: 

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.
 
```js
cl.videoTag("dog", {controls: true}).transformation()
	.width(0.4).angle(20).chain()
	.overlay("cloudinary_icon_white").width(60).opacity(50).gravity("south_east").y(15).x(60)
	.toHtml()
```
 
![dog video with cloudinary icon](https://res.cloudinary.com/demo/video/upload/w_0.4,a_20/l_cloudinary_icon_white,w_60,o_50,g_south_east,y_15,x_60/dog.mp4 "with_url: false, with_code: false")

### Example 2: 

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. 
 
```js
cl.videoTag("ski_jump", {controls: true}).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")
	.toHtml()
```
 
![ski video forward and reverse](https://res.cloudinary.com/demo/video/upload/l_video:ski_jump,fl_splice,e_reverse/l_video:ski_jump,fl_splice,e_accelerate:-50/e_brightness:10,r_max/ski_jump.mp4 "with_url: false, with_code: false, width:400")
 
### Example 3:

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.
 
```js
cl.videoTag("dog", {controls: true, loop: true})
	.setFallbackContent("Your browser does not support HTML5 video tags.")
	.transformation().height(360).width(480).quality(70).duration(10).crop("pad")
	.toHtml()            
```
 
The code above generates the following HTML video tag:
 
```html

	
	
	
	Your browser does not support HTML5 video tags.

