1.3 Basic Concepts
To effectively utilize the JSON2Video API, it's crucial to understand the core concepts it employs. These concepts provide the foundation for creating and manipulating videos programmatically.
These are the core concepts you need to know to get started:
-
Movie: The final video output generated by the JSON2Video API. It's defined by a JSON document that outlines the video's properties and content. Movies can contain scenes and also elements. The movie elements can overlay the scenes.
-
Scene: A segment within a movie. A movie can consist of one or multiple scenes. Scenes are used to structure the video and cannot overlap. Each scene is rendered independently and then chained one after the other to create the final video.
-
Element: The fundamental building block of a movie or scene. Elements represent the various content components, such as images, videos, text, audio, and more.
-
Duration and timing: Elements have a duration and a start time. The start time is the time in the movie or the scene when the element will start to play. The duration is the length of the element. The duration can be set to a fixed value (in seconds) or to 2 special values:
auto
andcontainer
. Auto: The element will play for the natural duration of the asset (e.g. a video or an audio file). Container: The element will play for the duration of its container (the scene or movie) and will be trimmed if its natural duration is longer than the calculated duration of the container. -
Coordinates: A coordinate system similar to web development (HTML/CSS) is used to position visual elements (images, text, videos) within a scene or movie. The top-left corner of the video canvas is (0,0).
-
Layering: Elements are stacked on top of each other, similar to HTML elements. The order of elements in the JSON array determines their layering, with later elements appearing on top of earlier ones.
-
Caching: The API utilizes a caching system to optimize video rendering. This system avoids redundant downloading and re-rendering of assets, improving processing speed. Caching can be bypassed using the
cache
property.