Renditions
Learn how Appwrite Videos encodes a rendition per profile and output, how rendition status and progress work, and how to retry a failed encode.
4 min read
A rendition is one encoded copy of a video at the resolution and bitrate of one profile, packaged for one output. The renditions of a video make up the ladder that adaptive players switch between.
Why several renditions
Viewers watch on very different connections. If you only had a 1080p copy, someone on a slow mobile network would wait for it to buffer. With a ladder of renditions, the player starts on one it can fetch quickly, then moves up or down a few seconds at a time as the connection changes. This is adaptive bitrate streaming, and it is why a stream keeps playing when Wi-Fi drops to cellular.
Each rendition is split into short segments of up to 4 seconds. The player downloads them one after another and can change rendition between segments.
One per profile and output
Each video has at most one rendition per profile and output. You can encode the same profile for more than one output, for example 720p as both HLS and DASH. Creating a duplicate returns the video_rendition_already_exists error.
If you need both HLS and DASH, choose CMAF. It encodes once and serves both manifests from the same segments, which saves encoding time and storage.
Create renditions
In the Console, open the video, select Renditions, and click Create renditions. Select the profiles to encode and click Create. The output defaults to CMAF; open Advanced settings to choose HLS or DASH.
With a server SDK, call createRendition once for each profile:
const sdk = require('node-appwrite');
const client = new sdk.Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') .setProject('<PROJECT_ID>') .setKey('<API_KEY>');
const videos = new sdk.Videos(client);
const rendition = await videos.createRendition({ videoId: '<VIDEO_ID>', profileId: '<PROFILE_ID>', output: sdk.VideoOutput.Cmaf});Encoding starts in the background as soon as the rendition is created. You can create renditions right after the video, before its metadata is probed.
Renditions encode independently, so the video can start streaming as soon as the first one is ready. Players see more qualities as more renditions finish. To get something on screen fast, create the lower profiles first.
Encoding time depends mostly on the source duration and the profile's resolution. A 2160p rendition takes many times longer than a 480p one of the same clip.
You can create up to 15 renditions per video per hour. Past that, videos.createRendition() returns a general_rate_limit_exceeded error until the hour is up.
The profile's codec must support the output you ask for. H.264, the only codec available today, supports all three.
Status and progress
A rendition reports its status and a progress percentage while it encodes.

| Status | Console label | Meaning |
|---|---|---|
pending | Queued | Waiting for an encoding worker |
started | Encoding | Transcoding the source |
ended | Encoded | Transcoding finished. Segments and manifests are being stored |
ready | Ready | Included in the master manifest and ready to stream |
error | Failed | The encode failed |
aborted | Aborted | The encode made no progress for 12 hours and was stopped |
Each rendition also records startedAt and endedAt, its width, height, bitrates, and codec, and targetDuration, the length of its longest segment in seconds. When a rendition fails or is aborted, error says why.
progress is an integer percentage from 0 to 100, such as 42.
Wait until ready
The Console updates rendition progress live. In your own backend, list the video's renditions with queries on status and output. The video can stream once total is greater than 0:
const sdk = require('node-appwrite');
const client = new sdk.Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') .setProject('<PROJECT_ID>') .setKey('<API_KEY>');
const videos = new sdk.Videos(client);
const renditions = await videos.listRenditions({ videoId: '<VIDEO_ID>', queries: [sdk.Query.equal('output', ['cmaf']), sdk.Query.equal('status', ['ready'])] // optional});You can also filter and sort renditions on profileId, name, codec, width, height, videoBitRate, audioBitRate, startedAt, and endedAt.
A common pattern is to mark the video as published in your own database once total is greater than 0, and to show a "processing" state until then. Poll every few seconds rather than in a tight loop, since encoding takes seconds to minutes.
To tell when every rendition has finished, list them with Query.equal('status', ['pending', 'started', 'ended']) instead, and check that total is 0.
Retry a failed rendition
A failed or aborted rendition is not retried in place. In the Console, click Retry on the rendition in the Renditions tab, or select several and retry them together. Retry deletes each rendition and creates it again. With an SDK, do the same yourself:
const sdk = require('node-appwrite');
const client = new sdk.Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') .setProject('<PROJECT_ID>') .setKey('<API_KEY>');
const videos = new sdk.Videos(client);
await videos.deleteRendition({ videoId: '<VIDEO_ID>', renditionId: '<RENDITION_ID>'});
const rendition = await videos.createRendition({ videoId: '<VIDEO_ID>', profileId: '<PROFILE_ID>', output: sdk.VideoOutput.Cmaf});If the same profile fails again, read the rendition's error, then check the source. A file that is truncated, or uses a codec the encoder cannot read, fails every rendition. Playing the source file from Storage on your own machine is a quick way to rule this out.
Delete a rendition
Deleting a rendition removes its segments and drops it from the master manifest. Players stop offering that quality on their next manifest load. Other renditions of the video keep streaming.
You cannot delete a rendition while it is encoding or storing segments, which is the started and ended statuses. The request returns video_rendition_in_progress, so wait for the job to finish. A queued rendition can be deleted at any time. A rendition that makes no progress for 12 hours is marked aborted, and can be deleted then.
Was this page helpful?
Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.