A common way to resize vertical videos into landscape format is by adding a background blur. Using this technique, a blurred copy is placed in the background to fill in the borders of the video. You can create these videos programmatically using a video editing API. Here's how, using a single 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,
"elements": [
{
"type": "video",
"clip": true,
"color_overlay": "rgba(0,0,0,0.15)",
"blur_radius": 57,
"source": "https://cdn.creatomate.com/demo/vertical.mp4",
"volume": "0%"
},
{
"type": "video",
"source": "https://cdn.creatomate.com/demo/vertical.mp4",
"fit": "contain"
}
]
}
}
EOF
How it works: This example shows how to use CURL to invoke the REST API. However, you can use any language or tool to make this API request. Because the composition is defined in JSON, we can create any MP4 simply by specifying how the video should be composed programmatically. The API takes care of everything.
Start by deciding on the desired output resolution, like 1080p (1920 x 1080). Next, define two video elements. The first element is the blurred background video. Using the "blur_radius" property, you can customize the amount of blur. And by using the "color_overlay" property, you can darken the background a bit. Make sure to mute the background video element using the "volume" property.
The second element is the foreground video. Set the "fit" property to "contain" to ensure that it fits perfectly within the edges of the final video. It is worth noting that neither element is specified with a duration, that's because the output video length is calculated automatically.
If you prefer a more visual editing experience, be sure to check out the video editor below. It lets you drag and drop video clips into place, so you can easily create your own video templates. You can then export these designs as JSON to use in your automated workflows.