Skip to content

Create A New Stream

POST /videos/[id]/streams

Submit a new job to create a stream for a video. This endpoint will return the information of the created job.

Required API Key Role

admin

The status of the job can be tracked at /videos/<video_id>/jobs/<job_id>/status

New Stream Request Parameters

  • streamFormat: “MVHEVC”, “HEVC”, “H264”
  • transforms: (optional) array of transforms to apply. Omit it or use [] for no transforms. See reproject below.
  • useDrm: (optional) boolean. When true, the stream will be encrypted with Apple FairPlay.
  • preview: (optional) boolean. When true, omit bitrateLadder for a quick preview stream. (Must be MV-HEVC, 4320x4320 or less, and under 200 Mbps)
  • bitrateLadder: List of bitrates and heights for the stream. Bitrates are measured in Mbps.

Example Request to Create a New Stream

getVideoInfo.js
const newStreamData = {
streamFormat: 'MVHEVC',
bitrateLadder: [
{
bitrate: 5,
height: 1080
},
{
bitrate: 10,
height: 2160
},
{
bitrate: 15,
height: 2160
}
]
}
fetch('https://spatialgen.com/api/videos/<yourvideoid>/streams', {
method: 'POST',
headers: {
'X-SPATIALGEN-APPKEY': apiKey,
},
body: JSON.stringify(newStreamData)
}
)

Transform: Reproject to VR180

Use { "type": "reproject", "target": "VR180" } to convert an Apple Immersive Video to a 180-degree equirectangular stream.

Set streamFormat to "MVHEVC" for layered stereo or "HEVC" for side-by-side stereo. The maximum supported resolution is 4096x4096 per eye.

{
"streamFormat": "HEVC",
"transforms": [{ "type": "reproject", "target": "VR180" }],
"bitrateLadder": [
{ "height": 4096, "bitrate": 60 },
{ "height": 4096, "bitrate": 80 },
{ "height": 4096, "bitrate": 100 }
]
}

Example Response

response.json
{
"createdAt": string,
"id": number,
"status": string,
"progress": [],
}