Video Upload, HLS Playback, Captions, Watermarks and Signed URLs
How to upload videos, wait until they are ready, play HLS/DASH, add captions and watermarks, and protect playback with signed URLs on Cloudflare Stream.
This page summarizes Cloudflare Stream documentation for on-demand video: upload and encoding, playback with adaptive bitrate streaming, optional captions and watermarks, and access control. Stream is aimed at applications that need upload, transcode, store, and deliver without running your own video stack.
Cloudflare Stream lets you or your end users upload, store, encode, and deliver live and on-demand video with one API, without configuring or maintaining infrastructure.
— Cloudflare, Cloudflare Stream
Video upload: which method to use
Section titled “Video upload: which method to use”Stream accepts many container formats (for example MP4, MKV, MOV, WebM) with a default maximum file size of 30 GB per upload. Content should be encoded and uploaded at the same frame rate it was recorded. See supported video formats and the Stream FAQ.
| Upload method | When to use |
|---|---|
| Stream Dashboard | Quick tests without code |
| Upload with a link | File already reachable by HTTPS (S3, R2, CMS download URL) |
| Basic multipart POST | Local file under roughly 200 MB with a reliable connection |
| tus resumable upload | Files over 200 MB or unreliable networks |
| Direct creator uploads | End users upload without your API token |
If you need to upload a video that is over 200 MB, you must use the tus protocol. Even if the video is under 200 MB, if your connection is potentially unreliable, Cloudflare recommends using the tus protocol because it is resumable.
— Cloudflare, Resumable and large files (tus)
Upload with a link: poll until readyToStream
Section titled “Upload with a link: poll until readyToStream”After upload with a link, Stream must download and encode the asset. Poll the video API until readyToStream is true, or subscribe to webhooks.
The get started flow is the same pattern: upload (for example via copy), then wait, then play.
Direct creator uploads: basic POST versus tus
Section titled “Direct creator uploads: basic POST versus tus”Direct creator uploads give end users a one-time uploadURL so your API token never ships to the client. Videos over 200 MB require tus; under 200 MB, basic POST is fine when the connection is reliable.
Creating a link reserves storage against maxDurationSeconds until the upload completes, fails, or the link expires. See pricing for Stream for how reservations affect billed storage.
HLS and DASH playback: Stream Player or your own player
Section titled “HLS and DASH playback: Stream Player or your own player”When processing finishes, each video exposes HLS and DASH manifest URLs on your customer-<CODE>.cloudflarestream.com hostname. Use your own player (any player that supports HLS or DASH) or the hosted Stream Player.
Cloudflare Stream is compatible with all video players that support HLS and DASH, which are standard formats for streaming media with broad support across all web browsers, mobile operating systems and media streaming devices.
— Cloudflare, Use your own player
Manifest pattern (replace <CODE> and <UID>):
- HLS:
https://customer-<CODE>.cloudflarestream.com/<UID>/manifest/video.m3u8 - DASH:
https://customer-<CODE>.cloudflarestream.com/<UID>/manifest/video.mpd
Examples in the docs include hls.js, dash.js, Video.js, Android (ExoPlayer), and iOS (AVPlayer). Thumbnails and posters are covered in display thumbnails.
Signed token in place of video UID
Section titled “Signed token in place of video UID”If requireSignedURLs is enabled, put the signed token in manifest and iframe URLs instead of the raw video UID. See secure your Stream.
Captions: upload WebVTT or generate with AI
Section titled “Captions: upload WebVTT or generate with AI”Adding captions supports either an uploaded subtitle file or AI-generated captions. The video must already be uploaded; for generation it must be in a ready state.
Language tags must follow BCP 47 (for example en, en-GB). Each language can appear only once per video—delete an existing track before replacing that language.
AI generation supports a fixed set of languages (including en, de, fr, es, ja, and others listed in the doc). Status values are inprogress, ready, and error. Auto-generated labels include (auto-generated) in the player.
Stream only supports WebVTT formatted caption files. If you have a differently formatted caption file, use a tool to convert your file to WebVTT prior to uploading it.
— Cloudflare, Add captions
Limits: caption files up to 10 MB each. Fetch the .vtt with a GET on .../captions/<LANGUAGE_TAG>/vtt as documented on the same page.
Watermarks: create a profile, apply at upload time
Section titled “Watermarks: create a profile, apply at upload time”Applying watermarks is a two-step model: create a watermark profile (PNG, max 2 MiB), then pass its uid when uploading via link, tus metadata, or direct upload.
Default profile options (opacity, padding, scale, position) are described in the doc; positions include upperRight, upperLeft, lowerLeft, lowerRight, and center (center ignores padding).
Important constraints from the same guide:
- Profile parameters cannot be edited after creation—recreate the profile if settings change.
- Watermark on a video cannot change without re-uploading with another profile.
- Deleting a profile does not remove watermarks already baked into videos.
- Basic uploads do not support specifying a watermark profile at upload time.
Video clipping can also attach a watermark.uid when creating a clipped asset.
Additional audio tracks and player public details
Section titled “Additional audio tracks and player public details”For multi-language audio (not the original upload track), see adding additional audio tracks. Upload via HTTP (file, 200 MB max) or URL copy; each track needs a unique label. Duration mismatches are adjusted (truncate or pad with silence).
For hover title, share link, channel link, and player logo, use publicDetails via API or the dashboard Public Details tab in player enhancements.
Signed URLs and embed restrictions: who can watch
Section titled “Signed URLs and embed restrictions: who can watch”By default, anyone with a video UID can play public assets. Secure your Stream explains requireSignedURLs for private playback.
Common uses include members-only video, time-limited access, and geo restrictions via token accessRules.
Three ways to issue tokens (at a glance):
| Approach | Best for |
|---|---|
/token REST endpoint |
Testing or low volume (rate limited; default ~1 hour; no Live WebRTC) |
Workers generateToken() |
Apps already on Workers with the Stream binding |
Signing key (/stream/keys) |
High volume, Live WebRTC, custom exp, downloadable, geo rules |
Set requireSignedURLs on the video object:
curl "https://api.cloudflare.com/client/v4/accounts/{account_id}/stream/{video_uid}" \ --header "Authorization: Bearer <API_TOKEN>" \ --header "Content-Type: application/json" \ --data "{\"requireSignedURLs\": true}"Hotlinking protection: restrict embed origins with allowedOrigins on the video (dashboard or API). Wildcard rules are documented on the securing page (*.example.com vs apex domain behavior).
MP4 downloads for private video require a signed token with downloadable: true when downloads are enabled—see download video or audio.
Workers Stream binding: upload and captions from a Worker
Section titled “Workers Stream binding: upload and captions from a Worker”The bind to Workers API exposes env.STREAM.upload(), createDirectUpload(), video(id).captions.generate(), watermarks.generate(), and related helpers. Configure a stream binding in Wrangler with binding: "STREAM".
StreamVideo fields such as readyToStream, hlsPlaybackUrl, dashPlaybackUrl, and requireSignedURLs mirror the REST API responses documented on that page.
Clipping, downloads, and common mistakes
Section titled “Clipping, downloads, and common mistakes”Clipping: Clip videos creates a new asset with clippedFromVideoUID, startTimeSeconds, and endTimeSeconds. Clipped videos do not inherit scheduledDeletion from the parent; set deletion on the new video after clipping.
Downloads: Enable per-video MP4 or M4A via download video or audio; delivery minutes bill like streaming for MP4 fetch.
Common mistakes
- Using basic POST or Workers
createDirectUploadfor files over 200 MB instead of tus. - Starting caption generation before the video state is ready.
- Uploading non-WebVTT captions or duplicate language tags.
- Expecting watermark profiles to apply on basic uploads, or to update in place after creation.
- Embedding the Stream iframe without CSP entries for
videodelivery.netand*.cloudflarestream.com—see Stream FAQ. - Using Google Drive share links for upload with a link (rate limits and access issues).
Ingress and encoding are included in Stream pricing dimensions (stored minutes and delivered minutes); see pricing for Stream.
How to check this on your site
Section titled “How to check this on your site”- Upload a short test file via the Stream dashboard or the upload video file API, then GET the video until
readyToStreamistrue(or wait for a webhook withreadyToStream: true). - Open the HLS manifest URL from use your own player in a player example such as hls.js or the Stream Player iframe.
- Add an English caption with add captions (upload or generate), list captions on the video, and GET the
.../vttendpoint to confirm WebVTT content. - Enable
requireSignedURLs, generate a token per secure your Stream, and confirm the raw UID no longer plays while the tokenized manifest URL does. - You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact sentence you are asking about.