Save costs with on-demand video encoding

Video encoding prepares video files for playback on phones, laptops, and TVs, yet it is both computationally intensive and expensive. Transloadit’s new on-demand video encoding service tackles these pain points by charging you only for the pixels that viewers actually watch, while still delivering instant playback.
Video encoding overview
Raw videos captured by mobile cameras or screen recorders are optimized for recording speed, not delivery efficiency. These often use outdated codecs, lack streaming-friendly packaging, and are much larger than necessary. Converting these files into adaptive streaming formats (e.g., HLS or DASH) solves the problem, but conventional ‘encode-everything-up-front’ workflows come with three major drawbacks:
- Playback delay – for fresh content, viewers must wait until every rendition finishes encoding before they can start watching.
- Up-front cost – encoding a video nobody ever watches ends up wasting CPU cycles and money.
- Inflexibility – changing a watermark, switching codecs, or adding higher resolution support means re-encoding the entire back catalog.
On-demand video encoding
Transloadit’s on-demand video encoding service inverts the traditional model. Instead of pre-processing an entire file, it encodes only the segment a viewer requests and streams the result immediately. A built-in Smart CDN then caches that segment, so the next viewer receives it at edge speed. Zero extra compute required.
Key benefits:
- Pay only for what gets watched – unviewed segments incur no encoding cost.
- Rapid iteration – update watermarks, subtitles, or codecs by editing a Template; there is no mass re-encode.
- Near-instant playback – a user can hit Play within seconds after an upload completes.
How it works under the hood
/video/ondemand encodes videos into HLS playlists on demand. Here's how it works when used with our Smart CDN:
- The player asks the Smart CDN for the HLS multivariant playlist (master playlist).
- The Smart CDN forwards the request to Transloadit if the playlist isn't yet cached.
- Transloadit retrieves the source file, generates the HLS multivariant playlist on the fly, and returns it to the player.
- When the player requests a variant playlist or a specific
.ts
(Transport Stream) segment, the same flow repeats: Transloadit encodes that 2- to 6-second segment in real time and immediately streams it back. - The Smart CDN caches both the playlists and encoded segments, so subsequent viewers receive them directly from the edge.
Latency is kept low by encoding small chunks and by executing the pipeline in memory – there is no intermediate storage round trip. Transloadit uses range requests when importing the source file, removing the need for our platform to first ingest the entire file.
Demo
Below is an interactive demo that lets you toggle a watermark. Press Apply and notice how the video updates after only a short delay, confirming that encoding happens on demand rather than in advance.
Use cases
Here's a list of the most common use cases for our new on-demand video encoding service.
Large archives
Conference libraries, surveillance footage, or collections of lecture recordings often span thousands of hours, yet only a sliver is ever replayed. On-demand encoding spares you from processing terabytes of cold content, while still allowing instant access when someone does hit Play.
User-generated content platforms
Most uploads receive few – if any – views, while a small percentage of them go viral. Deferring compute until audience interest materializes slashes your encoding bill and improves time-to-first-frame for creators.
A/B testing video features
Need to compare codecs, bitrates, or watermark placement? Point separate players at different Templates, measure engagement, and discard the losing variant. No pre-encode or complex rollout required.
Flexible delivery strategy
Want to change your delivery strategy quickly? With on-demand encoding, you can update your encoding settings, add or remove quality levels, or change watermarks instantly without waiting for a full re-encode of your entire video library.
Cost-savings calculator
On-demand encoding shines when viewer engagement is uneven. Use the calculator below to compare total costs versus a traditional pipeline.
Parameters considered:
- Number of videos – the size of your library.
- Average video size – how large each source file is.
- Average viewer retention – the fraction of each video a typical user watches.
- Watch rate – the portion of the catalog that receives at least one view.
Sample Template
Developers usually want to see a JSON before anything else. Here is a minimal Template that turns any upload into a 1080p HLS stream on demand:
{
"steps": {
"import": {
"robot": "/s3/import",
"path": "${fields.input}",
"credentials": "YOUR_AWS_CREDENTIALS",
"return_file_stubs": true
},
"vod": {
"robot": "/video/ondemand",
"use": "import",
"variants": {
"480p": {
"preset": "vod/480p",
"ffmpeg_stack": "v6.0.0"
},
"720p": {
"preset": "vod/720p",
"ffmpeg_stack": "v6.0.0"
},
"1080p": {
"preset": "vod/1080p",
"ffmpeg_stack": "v6.0.0"
}
}
},
"serve": {
"use": "vod",
"robot": "/file/serve"
}
}
}
Save the snippet as a Template, then when you open a URL like
https://[workspace].tlcdn.com/[template]/[path]
, an Assembly with those
Instructions is automatically created, which takes care of the file importing, encoding,
and serving.
Get started
For a full walk-through, see our 🤖 /video/ondemand Robot documentation.
Conclusion
On-demand video encoding lets you pay only for views, iterate faster, and deliver instant playback – without managing your own infrastructure. Give it a try, explore the demos, and start streaming smarter today!