Skip to content

Videos

Start with Videos

Create your first Appwrite video from a Storage file, encode an adaptive ladder, and play the stream in a browser.

3 min read

Raw

In this quick start you create a video from a file, encode it into a few renditions, and play the stream with a web player.

Create encoding profiles

New projects have no encoding profiles, so create a small ladder first. You only do this once per project.

  1. Sign in to Appwrite Cloud and open a project.
  2. Open Videos in the sidebar and select Encoding profiles.
  3. Click Create profile.
  4. Select the 360p, 720p, and 1080p presets, and click Create.

Create profile dialog with the 360p, 720p, and 1080p presets selected
Create profile dialog with the 360p, 720p, and 1080p presets selected

Create a video

  1. Select Videos and click Create video.
  2. Choose a source:
    • Upload: Drop an MP4, MOV, WebM, MKV, or audio file and pick a Destination bucket. If the project has no buckets yet, click Create Videos bucket. The file is uploaded to that bucket and stays there.
    • Storage: Choose a file that is already in a bucket. Nothing is copied.
    • Demo: Pick one of the Blender open movies to try Videos without a file of your own. The Console downloads it and uploads it to the destination bucket.
  3. Optionally enter a Name. It defaults to the file name.
  4. Under Profiles, keep the selection or change it. Every profile that would not upscale the source is selected for you. Profiles larger than the source are marked Upscale, since upscaling adds size without adding detail.
  5. Keep the output at CMAF, the default. CMAF encodes once and serves both an HLS and a DASH manifest. To pick HLS or DASH instead, open Advanced settings.
  6. Click Create video.

Create video wizard with a video file attached for upload, the Videos destination bucket, CMAF output, and three profiles
Create video wizard with a video file attached for upload, the Videos destination bucket, CMAF output, and three profiles

The Console uploads the file from your browser, creates the video, and queues a rendition for each profile you selected. You can close the wizard while this runs, but keep the tab open until the upload finishes and the renditions are queued. Encoding runs on Appwrite and continues after you close the tab.

You can also start from Storage: open a video or audio file and click Create video to open the wizard with that file selected.

Watch it encode

Open the video and select Renditions. Each rendition moves from Queued to Encoding to Ready, with a progress percentage while it encodes.

Renditions tab with two renditions queued and the 360p rendition encoding, with a progress bar for each
Renditions tab with two renditions queued and the 360p rendition encoding, with a progress bar for each

The video page shows a player as soon as one rendition is ready.

Allow playback

A video you create in the Console is private. Only API keys and members of your project, in the Console, can play it. To play it on a public page:

  1. Open the video and select Settings.
  2. Under Access, turn on Public playback.

Access settings of a video with Public playback turned on and Read granted to Any
Access settings of a video with Public playback turned on and Read granted to Any

This grants Read to Any on the video. The source file in Storage can stay private, because playback checks the video's permissions, not the file's. See Permissions to share videos only with signed-in users or teams instead.

Play the stream

Select Install on the video page. Pick a platform, player, and format, then copy the install steps and code. For a web page with hls.js:

Install page with the Web platform, hls.js, Vanilla, and CMAF (HLS) selected, and the install steps and code
Install page with the Web platform, hls.js, Vanilla, and CMAF (HLS) selected, and the install steps and code

Bash
npm install hls.js
JavaScript
import Hls from 'hls.js'
const video = document.getElementById('player')
const src =
'https://<REGION>.cloud.appwrite.io/v1/videos/<VIDEO_ID>/outputs/cmaf/master.m3u8?project=<PROJECT_ID>'
if (Hls.isSupported()) {
const hls = new Hls()
hls.loadSource(src)
hls.attachMedia(video)
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
// Safari plays HLS natively
video.src = src
}
Markup
<video id="player" controls playsinline></video>
<script type="module" src="/main.js"></script>

The player loads the master manifest and picks the best rendition for the viewer's connection.

Next steps

  • Play a video in your app covers Shaka Player, Video.js, AVPlayer, ExoPlayer, Flutter, and React Native.
  • Captions adds subtitle tracks in more languages.
  • Permissions covers private videos for signed-in users and teams.

Was this page helpful?

Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.