In this guide, we'll explore key concepts you need to understand to use the JSON2Video API effectively. These include the movie, scenes, and elements, which together define the structure and behavior of your videos.
What Is a Movie?
A movie is the final output of the JSON2Video API—a video file in MP4 format. Movies are composed of:
- Scenes: Segments of the movie, similar to slides in a PowerPoint presentation.
- Elements: The individual components visible or audible in your movie, such as images, videos, text, animations, audio, and voiceovers.
While using scenes is optional, they help organize your content and simplify template maintenance and updates.
Scenes and Their Role
Scenes play sequentially, one after the other, and cannot overlap. Each scene can contain multiple elements, such as images, text, or videos. Additionally, movies can have elements that play alongside scenes, which is useful for global elements like:
- Watermarks
- Background music
- Subtitles
Understanding Elements
Elements are layered within scenes or directly within the movie. The stacking order determines their visibility:
- The first element in the list is at the bottom.
- The last element is at the top.
This layering system follows HTML principles and differs from tools like Photoshop, where the order is reversed. Elements also have three key properties to control their visibility:
- Start: The time (in seconds) from the start of its container (scene or movie) when the element becomes visible.
- Duration: The length of time (in seconds) the element is visible.
- Extra Time: Additional seconds added when the element is already hidden.
Duration Settings
JSON2Video provides flexibility with duration settings:
- Auto: The duration matches the actual length of the asset. For example, a 15-second video will have a duration of 15 seconds by default.
- Fixed: Set a specific duration (in seconds). If this is shorter than the asset's length, the asset will be trimmed. For example, setting a 15-second video to 10 seconds trims the last 5 seconds.
- Container: The element adjusts its duration to match its container. This is particularly useful for background music or similar assets.
Example: Using the Container Duration
Let’s break down an example:
- A scene contains a 20-second video.
- The scene has no explicit duration set, so it adjusts to the length of its longest element (the video, in this case, 20 seconds).
- Background music in the scene has its duration set to container, so it automatically trims to 20 seconds to match the scene's duration.
Streamlining Video Production
These concepts ensure you have precise control over how elements play and interact in your video. With JSON2Video, you don’t need to pre-calculate asset lengths—everything adjusts dynamically for seamless integration.