Where you are: docs → reference → api → output Read this first: api.md See also: subsystems/output.md · state-broadcast.md · deployment.md
TL;DR Sixteen endpoints cover recording, SRT output, multi-destination streaming (SRT caller, SRT listener, RTMP), the CBR pacer status, and the confidence thumbnail. Legacy single-stream SRT output (/api/output/srt/*) coexists with the newer multi-destination API (/api/output/destinations/*); new integrations should prefer destinations.
Purpose: start writing program output to rotating .ts files.
Auth: required.
Handler: control/api_output.go → (*API).handleRecordingStart.
Request body (control.recordingStartRequest):
{
"outputDir": "/var/switchframe/recordings",
"rotateAfterMins": 60,
"maxFileSizeMB": 2048,
"filenamePrefix": "show1"
}outputDir defaults to $TMPDIR/switchframe-recordings if empty; must be an absolute path with no .. traversal. Rotation defaults to 1 hour; max size has no default (unlimited).
Response 200: internal.RecordingStatus.
Errors:
| Code | When |
|---|---|
| 400 | invalid JSON, relative path, path traversal |
| 409 | output.ErrRecorderActive, peer-poller gate rejects (follower engine) |
| 501 | output manager not configured |
Emits: state broadcast with updated Recording. Sets the recording directory used by the clip-import endpoint.
Related: subsystems/output.md#recording · api/clips.md#clip-from-recording
Purpose: stop the active recording.
Auth: required.
Handler: (*API).handleRecordingStop.
Response 200: internal.RecordingStatus.
Errors: 409 (output.ErrRecorderNotActive), 501.
Purpose: return the current recording status.
Auth: required.
Handler: (*API).handleRecordingStatus.
Response 200: internal.RecordingStatus.
Purpose: start SRT output in caller (push) or listener (pull) mode.
Auth: required.
Handler: (*API).handleSRTStart.
Request body (output.SRTConfig):
{
"mode": "caller",
"address": "ingest.example.com",
"port": 9001,
"streamID": "switchframe-program",
"latencyMs": 200,
"passphrase": "...",
"pbkeylen": 16
}Errors: 400 (bad mode / missing address in caller / missing port), 409 (output.ErrSRTActive, peer-gate), 501.
Purpose: stop the SRT output.
Handler: (*API).handleSRTStop.
Purpose: return the current SRT output status.
Handler: (*API).handleSRTStatus.
Response 200: internal.SRTOutputStatus.
Purpose: list all configured destinations (SRT caller, SRT listener, RTMP).
Handler: (*API).handleListDestinations.
Response 200: []output.DestinationStatus.
Purpose: create a new destination.
Handler: (*API).handleAddDestination.
Request body (output.DestinationConfig): discriminated by type.
Per-type requirements:
srt-caller:address+portrequired.srt-listener:portrequired; ifallowedOutputPortsis configured, must be in the allowed set.rtmp:urlrequired.
Response 201: output.DestinationStatus.
Errors: 400 (missing required fields, port not allowed), 409 on engine ownership conflicts, 501.
Purpose: get one destination.
Handler: (*API).handleGetDestination.
Response 200: output.DestinationStatus.
Errors: 404 (output.ErrDestinationNotFound), 501.
Purpose: remove a destination.
Handler: (*API).handleRemoveDestination.
Response 204.
Purpose: start the destination's adapter (begin sending).
Handler: (*API).handleStartDestination.
Errors: 409 (output.ErrDestinationActive, output.ErrDestinationWrongEngine).
Purpose: stop the destination's adapter.
Handler: (*API).handleStopDestination.
Errors: 409 (output.ErrDestinationStopped).
Purpose: reassign a destination between engines in a dual-engine setup.
Handler: (*API).handleReassignDestinationEngine.
Request body: { "engine": "a" | "b" }.
Response 200: updated output.DestinationStatus.
Purpose: return the latest JPEG confidence thumbnail generated from the program output stream (captured at ~1 fps by output.ConfidenceMonitor).
Auth: required.
Handler: (*API).handleConfidence.
Response 200: image/jpeg with Cache-Control: no-store. Returns 204 when no thumbnail is available yet.
Purpose: return the CBR pacer status. The CBR pacer tops up null packets to hold the outbound MPEG-TS muxrate constant.
Handler: (*API).handleCBRStatus.
Response 200: output.CBRPacerStatus or { "enabled": false } when disabled.
- Concepts: pipeline.md
- Reference: api.md · state-broadcast.md
- Subsystems: output.md
- Operations: deployment.md