Transcoders

Video and audio dropped in a bucket, converted with FFmpeg.

Overview

A transcoder watches a bucket folder and converts every file that arrives: MP4 in several sizes, HLS for streaming, WebM, MP3 and thumbnails.

When to use it

  • Uploaded videos that must play everywhere.
  • Thumbnails for every video.
  • Recordings to MP3.

How it works

FFmpeg 8
Each conversion is a container from a pinned FFmpeg image, with no network.
Presets
mp4-480p, mp4-720p, mp4-1080p, webm-720p, hls-720p, mp3, thumbnail.

The input folder is listed every 10 seconds; each new file gets a run. The file is streamed into the container and the results streamed back into the output folder, never through a shared disk.

Architecture

Transcoders architectureNew files in the input folder become converted files in the output folder.new filestream instream outuploads/incoming/Watcherevery 10 sFFmpeg runno networkuploads/ready/
New files in the input folder become converted files in the output folder.
  • uploads/incoming/ to Watcher: new file
  • Watcher to FFmpeg run: stream in
  • FFmpeg run to uploads/ready/: stream out

Flows

A new video

  1. A user uploads a video to the input folder.
  2. The watcher starts a run.
  3. The presets are written to the output folder; the Runs tab shows how long it took.

Set it up

In the console

  1. Open Transcoders and choose New transcoder.
  2. Choose the input and output folders and the presets.
  3. Upload a file to try it.

With the CLI

enclave transcoder create videos --input uploads/incoming/ --output uploads/ready/ --preset mp4-720p --preset thumbnail --wait

With OpenTofu

OpenTofu configuration
resource "enclave_transcoder" "videos" {
  name    = "videos"
  input   = { bucket = "uploads", prefix = "incoming/" }
  output  = { bucket = "uploads", prefix = "ready/" }
  presets = ["mp4-720p", "thumbnail"]
}

Settings reference

Every setting and output of the OpenTofu resource; the console and the CLI use the same names in their own words. Generated from platform 4d30582.

enclave_transcoder
NameTypeUseWhat it does
inputlist of objectsrequiredWhere media arrives.
nametextrequiredName of the transcoder: 3–40 lowercase letters, digits or hyphens, starting with a letter. Changing it replaces the transcoder.
outputlist of objectsrequiredWhere results go (default prefix "transcoded/").
presetslist of textrequiredPresets: [mp4-480p mp4-720p mp4-1080p webm-720p hls-720p mp3 thumbnail]
concurrencynumberoptionalFiles converted at once, 1–4 (default 1).
memory_mibnumberoptionalMemory per file in MiB, 256–8192 (default 1024).
projecttextoptionalThe project to create it in. Defaults to the provider's project (ENCLAVE_PROJECT, else default). Changing it replaces the resource.
timeout_secondsnumberoptionalLongest one file may take, 60–86400 (default 3600).
watchtrue or falseoptionalConvert new files automatically (default true).
idtextoutputResource ID.

Limits and security

Good to know

  • 1 – 4 files at once; each may take up to its timeout (1 hour by default).

Security

  • Runs have no network: they only see the file they were given.