Skip to main content

nanoStudio Chroma API

Everything the Chroma Setup Tuner does goes through a handful of API calls, so you can script a whole chroma setup: create the streams, upload backgrounds, switch keying on, tune it while live, and add or drop a brand. Most calls use the nanoStream REST API (also called the bintu API; hostnames and headers keep the bintu name); file uploads use the nanoStudio upload endpoint.

The model​

  • One ingest stream (the green- or blue-screen feed) carries a stream option named chroma_key.
  • Each brand (target, output) is a regular nanoStream stream of its own, with its own stream group, ABR renditions, tags and security.
  • The chroma_key option lists the targets: for each one its streamId, its background and, optionally, an overlay (foreground).

Authentication​

Send your organisation API key in the x-bintu-apikey header, or the token a login returns in x-bintu-token. See APIs & SDKs overview for how to get an API key.

  • Creating streams and writing options needs a role that can write. A read-only login can read streams but gets refused on GET /stream/{id}/options.
  • Keep keys on your server. Never put an API key in a web page.

Endpoints​

StepMethod and pathHost
Create the ingest and brand streamsPOST /streamhttps://bintu.nanostream.cloud
List transcoding profilesGET /transcoding_profileshttps://bintu.nanostream.cloud
Upload a background or overlayPOST /upload/chromakey/{ORG_HASH}https://studio-api.nanostream.cloud
Switch the chroma key onPOST /stream/{INGEST_STREAM_ID}/optionshttps://bintu.nanostream.cloud
Read the chroma configurationGET /stream/{INGEST_STREAM_ID}/options?name=chroma_keyhttps://bintu.nanostream.cloud
Tune the running key (not saved)PATCH /stream/{INGEST_STREAM_ID}/filterhttps://bintu.nanostream.cloud
Save the setup, add or drop a brandPUT /stream/{INGEST_STREAM_ID}/optionshttps://bintu.nanostream.cloud

The examples below read your key from an environment variable:

export BINTU_API_KEY='<YOUR_API_KEY>'

1. Create the ingest stream​

curl -X POST "https://bintu.nanostream.cloud/stream" \
-H "x-bintu-apikey: $BINTU_API_KEY" \
-H "content-type: application/json" \
-d '{"tags":["ingestStream","multichroma","chroma"]}'

Keep the returned id (the ingest stream ID) and ingest.rtmp.streamname (the stream key).

info

Your encoder publishes to the studio ingest server, not to the ingest.rtmp.url in the response: rtmp://bintu-studio.nanocosmos.de/live with the stream key from ingest.rtmp.streamname. Publishing to this server is what starts the chroma key. The Chroma Setup Tuner always shows the current server.

2. Create one stream per brand​

curl -X POST "https://bintu.nanostream.cloud/stream" \
-H "x-bintu-apikey: $BINTU_API_KEY" \
-H "content-type: application/json" \
-d '{
"tags": ["targetStream1", "multichroma"],
"transcodes": [
{"profile": "vtrans2-1280x720x2000x30"},
{"profile": "vtrans2-640x360x400x25"}
]
}'

Repeat for every brand (targetStream2, targetStream3, …) and keep each returned id. A brand's ABR renditions are set here, on its own stream; get the profile names your organisation can use from GET /transcoding_profiles. The default supports up to 15 targets per ingest; more on request.

The multichroma tag makes chroma streams easy to find in the Dashboard. You can add your own tags.

3. Upload backgrounds and overlays​

curl -X POST "https://studio-api.nanostream.cloud/upload/chromakey/<ORG_HASH>" \
-H "x-bintu-apikey: $BINTU_API_KEY" \
-F "file=@brand_1_1080.mp4"
  • ORG_HASH is your organisation hash: the first five characters of any of your stream names (XXXXX in XXXXX-YYYYY). The Chroma Setup Tuner also shows it after sign-in.
  • Backgrounds: MP4, PNG or JPG. Overlays: PNG with transparency. Upload once and use the file for any number of brands.
  • File names are stored in lower case. Refer to a file by that name in the next call.
  • Keep MP4 backgrounds light: H.264, same resolution as the camera, 3–5 Mbps and no more than 8 Mbps. All brands share one processing job. See Prepare MP4 backgrounds.

4. Switch the chroma key on​

curl -X POST "https://bintu.nanostream.cloud/stream/<INGEST_STREAM_ID>/options" \
-H "x-bintu-apikey: $BINTU_API_KEY" \
-H "content-type: application/json" \
-d '{
"name": "chroma_key",
"options": {
"color": "#00FF00",
"similarity": 0.25,
"blend": 0.1,
"filter": "chromakey",
"targets": [
{
"streamId": "<BRAND_1_STREAM_ID>",
"background": "brand_1_1080.mp4",
"foreground": "brand_1_logo.png",
"foreground_position": "x=40:y=40",
"foreground_size": "320:120"
},
{
"streamId": "<BRAND_2_STREAM_ID>",
"background": "brand_2_1080.jpg",
"foreground": "brand_2_logo.png",
"foreground_position": "x=40:y=40",
"foreground_size": "320:120"
}
]
}
}'

chroma_key options​

FieldTypeDescription
colorstringKey colour as hex, for example #00FF00 for green
similaritynumberHow much of the colour range around the key colour is removed. See Tune the key.
blendnumberHow softly the edge fades
filterstringchromakey
targets[]arrayOne entry per brand
targets[].streamIdstringThe brand's stream ID from step 2. Must be an existing stream.
targets[].backgroundstringFile name of an uploaded background
targets[].foregroundstringOptional. File name of an uploaded PNG overlay
targets[].foreground_positionstringOverlay position, x=<px>:y=<px> from the top-left corner
targets[].foreground_sizestringOverlay size, <width>:<height> in pixels

The response contains the optionGroup (for example chroma_key-1). Keep it: you need it to save changes in step 6. You can read the configuration back at any time:

curl "https://bintu.nanostream.cloud/stream/<INGEST_STREAM_ID>/options?name=chroma_key" \
-H "x-bintu-apikey: $BINTU_API_KEY"
note

Overlays are all or none. The platform applies an overlay only when every target has one. An overlay on just one target is ignored. Give every target a foreground (the images may differ per target) or none of them.

5. Tune the key while live​

curl -X PATCH "https://bintu.nanostream.cloud/stream/<INGEST_STREAM_ID>/filter" \
-H "x-bintu-apikey: $BINTU_API_KEY" \
-H "content-type: application/json" \
-d '{"processName":"chroma_key","filterOptions":{"chromakey":{"similarity":0.3,"blend":0.05}}}'

filterOptions takes one object per filter. Send only the filters you change:

KeyFields
chromakeycolor (key colour as 0xRRGGBB), similarity, blend
overlay@fore1, overlay@fore2, …x, y: overlay position for brand output 1, 2, …
eqbrightness, contrast, saturation, gamma
despilltype (0 green, 1 blue), mix, expand, blue, red, green, brightness, alpha (0 or 1)

The change applies to the running key at once, on every brand, but it is not saved. When the ingest restarts, the saved values come back. Save the values you settle on with step 6.

6. Save the setup, add or drop a brand​

curl -X PUT "https://bintu.nanostream.cloud/stream/<INGEST_STREAM_ID>/options" \
-H "x-bintu-apikey: $BINTU_API_KEY" \
-H "content-type: application/json" \
-d '{
"name": "chroma_key",
"group": "chroma_key-1",
"options": {
"color": "#00FF00",
"similarity": 0.3,
"blend": 0.05,
"filter": "chromakey",
"targets": [
{ "streamId": "<BRAND_1_STREAM_ID>", "background": "brand_1_1080.mp4" },
{ "streamId": "<BRAND_2_STREAM_ID>", "background": "brand_2_1080.jpg" },
{ "streamId": "<BRAND_3_STREAM_ID>", "background": "brand_3_1080.mp4" }
]
}
}'

The PUT replaces the whole option, so always send the complete targets list:

  • Add a brand: create its stream (step 2), then PUT the list with the new target appended.
  • Drop a brand: PUT the list without it.

A running ingest can keep its previous configuration until it restarts. Restart the broadcast in your encoder (or use Bounce in the setup tool) so saved changes such as new backgrounds take effect. See Stream not updating after Apply.

Play a branded output​

Each brand is a regular nanoStream stream. Play one brand per player with its stream ID or stream group, and secure each brand with its own playback token. The player example and the rules for multi-brand pages are in Branded outputs: deliver outputs to viewers.

Errors and limits​

ProblemWhat to check
GET /stream/{id}/options is refusedYour login is read-only. Use an API key or a user with write access.
A target is rejectedEvery targets[].streamId must be an existing stream. Create it first (step 2).
A background or overlay isn't foundFile names are stored in lower case. Use the stored name.
Outputs stay blackThe encoder publishes to another server. Use rtmp://bintu-studio.nanocosmos.de/live.
You need more than 15 brands per ingestContact sales at sales@nanocosmos.net.

For upload or option errors these steps don't explain, get support and include the ingest stream ID.

Next steps​

tip

Try it in the Builder Hub: set up nanoStudio Chroma visually first, then automate it with these calls. See the Builder Hub guide. Start for Free