Programmatic Video Editing

Use programming languages like JavaScript, PHP, Ruby, or Python to create and edit dynamic videos. With just a few lines of code, you can easily scale your video production – whether you need short-form content for social media, personalized marketing campaigns, or other video projects.

  • Integrate into your preferred tech stack
  • Compose videos using JSON
  • Automate video generation

How to Programmatically Edit Videos

Creatomate's API offers two ways to create videos programmatically: by using a reusable video template or by building videos entirely from JSON. The template-based approach is quick and easy to set up, making it ideal for getting started. On the other hand, generating videos from JSON lets you create a fully custom video script, giving you much more flexibility and control over the process. No matter which method you choose, the online editor provides a great starting point.

1Create a video design

The editor allows you to design video templates with placeholders for elements like text, images, audio clips, and more. These placeholders can then be populated with custom content using the programming interface and SDKs. Plus, the system supports generative AI, making it possible to add voiceovers, visuals, and animated subtitles to your videos.

Templates are built from JSON, which you can think of as the source code for your video. It defines the entire video - from start to finish - and allows you to replace, style, transform, and animate any element. Once your video design is finished, you can easily export the JSON code and integrate it into your software. It works similarly to HTML, React, Angular, or other component-based architectures, but instead of creating webpages, you're using code to generate videos.

{
  output_format: "mp4",
  frame_rate: 30,
  width: 1080,
  height: 1080,

  elements: [
    {
      type: "video",
      track: 1,
      duration: 3,
      source: "https://example.com/video.mp4",
      animations: [
        { ... }
      ]
    },

    {
      type: "text",
      width: "90%",
      height: "10%",
      text: "Your overlay text here",
      font_family: "Cabin",
      font_weight: "700",
      fill_color: "#fff"
    },

    { ... }
  ],
}

2Integrate into your software

Once you've set up a template or JSON file, you can use the REST API to generate MP4 videos. All the heavy lifting is handled in the cloud, so there's no need to manage any video processing infrastructure yourself. The API operates on an auto-scaling system that offers unlimited processing power, handling any high-demand application. You won’t have to worry about server capacity, as the infrastructure automatically scales to meet your needs.

Check out the quick guide to getting started with the video generation API. It includes step-by-step instructions for Node.js, PHP, Ruby, and Python.

3Edit videos programmatically

JSON's flexibility, combined with Creatomate’s support for popular programming languages, makes video creation simple and intuitive. Whether you're creating personalized videos with just a customer’s name or generating highly customizable videos driven by dynamic data, the possibilities are endless.

Looking to create faceless shorts with AI-generated content? ChatGPT can write video scripts from a single topic, while DALL·E generates relevant background visuals. Pair it with a text-to-speech tool like ElevenLabs for AI voiceovers, and use Creatomate’s auto-transcription feature to add animated subtitles to complete your video.

Here are some tutorials you might find helpful:

👉 Using Node.js to Generate Instagram, YouTube, or TikTok Videos
👉 How to Create and Edit Video with PHP
👉 Create Videos with AI Voiceovers and Subtitles using an API
👉 Using ChatGPT's API to Auto-Create Social Media Videos by Code

Frequently asked questions

What is programmatic video editing?

Programmatic video editing is the process of using code to create videos, making it possible to automate video production and scale it efficiently. By using a programming language, you can interact with Creatomate's video generation API to produce dynamic videos directly from your own software and apps.

How do I create videos programmatically?

To create videos programmatically, start by designing your video using the online template editor. Once your design is ready, you can use the API to customize elements like text, images, audio, and more for each video. Alternatively, you can build videos entirely with JSON code, which gives you precise control over every aspect, including captions, media, timing, filters, effects, animations, and keyframes.

What types of videos can be edited programmatically?

No matter what video project you're working on - whether it's processing user-generated content, creating real estate videos, making social media shorts, or running personalized marketing campaigns - the API lets you programmatically create videos for your application. The editor allows you to design your own video template and even generate custom JSON code for dynamic video editing. Check out the editor to see what's possible!

Which programming languages can be used to generate videos?

Creatomate's API and JSON format are highly flexible, making them compatible with any programming language, including JavaScript, PHP, Python, Ruby, .NET, Go, and C++. This means you can create and edit videos using the tech stack you're already familiar with.

How long does it take to set up?

The time it takes to get up and running depends mainly on how quickly you or your designer can create the perfect video design. If you or your developer have a basic understanding of APIs and programming languages, you can send your first API request in about 10 minutes. For instructions, check out the getting started guide.

Can I build my own service on top of Creatomate’s video API?

Absolutely! Many developers use Creatomate’s API to build and power their own video applications. The API is compatible with any programming language, and we provide libraries on NPM and Packagist for Node.js and PHP to make integration even easier.

How much does it cost to edit videos programmatically?

Creatomate’s pricing starts at $49 per month, which includes 2,000 credits - enough to generate over 550 videos (at 720p, 25 fps, and 15 seconds long). The cost of each video depends on factors like resolution, frame rate, and duration. You can find a detailed explanation of how credits are calculated in our documentation.

Compared to building your own video rendering infrastructure with AWS EC2 servers, using an API is often much more affordable and significantly less complex, making it a very cost-effective solution.

What’s the best product for programmatic video editing?

There are many APIs for video generation, but we believe Creatomate stands out as the most comprehensive option. It offers the most advanced video editing features and powerful tools for setting up video generation applications. Check out this article for a detailed comparison of the top video editing APIs and decide for yourself.

Quickly get started

Learn how to automate your videos by following our practical tutorials.

Start automating today

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