How to Create Split Screen Videos using an API?

A split screen video consists of two video clips displayed at the same time, usually side-by-side and vertically. To programmatically create split screen videos, you'll need a video editing API capable of processing video footage. Here's how to do it with just a single API call:

API Request
curl -s -X POST https://api.creatomate.com/v1/renders \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  --data-binary @- << EOF
{
  "source": {
    "output_format": "mp4",
    "width": 1920,
    "height": 1080,
    "duration": 6,
    "elements": [
      {
        "type": "video",
        "source": "https://cdn.creatomate.com/demo/river.mp4",
        "x": "25%",
        "width": "50%"
      },
      {
        "type": "video",
        "source": "https://cdn.creatomate.com/demo/bridge.mp4",
        "x": "75%",
        "width": "50%"
      }
    ]
  }
}
EOF
Output Video

How it works: This example shows how to use cURL to invoke the REST API to create a split screen video. However, you can use any programming language or tool to make the API request. We describe the video we want to make with JSON. This way, you can generate any kind of video, just by providing the right JSON instructions, and the API will take care of the video rendering process.

As we just want to create a very simple split screen video, we can put together a very simple composition. Let's start with the resolution. In this case, the composition's resolution is set to 1080p landscape (1920 by 1080). Next, we'll add two video elements.

To display both videos side-by-side, we'll use the "x" and "width" properties. These positions are relative to the center of each video element. So, to make the videos appear on the left and right sides, we'll set their positions to "25%" and "75%" respectively. For them to cover half of the screen horizontally, we'll set the width to "50%".

To create more advanced video compositions, it may be easier to use the video editor. Using this online tool, you can quickly create advanced video templates using the drag-and-drop interface. You can then export your designs as JSON for easy integration into automated workflows. Sign up for a free account to try it out.

Edit this Code Example in the Video Editor

Easily design your own video templates using the online editor. Then, export your templates as JSON and integrate them into your application to create any kind of video – completely through code.

Related API Video Editing Questions

Start automating today

Start with a full-featured trial with 50 credits, no credit card required.
Get started for free