JSON Structure Overview
Complete reference for the Zvid JSON video configuration, including all object structures, types, and configuration options.
Main JSON Structure
A Zvid project is defined as a plain JSON object.
Example:
{
"name": "my-video",
"duration": 30,
"visuals": [],
"audios": []
}
Project Configuration
Project Object
The main configuration object that defines your video.
interface Project {
name?: string;
width?: number;
height?: number;
duration?: number;
frameRate?: number;
backgroundColor?: string;
outputFormat?: string;
resolution?: ResolutionPreset;
visuals?: Items[];
audios?: AudioItem[];
subtitle?: Subtitle;
}
Properties:
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
name | string | No | 'unnamed' | Output filename (without extension) |
width | number | No | 1280 | Video width in pixels (overridden by resolution) |
height | number | No | 720 | Video height in pixels (overridden by resolution) |
resolution | ResolutionPreset | No | "custom" | Preset resolution that overrides width/height |
duration | number | No | 10 | Total video duration in seconds |
frameRate | number | No | 30 | Frames per second (e.g., 30, 60) |
backgroundColor | string | No | "#ffffff" | Background color in hex format (#000000) |
outputFormat | string | No | "mp4" | Output video format |
visuals | Items[] | No | [] | Array of visual elements |
audios | AudioItem[] | No | [] | Array of audio elements |
subtitle | Subtitle | No | null | Caption and subtitle configuration |
Example:
{
"name": "my-video",
"duration": 30,
"visuals": [],
"audios": []
}
Resolution Presets
The resolution property allows you to use predefined video dimensions optimized for different platforms and use cases. When specified, it overrides the width and height properties.
Available Presets
| Preset | Dimensions | Aspect Ratio | Use Case |
|---|---|---|---|
sd | 640×480 | 4:3 | Standard definition |
hd | 1280×720 | 16:9 | HD content |
full-hd | 1920×1080 | 16:9 | Full HD content |
squared | 1080×1080 | 1:1 | Square format |
youtube-short | 1080×1920 | 9:16 | YouTube Shorts |
youtube-video | 1920×1080 | 16:9 | YouTube videos |
tiktok | 1080×1920 | 9:16 | TikTok videos |
instagram-reel | 1080×1920 | 9:16 | Instagram Reels |
instagram-post | 1080×1080 | 1:1 | Instagram posts |
instagram-story | 1080×1920 | 9:16 | Instagram Stories |
instagram-feed | 1080×1080 | 1:1 | Instagram feed posts |
twitter-landscape | 1200×675 | 16:9 | Twitter landscape videos |
twitter-portrait | 1080×1350 | 4:5 | Twitter portrait videos |
twitter-square | 1080×1080 | 1:1 | Twitter square videos |
facebook-video | 1080×1920 | 9:16 | Facebook videos |
facebook-story | 1080×1920 | 9:16 | Facebook Stories |
facebook-post | 1080×1080 | 1:1 | Facebook posts |
snapshat | 1080×1920 | 9:16 | Snapchat content |
custom | Uses w×h | Variable | Custom dimensions (default) |
Resolution Examples
{
"name": "instagram-content",
"resolution": "instagram-post",
"duration": 15,
"visuals": []
}
{
"name": "custom-content",
"resolution": "custom",
"width": 1600,
"height": 900,
"duration": 20,
"visuals": []
}
{
"name": "override-example",
"width": 1920,
"height": 1080,
"resolution": "squared",
"duration": 10,
"visuals": []
}
Platform-Specific Examples
{
"name": "my-youtube-short",
"resolution": "youtube-short",
"duration": 60,
"visuals": []
}
{
"name": "my-tiktok",
"resolution": "tiktok",
"duration": 30,
"visuals": []
}
{
"name": "twitter-promo",
"resolution": "twitter-landscape",
"duration": 45,
"visuals": []
}
Position and Resize Properties
The Zvid JSON format includes two powerful properties that simplify element positioning and sizing:
Position Property
The position property provides preset positioning options that override the x and y coordinates for any visual element.
Available Position Presets:
| Preset | Description | Coordinates |
|---|---|---|
"top-left" | Position element at top-left corner | x = 0, y = 0 |
"top-center" | Position element at top-center | x = (projectWidth - itemWidth) / 2, y = 0 |
"top-right" | Position element at top-right corner | x = projectWidth - itemWidth, y = 0 |
"center-left" | Position element at center-left | x = 0, y = (projectHeight - itemHeight) / 2 |
"center-center" | Position element at center of video | x = (projectWidth - itemWidth) / 2, y = (projectHeight - itemHeight) / 2 |
"center-right" | Position element at center-right | x = projectWidth - itemWidth, y = (projectHeight - itemHeight) / 2 |
"bottom-left" | Position element at bottom-left corner | x = 0, y = projectHeight - itemHeight |
"bottom-center" | Position element at bottom-center | x = (projectWidth - itemWidth) / 2, y = projectHeight - itemHeight |
"bottom-right" | Position element at bottom-right corner | x = projectWidth - itemWidth, y = projectHeight - itemHeight |
"custom" | Use explicit x and y values (default) | Uses provided x and y coordinates |
Position Examples:
{
"type": "IMAGE",
"src": "https://example.com/image.jpg",
"width": 400,
"height": 300,
"position": "center-center"
}
{
"type": "TEXT",
"text": "Watermark",
"width": 200,
"height": 50,
"position": "top-right",
"style": {
"fontSize": "24px",
"color": "#ffffff"
}
}
{
"type": "IMAGE",
"src": "https://example.com/logo.png",
"x": 100,
"y": 50,
"position": "custom"
}
Resize Property
The resize property provides CSS-like resizing behavior for image, video, and GIF elements, overriding the width and height properties while maintaining aspect ratio.
Available Resize Modes:
| Mode | Description | Behavior |
|---|---|---|
"contain" | Scale to fit within bounds (letterboxing) | Entire media visible, may have empty space |
"cover" | Scale to fill bounds (cropping) | Fills entire area, may crop parts of media |
Resize Examples:
{
"type": "IMAGE",
"src": "https://example.com/photo.jpg",
"width": 400,
"height": 300,
"resize": "contain"
}
{
"type": "VIDEO",
"src": "https://example.com/video.mp4",
"width": 400,
"height": 300,
"resize": "cover"
}
{
"type": "IMAGE",
"src": "https://example.com/background.jpg",
"width": 1920,
"height": 1080,
"position": "center-center",
"resize": "cover"
}
Resize Behavior Details:
-
Contain: Similar to CSS
object-fit: contain- Scales media to fit entirely within the specified dimensions
- Maintains original aspect ratio
- May result in letterboxing (empty space) if aspect ratios don't match
-
Cover: Similar to CSS
object-fit: cover- Scales media to completely fill the specified dimensions
- Maintains original aspect ratio
- May crop parts of the media if aspect ratios don't match
Zoom Property
The zoom property adds zoom effects to image, video, and GIF elements. It can be used to create dynamic zoom-in effects for videos or static zoom effects for images.
Zoom Configuration:
The zoom property accepts a boolean value, which adds a zoom effect at the center of the item.
zoom: true;
Zoom Examples:
{
"type": "IMAGE",
"src": "https://example.com/photo.jpg",
"width": 400,
"height": 300,
"zoom": true
}
Anchor Property
The anchor property sets the element's anchor point used for positioning. It works alongside position.
export type Anchor =
| "top-left"
| "top-center"
| "top-right"
| "center-left"
| "center-center"
| "center-right"
| "bottom-left"
| "bottom-center"
| "bottom-right";
- Default:
center-center - Applies to:
IMAGE,TEXT,SVG,GIF - Description: Changes the origin point for position, rotation (
angle) and zoom/scale operations. For example,top-leftanchors transforms at the element's top-left corner, whilecenter-centeruses the element center.
Anchor Examples:
{
"type": "TEXT",
"text": "Headline",
"anchor": "center-center",
"x": 640,
"y": 50
}
Element Types
The Zvid JSON format supports various element types for creating rich video content:
Visual Elements
- Text Elements - Add styled text, titles, and captions
- Image Elements - Include photos, graphics, and static images
- Video Elements - Embed video clips with timing control
- GIF Elements - Add animated GIFs
- SVG Elements - Include scalable vector graphics and shapes
Audio Elements
- Audio Elements - Background music, sound effects, and voiceovers
Captions & Subtitles
- Subtitle - Add synchronized captions with word-level timing
Effects and Animations
- Animation Effects - Entrance and exit animations for all elements
- Video Transitions - Smooth transitions between video clips
Configuration Defaults
The format is designed to be flexible, with many optional properties that have sensible default values.
Project Defaults
| Property | Default Value | Description |
|---|---|---|
width | 1280 | Video width in pixels |
height | 720 | Video height in pixels |
duration | 10 | Duration in seconds |
frameRate | 30 | Frames per second |
backgroundColor | "#ffffff" | Background color (hex) |
outputFormat | "mp4" | Output format (e.g., mp4, mov) |
name | 'unnamed' | Output file name (without extension) |
Visual Item Defaults
These defaults apply to all visual elements (IMAGE, VIDEO, TEXT, GIF, SVG).
| Property | Default Value | Description |
|---|---|---|
x | 0 | Horizontal position (pixels) |
y | 0 | Vertical position (pixels) |
position | "custom" | Position preset (overrides x, y) |
anchor | "top-left" | Anchor point for positioning |
resize | null | Resize mode for media items |
zoom | false | Adding zoom effect |
enterBegin | 0 | Start time of enter animation (seconds) |
enterEnd | 0 | End time of enter animation (seconds) |
exitBegin | project.duration | Start time of exit animation (seconds) |
exitEnd | project.duration | End time of exit animation (seconds) |
opacity | 1 | Opacity (0 to 1) |
angle | 0 | Rotation angle (degrees) |
flipV | false | Flip Vertically |
flipH | false | Flip Horizontal |
track | 0 | Composition track index |
enterAnimation | null | Enter animation name (e.g., "fade") |
exitAnimation | null | Exit animation name (e.g., "fade") |
Video Item Defaults
| Property | Default Value | Description |
|---|---|---|
videoBegin | 0 | Start time within the source video |
videoEnd | source duration | End time within the source video |
volume | 1 | Audio volume (0 to 1) |
speed | 1 | Playback speed |
Audio Item Defaults
| Property | Default Value | Description |
|---|---|---|
audioBegin | 0 | Start time within the source audio |
audioEnd | source duration | End time within the source audio |
volume | 1 | Audio volume (0 to 1) |
speed | 1 | Playback speed |
Quick Examples
Basic Text Element
{
"type": "TEXT",
"text": "Hello World",
"x": 640,
"y": 360,
"style": {
"fontSize": "48px",
"color": "#000000",
"textAlign": "center"
}
}
Basic Image Element
{
"type": "IMAGE",
"src": "https://images.pexels.com/photos/32972375/pexels-photo-32972375.jpeg",
"x": 100,
"y": 100,
"width": 607,
"height": 910
}
Basic Video Element
{
"type": "VIDEO",
"src": "https://videos.pexels.com/video-files/1409899/1409899-sd_640_360_25fps.mp4",
"videoEnd": 10
}
Basic Audio Element
{
"src": "https://cdn.pixabay.com/audio/2025/04/21/audio_ed6f0ed574.mp3",
"volume": 0.5
}
Supported Formats
Video Formats
- Input: Supports FFmpeg-compatible video formats (for example: MP4, AVI, MOV, WebM, MKV)
- Output: Supports FFmpeg-compatible video formats (for example: MP4, AVI, MOV, WebM, MKV)
Image Formats
- Supported: All browser-supported image formats
Audio Formats
- Supported: Supports FFmpeg-compatible audio formats (for example: MP3, WAV, AAC, OGG)
Performance Considerations
Optimization Tips
- Image Sizes: Use appropriate image dimensions to avoid unnecessary scaling
- Video Codecs: Use H.264 for best compatibility and performance
- Audio Quality: Balance quality vs file size for audio tracks
- Memory Usage: Monitor memory usage for long or high-resolution videos
- Parallel Processing: FFmpeg optimization depends on the rendering environment
Resource Limits
- Maximum Resolution: Limited by available system memory
- Maximum Duration: No hard limit, but longer videos require more processing time
- Concurrent Elements: No limit on number of visual elements per track
Detailed Documentation
For comprehensive information about each element type and feature:
Element Types
- Text Elements - Complete text styling and formatting guide
- Image Elements - Image handling, filters, and effects
- Video Elements - Video clips, timing, and audio control
- GIF Elements - Animated GIF integration
- SVG Elements - Vector graphics and scalable shapes
- Audio Elements - Audio mixing and synchronization
Captions & Subtitles
- Subtitle - Add synchronized captions with word-level timing
Effects and Animations
- Animation Effects - Element entrance and exit animations
- Video Transitions - Professional video-to-video transitions
Next Steps
- Getting Started - Get started with your first video
- Examples - Practical implementation examples
- FAQ - Common questions and troubleshooting