Generate CDN-backed delivery URLs and player markup for a video that is already in Cloudinary. URL generation is local — no network call, no secret required — and the derived asset is created by Cloudinary on first request, then served from CDN cache.
For images, see Transform and deliver an image.
cloudinary.video() returns a complete HTML <video> tag, not a URL:
const cloudinary = require('cloudinary').v2; // only cloud_name is needed for URL generation
// 'examples/uploaded-large-video' is created by the "Upload a large video" task
const tag = cloudinary.video('examples/uploaded-large-video', {
width: 640,
crop: 'scale',
quality: 'auto',
controls: true,
secure: true
});
console.log(tag);
// <video controls poster='.../c_scale,q_auto,w_640/<id>.jpg' width='640'>
// <source src='.../<id>.webm' type='video/webm'>
// <source src='.../<id>.mp4' type='video/mp4'>
// <source src='.../<id>.ogv' type='video/ogg'>
// </video>The tag carries three <source> variants so the browser picks a format it supports, plus
a generated JPG poster frame. Drop it into a template as-is.
cloudinary.video() returns markup; for the URL alone use cloudinary.url() with
resource_type: 'video'.
const videoUrl = cloudinary.url('examples/uploaded-large-video', {
resource_type: 'video',
width: 640,
crop: 'scale',
quality: 'auto',
secure: true
});
// https://res.cloudinary.com/<cloud>/video/upload/c_scale,q_auto,w_640/examples/uploaded-large-videoRequest an image format from a video asset to get a still. start_offset picks the
second to grab:
const posterUrl = cloudinary.url('examples/uploaded-large-video', {
resource_type: 'video',
format: 'jpg',
start_offset: '2', // so_2 — two seconds in
width: 400,
crop: 'fill',
secure: true
});
// https://res.cloudinary.com/<cloud>/video/upload/c_fill,so_2,w_400/examples/uploaded-large-video.jpgFor anything longer than a short clip, deliver HLS or DASH rather than a single MP4 so the player can switch renditions:
const hlsUrl = cloudinary.url('examples/uploaded-large-video', {
resource_type: 'video',
streaming_profile: 'hd', // sp_hd
format: 'm3u8', // .mpd for DASH
secure: true
});
// https://res.cloudinary.com/<cloud>/video/upload/sp_hd/examples/uploaded-large-video.m3u8Streaming profiles are per-environment; list the available ones with
cloudinary.api.list_streaming_profiles().
- The same URL is served from CDN cache; a new transformation means a new URL.
- To bust stale caches after re-uploading, deliver with the asset
versionfrom the upload response (cloudinary.url(id, { resource_type: 'video', version: result.version })).
- The asset was uploaded with
upload_largeand will not transform or stream — it landed asraw. Re-upload withresource_type: 'video'. See Upload a large video. - The first request for a new transformation is slow — the derived video is being
generated. For long jobs prefer
eager_asyncwith anotification_urlover polling.
- Runnable example:
examples/transform-and-deliver-video.js - Transform and deliver an image
- Upload a large video
- Every transformation parameter and its accepted values: Transformation reference
- Video manipulation guide