Skip to main content

Timeline

The timeline is the core data structure for composing videos in Vidiking. It uses a Shotstack-compatible JSON format built around four concepts: timeline, tracks, clips, and assets.

Structure Overview

Timeline
├── background (color)
├── soundtrack (audio URL)
└── tracks[] (ordered layers)
└── clips[] (media segments)
├── asset (content: video, image, title, audio, html)
├── start (seconds)
├── length (seconds)
├── transition (in/out effects)
├── offset (x/y position)
├── scale (size multiplier)
└── opacity (0-1)

Tracks

Tracks are ordered layers. Track 0 is the topmost layer (foreground), and higher-indexed tracks sit behind it. This is the same ordering as Shotstack.

{
"timeline": {
"tracks": [
{ "clips": [...] },
{ "clips": [...] },
{ "clips": [...] }
]
}
}

In this example, tracks[0] renders on top of tracks[1], which renders on top of tracks[2].

Clips

A clip places an asset on the timeline at a specific start time for a specific duration.

PropertyTypeRequiredDescription
assetobjectYesThe content to render (see Asset Types)
startnumberYesStart time in seconds
lengthnumberYesDuration in seconds
transitionobjectNoIn/out transition effects
offsetobjectNo{ x: number, y: number } position offset (-1 to 1)
scalenumberNoSize multiplier (default 1.0)
opacitynumberNoTransparency (0 = invisible, 1 = fully visible)
fitstringNocover, contain, crop, none

Asset Types

Video

{
"type": "video",
"src": "https://example.com/clip.mp4",
"trim": 2,
"volume": 0.8
}

Image

{
"type": "image",
"src": "https://example.com/photo.jpg"
}

Title

{
"type": "title",
"text": "My Title",
"style": "minimal",
"size": "large",
"color": "#ffffff"
}

Audio

{
"type": "audio",
"src": "https://example.com/music.mp3",
"trim": 0,
"volume": 0.5,
"effect": "fadeInFadeOut"
}

HTML

{
"type": "html",
"html": "<div style='color:white;font-size:48px'>Custom HTML</div>",
"css": "div { text-align: center; }",
"width": 800,
"height": 200
}

Full Example: Two Tracks with Transitions

This example creates a video with a title overlay on top of an image background, with fade transitions.

{
"timeline": {
"background": "#000000",
"tracks": [
{
"clips": [
{
"asset": {
"type": "title",
"text": "Welcome to Vidiking",
"style": "minimal",
"size": "large",
"color": "#ffffff"
},
"start": 0.5,
"length": 4,
"transition": {
"in": "fade",
"out": "fade"
},
"offset": {
"x": 0,
"y": -0.2
}
}
]
},
{
"clips": [
{
"asset": {
"type": "image",
"src": "https://example.com/background1.jpg"
},
"start": 0,
"length": 5,
"transition": {
"in": "fade",
"out": "fade"
}
},
{
"asset": {
"type": "image",
"src": "https://example.com/background2.jpg"
},
"start": 5,
"length": 5,
"transition": {
"in": "fade",
"out": "fade"
}
}
]
}
]
},
"output": {
"format": "mp4",
"resolution": "hd"
}
}

curl

curl -X POST https://api.vidiking.com/v1/render \
-H "Authorization: Bearer $VIDIKING_API_KEY" \
-H "Content-Type: application/json" \
-d @timeline.json

Node.js

const { jobId } = await client.render({
timeline: {
background: '#000000',
tracks: [
{
clips: [
{
asset: { type: 'title', text: 'Welcome to Vidiking', style: 'minimal', size: 'large' },
start: 0.5,
length: 4,
transition: { in: 'fade', out: 'fade' },
},
],
},
{
clips: [
{
asset: { type: 'image', src: 'https://example.com/bg1.jpg' },
start: 0,
length: 5,
transition: { in: 'fade', out: 'fade' },
},
{
asset: { type: 'image', src: 'https://example.com/bg2.jpg' },
start: 5,
length: 5,
transition: { in: 'fade', out: 'fade' },
},
],
},
],
},
output: { format: 'mp4', resolution: 'hd' },
});

Python

result = client.render({
"timeline": {
"background": "#000000",
"tracks": [
{
"clips": [
{
"asset": {"type": "title", "text": "Welcome to Vidiking", "style": "minimal", "size": "large"},
"start": 0.5,
"length": 4,
"transition": {"in": "fade", "out": "fade"},
}
]
},
{
"clips": [
{
"asset": {"type": "image", "src": "https://example.com/bg1.jpg"},
"start": 0,
"length": 5,
"transition": {"in": "fade", "out": "fade"},
},
{
"asset": {"type": "image", "src": "https://example.com/bg2.jpg"},
"start": 5,
"length": 5,
"transition": {"in": "fade", "out": "fade"},
},
]
},
],
},
"output": {"format": "mp4", "resolution": "hd"},
})

Output Options

PropertyTypeOptionsDefault
formatstringmp4, gif, webm, movmp4
resolutionstringpreview, sd, hd, 1080, 4khd
fpsnumber15, 24, 25, 30, 6025
qualitystringlow, medium, highmedium
aspectRatiostring16:9, 9:16, 1:1, 4:516:9