Skip to main content

Quick start

This guide will explain basic LiveCompositor setup.

Configure inputs and output

Start the compositor

Start the compositor server. Check out configuration page for available configuration options.

Register input stream input_1.

POST: /api/input/input_1/register
Content-Type: application/json

{
"type": "rtp_stream",
"transport_protocol": "tcp_server",
"port": 9001,
"video": {
"decoder": "ffmpeg_h264"
}
}

After receiving the response you can establish the connection and start sending the stream. Check out how to deliver input streams to learn more.

In this example we are using RTP over TCP, but it could be easily replaced by UDP.

Register input stream input_2.

POST: /api/input/input_2/register
Content-Type: application/json

{
"type": "rtp_stream",
"transport_protocol": "tcp_server",
"port": 9002,
"video": {
"decoder": "ffmpeg_h264"
}
}

After receiving the response you can establish the connection and start sending the stream. Check out how to deliver input streams to learn more.

In this example we are using RTP over TCP, but it could be easily replaced by UDP.

Register output stream output_1.

Configure it to:

  • render an empty View component with a background color set to #4d4d4d (gray)
  • produce silent audio
POST: /api/output/output_1/register
Content-Type: application/json

{
"type": "rtp_stream",
"transport_protocol": "tcp_server",
"port": 9003,
"video": {
"resolution": { "width": 1280, "height": 720 },
"encoder": {
"type": "ffmpeg_h264",
"preset": "ultrafast"
},
"initial": {
"root": {
"type": "view",
"background_color_rgba": "#4d4d4dff"
}
}
},
"audio": {
"encoder": {
"type": "opus",
"channels": "stereo"
},
"initial": {
"inputs": []
}
}
}

You can configure the output framerate and the sample rate using LIVE_COMPOSITOR_OUTPUT_FRAMERATE and LIVE_COMPOSITOR_OUTPUT_SAMPLE_RATE environment variables.

After receiving the response you can establish the connection and start listening for the stream. Check out how to receive output streams to learn more.

In this example we are using RTP over TCP, if you prefer to use UDP you need start listening on the specified port before sending register request to make sure you are not losing first frames.

View component does not have any children, so on the output you should see just a blank screen of a specified color as shown below. The initial.inputs list in audio config is empty, so the output audio will be silent.

Output stream

Update output

Configure it to:

  • Show input streams input_1 and input_2 using Tiles component.
  • Mix audio from input streams input_1 and input_2, where input_1 volume is slightly lowered.
POST: /api/output/output_1/update
Content-Type: application/json

{
"video": {
"root": {
"type": "tiles",
"background_color_rgba": "#4d4d4dff",
"children": [
{ "type": "input_stream", "input_id": "input_1" },
{ "type": "input_stream", "input_id": "input_2" }
]
}
},
"audio": {
"inputs": [
{ "input_id": "input_1", volume: 0.9 },
{ "input_id": "input_2" }
]
}
}

Output stream