FFmpegLab Server & SDK

August 7, 2026 · View on GitHub

Supabase Evolu FFmpeg Deno TypeScript

FFmpegLab is an ecosystem for automated media processing. This repository contains:

  • FFmpegLab Server – the API backend with render job management, runners, and Supabase integration.
  • YAML Transpiler – a declarative tool that converts YAML pipeline definitions into PostgreSQL migrations (SQL triggers, buckets, pgmq).
  • TypeScript SDK – a client library for interacting with the FFmpegLab API.

Quick Start

Server

The automatic script installs Supabase and FFmpegLab:

curl -sSL https://ffmpeglab.com/sh/install.sh | bash

The server will be available at http://localhost:3000.

YAML Transpiler

For declarative pipeline definitions, download the transpiler:

curl -O https://raw.githubusercontent.com/ffmpeglab/server/main/sdk/yaml/transpiler.ts
curl -O https://raw.githubusercontent.com/ffmpeglab/server/main/sdk/yaml/svg.ts

Then generate a migration from a YAML file:

deno run --allow-read --allow-write transpiler.ts video-pipeline.yaml ./supabase/migrations --svg

See the YAML Transpiler section for full details.


Project Structure

.
├── sdk/
│   ├── ts/                       # TypeScript SDK
│   │   ├── src/                  # SDK source code
│   │   └── README.md             # SDK documentation
│   ├── yaml/                     # YAML transpiler & examples
│   │   ├── examples/             # Ready-to-use pipeline templates
│   │   ├── transpiler.ts         # Main transpiler script
│   │   ├── svg.ts                # SVG graph generator
│   │   └── README.md             # Transpiler documentation
│   └── ...
├── src/                          # Server source code
│   ├── models/                   # TypeORM models (Render, ApiKey, LogPiece)
│   ├── ffmpeg/                   # FFmpeg encoding logic
│   └── renders/                  # Render processing service
├── migrations/                   # Database migrations
├── docker-compose.yml            # Docker setup with all services
├── package.json                  # Node.js dependencies
└── README.md                     # This file

Services

The server runs as multiple services (runners) that can be scaled independently.

ServiceDescriptionPort
apiMain API server3000
render-runnerExecutes FFmpeg rendering jobs-
file-runnerHandles file operations with S3-
logs-runnerProcesses logs-

Powered by Supabase

FFmpegLab Server is built on Supabase — the open-source Firebase alternative — as a full-cycle provider for all backend services:

ServiceProviderDescription
PostgreSQLSupabasePrimary database with Row Level Security (RLS)
pgmqSupabaseJob queue for asynchronous render processing
S3-compatible StorageSupabaseFile storage for media assets and rendered output
REST APISupabaseAuto-generated REST API with JWT authentication
API KeysSupabaseUser-managed API keys with role-based access
LogsSupabaseCentralized storage of FFmpegLab runner stdout from the ffmpeg execution

Database Schema & Models

The server uses TypeORM with models defined in src/models/:

ModelDescription
RenderRender job tracking and status
ApiKeyAPI key management with permissions
LogPieceFFmpeg runner stdout from the ffmpeg execution

Configuration

Minimal .env file

# Database
DB_HOST=postgres
DB_USER=postgres
DB_PORT=5432
DB_PASSWORD=your_password
DB_NAME=ffmpeglab

# S3 Storage (required for file-runner)
S3_ACCESS_KEY=your_access_key
S3_SECRET_KEY=your_secret_key
S3_REGION=us-east-1
S3_ENDPOINT=https://s3.amazonaws.com

Environment Variables

VariableDescriptionRequired
DB_HOSTPostgreSQL hostYes
DB_USERPostgreSQL userYes
DB_PASSWORDPostgreSQL passwordYes
DB_NAMEPostgreSQL database nameYes
S3_ACCESS_KEYS3 access keyFor file-runner
S3_SECRET_KEYS3 secret keyFor file-runner
DB_MIGRATION_ENABLEDAuto-run migrationsNo (default: false)
IS_RENDER_RUNNEREnable render runner modeFor render-runner
IS_FILE_RUNNEREnable file runner modeFor file-runner
IS_LOGS_RUNNEREnable logs runner modeFor logs-runner

API Reference

Full API documentation: api.ffmpeglab.com/api

Request/Response Objects

All schemas are defined in the OpenAPI specification. Key models from src/models/:

SchemaModelDescriptionLink
EditorProjectConfigurationProjectFull editor project configurationView
EditorProjectProjectProject metadataView
RenderDataRenderRender job dataView
RenderDtoRenderRender data transfer objectView
RunDtoRenderRun execution requestView
RenderResponseRenderAPI response for render operationsView
EditorLayerProjectIndividual editor layerView
EncoderProjectProjectEncoder project configurationView
MediaProjectMedia file metadataView

Common Endpoints

MethodEndpointDescriptionModel
GET/Health check-
GET/rendersList all rendersRender[]
POST/rendersCreate a render jobRender
GET/renders/{id}Get render by IDRender
PUT/renders/runTrigger render executionRunDto

Usage Examples

cURL (from example.sh)

This example creates a render, triggers it, and polls the status:

# Create a render
RENDER=$(curl -X POST ${API_HOST}/renders \
  -H "Authorization: Bearer ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "project": {
      "id": "myproject",
      "title": "myproject",
      "editor": {
        "code": "-i $MEDIA_1 -movflags +faststart -y $OUTPUT_PATH",
        "selectedCode": "custom"
      }
    },
    "layers": [
      {
        "id": "layer1",
        "media": [
          {
            "id": "media1",
            "url": "https://www.ffmpeglab.com/media/zoompan.mp4",
            "folderId":"myfolder",
            "filename":"zoompan.mp4",
            "encoding":{}
          }
        ],
        "editor":{}
      }
    ]
  }')

RENDER_ID=$(echo "${RENDER}" | grep -o '"id":"[^"]*"' | head -1 | sed 's/"id":"\(.*\)"/\1/')
echo "RENDER_ID: ${RENDER_ID}"

# Trigger the render
RUN=$(curl -X PUT $API_HOST/renders/run \
  -H "Authorization: Bearer ${API_KEY}" \
  -H "Content-Type: application/json" \
  -d "{\"id\": \"$RENDER_ID\"}")

# Poll the status
curl -X GET $API_HOST/renders/${RENDER_ID} \
  -H "Authorization: Bearer ${API_KEY}" \
  -H "Content-Type: application/json"

sleep 3

curl -X GET $API_HOST/renders/${RENDER_ID} \
  -H "Authorization: Bearer ${API_KEY}" \
  -H "Content-Type: application/json"

TypeScript SDK

The TypeScript SDK provides a typed client for the FFmpegLab API.

Installation

npm install ffmpeglab-sdk

Usage

import * as ffmpeglab from 'ffmpeglab-sdk';

const mediaUrl = 'https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/360/Big_Buck_Bunny_360_10s_1MB.mp4';

const clientConfig = new ffmpeglab.Configuration({
  accessToken: 'API_KEY',
  basePath: 'https://api.ffmpeglab.com',
});

const client = new ffmpeglab.RendersApi(clientConfig);

// Create a render
client.rendersControllerCreate({
  renderDto: {
    project: {
      id: 'myproject',
      title: 'myproject',
      editor: {
        code: '-i $MEDIA_1 -movflags +faststart -y $OUTPUT_PATH',
        selectedCode: 'custom'
      }
    },
    layers: [
      {
        id: 'layer1',
        media: [
          {
            id: 'media1',
            url: mediaUrl,
            folderId: "myfolder",
            filename: "zoompan.mp4",
            encoding: {}
          }
        ],
        editor: {}
      }
    ]
  }
})
.then((render) => client.rendersControllerRunRender({
  runDto: { id: render.id }
}))
.then(() => console.log('Render completed successfully!'));

For full SDK documentation, see the TypeScript SDK README and the API reference.


YAML Transpiler

The YAML transpiler (located in sdk/yaml/) enables declarative pipeline definitions for media processing. You describe your pipeline in a YAML file – buckets, steps, triggers, and FFmpeg commands – and the transpiler generates a complete PostgreSQL migration (idempotent SQL with triggers and RLS policies) for Supabase.

Features

  • Declarative syntax – define steps, triggers, and storage in clean YAML.
  • Automatic SQL generation – produces migrations for Supabase Storage and pgmq.
  • Visual SVG graphs – generate a diagram of your pipeline with --svg.
  • Sequential & parallel steps – use next_bucket for chaining or keep: true for direct output.
  • Per‑run grouping – all outputs for a single upload are stored under a unique runId folder.

Examples

Ready‑to‑use pipeline templates are provided in sdk/yaml/examples/:

PipelineFileDescription
Audio Processingaudio.yaml / audio.svgSequential audio processing (podcast)
Video Onboardingvideo.yaml / video.svgParallel video & image processing
Whisper Subtitleswhisper-subtitles.yaml / whisper-subtitles.svgAI subtitle generation
DNN Labelingdnn-labeling.yaml / dnn-labeling.svgObject detection & classification
DNN Upscalingdnn-upscale.yaml / dnn-upscale.svgAI super‑resolution upscaling

Usage

# Generate migration and SVG
deno run --allow-read --allow-write sdk/yaml/transpiler.ts sdk/yaml/examples/video.yaml ./supabase/migrations --svg

For full documentation, see the transpiler README.


Build from Source

npm install
npm run build
npm start

License

MIT



Open source and self‑hostable. Powered by Supabase, Evolu & FFmpeg.