Compile timeline (v2)
curl --request POST \
--url https://api.videodb.io/timeline_v2 \
--header 'Content-Type: application/json' \
--header 'x-access-token: <api-key>' \
--data '
{
"request_type": "compile",
"timeline": [
{
"video_id": "m-12345",
"clips": [
{
"start": 0,
"end": 30,
"volume": 1
}
]
}
],
"output_format": "mp4",
"quality": "high"
}
'const options = {
method: 'POST',
headers: {'x-access-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
request_type: 'compile',
timeline: [{video_id: 'm-12345', clips: [{start: 0, end: 30, volume: 1}]}],
output_format: 'mp4',
quality: 'high'
})
};
fetch('https://api.videodb.io/timeline_v2', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.videodb.io/timeline_v2",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'request_type' => 'compile',
'timeline' => [
[
'video_id' => 'm-12345',
'clips' => [
[
'start' => 0,
'end' => 30,
'volume' => 1
]
]
]
],
'output_format' => 'mp4',
'quality' => 'high'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-access-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.videodb.io/timeline_v2"
payload := strings.NewReader("{\n \"request_type\": \"compile\",\n \"timeline\": [\n {\n \"video_id\": \"m-12345\",\n \"clips\": [\n {\n \"start\": 0,\n \"end\": 30,\n \"volume\": 1\n }\n ]\n }\n ],\n \"output_format\": \"mp4\",\n \"quality\": \"high\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-access-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.videodb.io/timeline_v2")
.header("x-access-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"request_type\": \"compile\",\n \"timeline\": [\n {\n \"video_id\": \"m-12345\",\n \"clips\": [\n {\n \"start\": 0,\n \"end\": 30,\n \"volume\": 1\n }\n ]\n }\n ],\n \"output_format\": \"mp4\",\n \"quality\": \"high\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.videodb.io/timeline_v2")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-access-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"request_type\": \"compile\",\n \"timeline\": [\n {\n \"video_id\": \"m-12345\",\n \"clips\": [\n {\n \"start\": 0,\n \"end\": 30,\n \"volume\": 1\n }\n ]\n }\n ],\n \"output_format\": \"mp4\",\n \"quality\": \"high\"\n}"
response = http.request(request)
puts response.read_body$headers=@{}
$headers.Add("x-access-token", "<api-key>")
$headers.Add("Content-Type", "application/json")
$response = Invoke-WebRequest -Uri 'https://api.videodb.io/timeline_v2' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"request_type": "compile",
"timeline": [
{
"video_id": "m-12345",
"clips": [
{
"start": 0,
"end": 30,
"volume": 1
}
]
}
],
"output_format": "mp4",
"quality": "high"
}'import Foundation
let parameters = [
"request_type": "compile",
"timeline": [
[
"video_id": "m-12345",
"clips": [
[
"start": 0,
"end": 30,
"volume": 1
]
]
]
],
"output_format": "mp4",
"quality": "high"
] as [String : Any?]
let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])
let url = URL(string: "https://api.videodb.io/timeline_v2")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = [
"x-access-token": "<api-key>",
"Content-Type": "application/json"
]
request.httpBody = postData
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))using RestSharp;
var options = new RestClientOptions("https://api.videodb.io/timeline_v2");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("x-access-token", "<api-key>");
request.AddJsonBody("{\n \"request_type\": \"compile\",\n \"timeline\": [\n {\n \"video_id\": \"m-12345\",\n \"clips\": [\n {\n \"start\": 0,\n \"end\": 30,\n \"volume\": 1\n }\n ]\n }\n ],\n \"output_format\": \"mp4\",\n \"quality\": \"high\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
using RestSharp;
var options = new RestClientOptions("https://api.videodb.io/timeline_v2");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("x-access-token", "<api-key>");
request.AddJsonBody("{\n \"request_type\": \"compile\",\n \"timeline\": [\n {\n \"video_id\": \"m-12345\",\n \"clips\": [\n {\n \"start\": 0,\n \"end\": 30,\n \"volume\": 1\n }\n ]\n }\n ],\n \"output_format\": \"mp4\",\n \"quality\": \"high\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
const options = {
method: 'POST',
headers: {'x-access-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
request_type: 'compile',
timeline: [{video_id: 'm-12345', clips: [{start: 0, end: 30, volume: 1}]}],
output_format: 'mp4',
quality: 'high'
})
};
fetch('https://api.videodb.io/timeline_v2', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.videodb.io/timeline_v2");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-access-token: <api-key>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"request_type\": \"compile\",\n \"timeline\": [\n {\n \"video_id\": \"m-12345\",\n \"clips\": [\n {\n \"start\": 0,\n \"end\": 30,\n \"volume\": 1\n }\n ]\n }\n ],\n \"output_format\": \"mp4\",\n \"quality\": \"high\"\n}");
CURLcode ret = curl_easy_perform(hnd);CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.videodb.io/timeline_v2");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-access-token: <api-key>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"request_type\": \"compile\",\n \"timeline\": [\n {\n \"video_id\": \"m-12345\",\n \"clips\": [\n {\n \"start\": 0,\n \"end\": 30,\n \"volume\": 1\n }\n ]\n }\n ],\n \"output_format\": \"mp4\",\n \"quality\": \"high\"\n}");
CURLcode ret = curl_easy_perform(hnd);val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"request_type\": \"compile\",\n \"timeline\": [\n {\n \"video_id\": \"m-12345\",\n \"clips\": [\n {\n \"start\": 0,\n \"end\": 30,\n \"volume\": 1\n }\n ]\n }\n ],\n \"output_format\": \"mp4\",\n \"quality\": \"high\"\n}")
val request = Request.Builder()
.url("https://api.videodb.io/timeline_v2")
.post(body)
.addHeader("x-access-token", "<api-key>")
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute(){
"success": true,
"data": {
"stream_url": "https://stream.videodb.io/compiled/12345",
"duration": 120.5,
"format": "mp4"
}
}Create Timeline (v2)
Create advanced video compositions with multiple tracks, effects, and assets
POST
/
timeline_v2
Compile timeline (v2)
curl --request POST \
--url https://api.videodb.io/timeline_v2 \
--header 'Content-Type: application/json' \
--header 'x-access-token: <api-key>' \
--data '
{
"request_type": "compile",
"timeline": [
{
"video_id": "m-12345",
"clips": [
{
"start": 0,
"end": 30,
"volume": 1
}
]
}
],
"output_format": "mp4",
"quality": "high"
}
'const options = {
method: 'POST',
headers: {'x-access-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
request_type: 'compile',
timeline: [{video_id: 'm-12345', clips: [{start: 0, end: 30, volume: 1}]}],
output_format: 'mp4',
quality: 'high'
})
};
fetch('https://api.videodb.io/timeline_v2', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.videodb.io/timeline_v2",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'request_type' => 'compile',
'timeline' => [
[
'video_id' => 'm-12345',
'clips' => [
[
'start' => 0,
'end' => 30,
'volume' => 1
]
]
]
],
'output_format' => 'mp4',
'quality' => 'high'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-access-token: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.videodb.io/timeline_v2"
payload := strings.NewReader("{\n \"request_type\": \"compile\",\n \"timeline\": [\n {\n \"video_id\": \"m-12345\",\n \"clips\": [\n {\n \"start\": 0,\n \"end\": 30,\n \"volume\": 1\n }\n ]\n }\n ],\n \"output_format\": \"mp4\",\n \"quality\": \"high\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-access-token", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.videodb.io/timeline_v2")
.header("x-access-token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"request_type\": \"compile\",\n \"timeline\": [\n {\n \"video_id\": \"m-12345\",\n \"clips\": [\n {\n \"start\": 0,\n \"end\": 30,\n \"volume\": 1\n }\n ]\n }\n ],\n \"output_format\": \"mp4\",\n \"quality\": \"high\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.videodb.io/timeline_v2")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-access-token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"request_type\": \"compile\",\n \"timeline\": [\n {\n \"video_id\": \"m-12345\",\n \"clips\": [\n {\n \"start\": 0,\n \"end\": 30,\n \"volume\": 1\n }\n ]\n }\n ],\n \"output_format\": \"mp4\",\n \"quality\": \"high\"\n}"
response = http.request(request)
puts response.read_body$headers=@{}
$headers.Add("x-access-token", "<api-key>")
$headers.Add("Content-Type", "application/json")
$response = Invoke-WebRequest -Uri 'https://api.videodb.io/timeline_v2' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"request_type": "compile",
"timeline": [
{
"video_id": "m-12345",
"clips": [
{
"start": 0,
"end": 30,
"volume": 1
}
]
}
],
"output_format": "mp4",
"quality": "high"
}'import Foundation
let parameters = [
"request_type": "compile",
"timeline": [
[
"video_id": "m-12345",
"clips": [
[
"start": 0,
"end": 30,
"volume": 1
]
]
]
],
"output_format": "mp4",
"quality": "high"
] as [String : Any?]
let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])
let url = URL(string: "https://api.videodb.io/timeline_v2")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = [
"x-access-token": "<api-key>",
"Content-Type": "application/json"
]
request.httpBody = postData
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))using RestSharp;
var options = new RestClientOptions("https://api.videodb.io/timeline_v2");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("x-access-token", "<api-key>");
request.AddJsonBody("{\n \"request_type\": \"compile\",\n \"timeline\": [\n {\n \"video_id\": \"m-12345\",\n \"clips\": [\n {\n \"start\": 0,\n \"end\": 30,\n \"volume\": 1\n }\n ]\n }\n ],\n \"output_format\": \"mp4\",\n \"quality\": \"high\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
using RestSharp;
var options = new RestClientOptions("https://api.videodb.io/timeline_v2");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("x-access-token", "<api-key>");
request.AddJsonBody("{\n \"request_type\": \"compile\",\n \"timeline\": [\n {\n \"video_id\": \"m-12345\",\n \"clips\": [\n {\n \"start\": 0,\n \"end\": 30,\n \"volume\": 1\n }\n ]\n }\n ],\n \"output_format\": \"mp4\",\n \"quality\": \"high\"\n}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
const options = {
method: 'POST',
headers: {'x-access-token': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
request_type: 'compile',
timeline: [{video_id: 'm-12345', clips: [{start: 0, end: 30, volume: 1}]}],
output_format: 'mp4',
quality: 'high'
})
};
fetch('https://api.videodb.io/timeline_v2', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.videodb.io/timeline_v2");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-access-token: <api-key>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"request_type\": \"compile\",\n \"timeline\": [\n {\n \"video_id\": \"m-12345\",\n \"clips\": [\n {\n \"start\": 0,\n \"end\": 30,\n \"volume\": 1\n }\n ]\n }\n ],\n \"output_format\": \"mp4\",\n \"quality\": \"high\"\n}");
CURLcode ret = curl_easy_perform(hnd);CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.videodb.io/timeline_v2");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-access-token: <api-key>");
headers = curl_slist_append(headers, "Content-Type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"request_type\": \"compile\",\n \"timeline\": [\n {\n \"video_id\": \"m-12345\",\n \"clips\": [\n {\n \"start\": 0,\n \"end\": 30,\n \"volume\": 1\n }\n ]\n }\n ],\n \"output_format\": \"mp4\",\n \"quality\": \"high\"\n}");
CURLcode ret = curl_easy_perform(hnd);val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"request_type\": \"compile\",\n \"timeline\": [\n {\n \"video_id\": \"m-12345\",\n \"clips\": [\n {\n \"start\": 0,\n \"end\": 30,\n \"volume\": 1\n }\n ]\n }\n ],\n \"output_format\": \"mp4\",\n \"quality\": \"high\"\n}")
val request = Request.Builder()
.url("https://api.videodb.io/timeline_v2")
.post(body)
.addHeader("x-access-token", "<api-key>")
.addHeader("Content-Type", "application/json")
.build()
val response = client.newCall(request).execute(){
"success": true,
"data": {
"stream_url": "https://stream.videodb.io/compiled/12345",
"duration": 120.5,
"format": "mp4"
}
}Create advanced video compositions with multiple tracks, clips, transitions, and effects. Timeline v2 provides granular control over video editing including cropping, filters, and positioning.
import videodb
from videodb.editor import Timeline, Track, Clip, VideoAsset
conn = videodb.connect(api_key="your_api_key")
# Create timeline with custom resolution and background
timeline = Timeline(conn)
timeline.resolution = "1920x1080"
timeline.background = "#000000"
# Create a track and add video clips
track = Track()
video_asset = VideoAsset(id="m-abc123def", start=0)
clip = Clip(asset=video_asset, duration=10)
track.add_clip(0, clip)
# Add another clip at 10 seconds
video_asset2 = VideoAsset(id="m-xyz789", start=0)
clip2 = Clip(asset=video_asset2, duration=8)
track.add_clip(10, clip2)
timeline.add_track(track)
# Generate the stream
stream_url = timeline.generate_stream()
print(f"Stream: {stream_url}")
import { connect, EditorTimeline, Track, Clip, EditorVideoAsset } from 'videodb';
const conn = await connect({ apiKey: 'your_api_key' });
// Create timeline with custom resolution and background
const timeline = new EditorTimeline(conn);
timeline.resolution = '1920x1080';
timeline.background = '#000000';
// Create a track and add video clips
const track = new Track();
const videoAsset = new EditorVideoAsset({ id: 'm-abc123def', start: 0 });
const clip = new Clip({ asset: videoAsset, duration: 10 });
track.addClip(0, clip);
// Add another clip at 10 seconds
const videoAsset2 = new EditorVideoAsset({ id: 'm-xyz789', start: 0 });
const clip2 = new Clip({ asset: videoAsset2, duration: 8 });
track.addClip(10, clip2);
timeline.addTrack(track);
// Generate the stream
const streamUrl = await timeline.generateStream();
console.log(`Stream: ${streamUrl}`);
- Timeline v2 supports multiple tracks for layering videos, audio, images, and text
- Clips define what asset plays and for how long (duration)
- Default resolution is 1280x720, default background is black
- Supports transitions, filters, cropping, and positioning on clips
- Download the generated timeline with the Download endpoint
Download Timeline
Export timeline as video file
Editor Guides
Learn advanced video composition
Authorizations
API key for authentication (sk-xxx format)
Body
application/json
⌘I