Everyframe · TypeScript SDK reference

Inputs & outputs

Graph methods that bring streams in (open, rtsp, hls, camera, slots) and write them out (write, writeVideo, writeDetections, and friends). g.json() is the graph_ir you submit; g.io() is the S3 binding.

@jtdigital/renderbox-sdk on npm →

Inputs

g.open

open(s3Key: string, opts?: FileOpts): [VideoStream, AudioStream]

Decode a media object into a video and an audio stream. Reference it by S3 key: the SDK records the input binding (io().inputs) and gives the graph a sandbox-safe name. Multiple inputs? Just call open() again on the same graph.

Param Type Description
s3Key required string S3 key of the source object (e.g. 'uploads/clip.mp4').
loop number Loop the source (FileOpts).
t number Read at most this many seconds (FileOpts).

g.openVideo / g.openAudio

openVideo(s3Key: string): VideoStream

Decode only the video (or only the audio) stream of an object.

g.rtsp / g.hls

rtsp(url: string): [VideoStream, AudioStream]

Consume a live RTSP stream (IP cameras, encoders) or an HLS playlist URL.

g.camera / g.screenCapture

camera(device: number): [VideoStream, AudioStream]

Capture from a local camera device, or the screen, on the executing worker.

g.mqtt

mqtt(broker: string, topic: string): DetectionStream

Subscribe to a detection stream published on an MQTT topic: feed external detections into a pipeline.

g.slot / g.slotVideo / g.slotAudio

slot(label: string): [VideoStream, AudioStream]

Declare a named input slot instead of a concrete object. Slots make a graph reusable: compile once, then bind each slot to an S3 object per submission via Bindings.

Param Type Description
label required string Slot name referenced by submit-time bindings.

Outputs

g.write

write(s3Key: string, video: VideoStream, audio: AudioStream, opts?: SinkAvOpts): Graph

Mux a video and an audio stream into an output container written to an S3 key. Returns the graph for chaining; io().outputs records the binding.

Param Type Description
codec string Video codec (e.g. 'h264', 'h265').
crf number Constant rate factor: the quality/size trade-off.
bitrate string Target bitrate (e.g. '6M').
preset string Encoder speed preset (e.g. 'medium', 'slow').

g.writeVideo / g.writeAudio

writeVideo(s3Key: string, video: VideoStream, opts?: SinkAvOpts): Graph

Write a single video-only or audio-only output.

g.writeDetections

writeDetections(s3Key: string, detections: DetectionStream): Graph

Write a Detection stream as JSON Lines: one JSON object per frame with boxes, classes, confidences and track ids.

g.writeTranscript

writeTranscript(s3Key: string, transcript: TranscriptStream, format?: 'srt' | 'vtt'): Graph

Write a Transcript stream as SRT or WebVTT subtitles.

g.writeMqtt / g.writeHttp

writeMqtt(broker: string, topic: string, detections: DetectionStream, opts?: { qos?: number }): Graph

Publish detections live to an MQTT topic, or POST them to an HTTP endpoint, as they are produced.

g.outputSlot / g.outputSlotVideo

outputSlot(label: string, video: VideoStream, audio: AudioStream, opts?: SinkAvOpts): Graph

Named output slot: the output-side counterpart of slot(). The concrete destination is bound at submit time.