How I Built 1,000 Personalised Videos in Under 100 seconds

Written by dazzatron | Published 2020/12/13
Tech Story Tags: marketing-automation | personalization | automated-video-editing | video-marketing | marketing-strategies | marketing-trends | programmatic-digital-ads | api-development

TLDRvia the TL;DR App

In this article I want to show you how to build 1,000 personalised birthday videos for 1,000 different people.
Currently this is close to impossible to do using traditional video editors such as Adobe Premiere and After Effects, with specialised personalisation agencies charging tens of thousands of dollars for this type of service.
In this article I’ll aim to show you a better way. One that doesn’t cost you hours of time, and would cost you only a fraction of what agencies would charge you.
To make this all happen I’ll be using the Shotstack API. This API allows you to render tens of thousands of videos in the cloud, and personalise each individual video through small changes to a JSON file.
(Disclosure: The author is a Co-founder at Shotstack.io.)
With this API rendering up to 200 videos concurrently in the cloud, the ability to work at enormous scale pushes the total time to render all 1,000 of our videos to just under 100 seconds.

Getting started

The speed behind this example was made possible through a Shotstack Enterprise account, but you can sign up for a free account that provides you with all the same functionalities and allows you to test the service out.
The example in this article has some throttling built in, but you’ll have to be aware of the usage limits of 10 requests per second, and 2,000 requests per month for free accounts if you plan to try this out yourself.
I’ll use Node.js to build the application, but feel free to use what works for you. The minimum you’ll need is a way to loop over a CSV file and send POST requests to the API. Nothing fancy.

Choosing our footage

I built a promotional video which we’ll use to offer our fictitious customers a discount on their birthday.
We’ll remove some of the video's content, and use those empty spaces for our personalised data. This data will be placed into a JSON file, and will place back all of those missing items with new values and animations.
For this particular template we’ll personalise the name, age, their younger “fake” age, the discount code, and the discount amount.
Shotstack uses a JSON object that acts like an editable timeline. This works in a similar fashion to how any desktop editing solution would work, with a timeline representing the video duration, and individual clips allowing you to manipulate its content.
For this article I won’t go into how this video was built, but if you’re interested in understanding how this particular video was edited you can find the JSON template here. And if you’re really keen this tutorial goes a little deeper into how you can design these videos yourself.
For this example we’ll use a simplified template where the animations have been pre-rendered, making it easy for us to add in specific HTML assets where our personalised content should go:

Our customers

For our customers we’ll use a dataset with information on about 1,000 concocted users. This will include their name, age, fake age, their discount code, and the discount amount. We will then use the data in this CSV to fill in the JSON template and send it to the API.
You can find the complete list here.

The application

The only thing you need to do now is iterate over the CSV file, add those personalised datapoints to the JSON template, and send each video edit to the API for rendering.
The below script works using an .env environment file with the Shotstack API key details in it. You can find an example of what that looks like here.

The result

Once you run the script you’ll see all thousand personalised templates be sent through to the API for rendering, and all output data will end up in a CSV file called video-list.csv, which will include the urls for each individual video.
The below list contains the first 20 videos, but if you don’t believe me you can find the whole list here.

So what next?

Personalised marketing has shown to lead to higher email open rates, higher click-through rates, better engagement, and provides you with a new way to build relationships with your audience.
The above only shows you a small example of what can be done by personalising videos at scale. And this is all done at lightning speeds, with this particular campaign not costing more than $30 to render.
We’re always talking to artists, marketers and other creative people on how video and code can be combined to create new and exciting ways to communicate with the world. If you want to follow along with that conversation sign up to our newsletter, and if you have an idea or suggestion let us know in the comments below.

Written by dazzatron | Co-founder at Shotstack.io. Previously Uber Marketplace.
Published by HackerNoon on 2020/12/13