Skip to content

Recording

im-pingo edited this page Mar 26, 2026 · 2 revisions

English | 中文

Recording

LiveForge can record live streams to FLV files with duration-based segmentation and path templates.

Configuration

record:
  enabled: false
  stream_pattern: "live/*"
  format: flv
  path: "/data/record/{date}/{stream_key}_{time}.flv"
  segment:
    mode: duration
    duration: 30m
    max_size: 512MB
  on_file_complete:
    url: ""
Field Type Default Description
enabled bool false Enable/disable recording
stream_pattern string "live/*" Glob pattern to match stream keys for recording. "*" records all streams.
format string "flv" Recording file format
path string See above Output file path template
segment.mode string "duration" Segmentation mode
segment.duration duration 30m Segment duration before starting a new file
segment.max_size string "512MB" Maximum segment file size
on_file_complete.url string "" HTTP callback URL to invoke when a recording file is complete

Path Template Variables

The path field supports the following template variables:

Variable Description Example
{stream_key} Full stream key live/stream1
{date} Current date 2026-03-26
{time} Current time 143000

Example Path

/data/record/{date}/{stream_key}_{time}.flv

Produces: /data/record/2026-03-26/live/stream1_143000.flv

File Complete Callback

When on_file_complete.url is set, LiveForge sends a POST request to that URL each time a recording segment finishes.

Callback Payload:

{
  "stream_key": "live/stream1",
  "file_path": "/data/record/2026-03-26/live/stream1_143000.flv",
  "duration": 1800,
  "bytes": 524288000
}

This enables post-processing workflows such as uploading to cloud storage, transcoding, or updating a media catalog.

How It Works

  1. When a stream matching stream_pattern starts publishing, a recording session is created
  2. Frames from the stream are written to FLV files
  3. A new segment file is created when segment.duration elapses or segment.max_size is reached
  4. When the publisher stops, the recording session ends and the final segment is closed

Use Cases

  • Live event archiving -- record streams for on-demand replay
  • Security camera DVR -- continuous recording with duration-based segmentation
  • Compliance recording -- capture all streams matching a pattern with automated post-processing

Clone this wiki locally