Skip to content

Recording

RTCstack wraps LiveKit Egress to record rooms as composite MP4 files, stored in MinIO or S3.

Start Recording

http
POST /v1/rooms/:roomId/recording/start

Response:

json
{
  "egressId": "EG_abc123",
  "status": "starting",
  "startedAt": "2024-04-21T10:00:00.000Z"
}

The call is idempotent — calling it on an already-recording room returns the existing egress info rather than starting a second recording.

Stop Recording

http
POST /v1/rooms/:roomId/recording/stop

Response:

json
{
  "egressId": "EG_abc123",
  "status": "stopping"
}

The recording file is available in MinIO once the egress_ended webhook fires.

Get Recording Status

http
GET /v1/rooms/:roomId/recording

Response when recording:

json
{
  "active": true,
  "egressId": "EG_abc123",
  "startedAt": "2024-04-21T10:00:00.000Z"
}

Response when not recording:

json
{
  "active": false
}

File Location

Recordings are stored at:

s3://{MINIO_BUCKET}/{roomId}/{timestamp}.mp4

For example: s3://rtcstack-recordings/room-abc/2024-04-21T10-00-00.mp4

Accessing Recordings

MinIO (local): Access via the MinIO Console at http://localhost:9001 or via the S3-compatible API.

AWS S3: Use standard S3 presigned URLs for time-limited client access:

ts
import { S3Client, GetObjectCommand } from '@aws-sdk/client-s3'
import { getSignedUrl } from '@aws-sdk/s3-request-presigner'

const url = await getSignedUrl(s3Client, new GetObjectCommand({
  Bucket: 'rtcstack-recordings',
  Key: `${roomId}/${filename}`,
}), { expiresIn: 3600 })

Recording Quality

The default output is a 1280×720 composite layout at 30fps. All active video tracks are tiled automatically by LiveKit Egress.

To customize the layout, extend the recording route in apps/api/src/routes/recording.ts to pass CompositeEgressInput options to the EgressClient.startRoomCompositeEgress() call.

Webhook Integration

When recording ends, RTCstack fires the egress_ended webhook event. The payload includes the file path:

json
{
  "event": "egress_ended",
  "egressId": "EG_abc123",
  "roomId": "room-abc",
  "file": "room-abc/2024-04-21T10-00-00.mp4",
  "duration": 3600,
  "size": 512000000
}

Use this to trigger post-processing (transcription, thumbnail generation, etc.).