Skip to main content

Create Multi-Scene Videos

In this example we will look at how to create long/multi-scene videos using the Predis.ai API. The parameter video_duration controls if the generated video will be a video with a single scene or multiple scenes. We will set the value of video_duration to long for multi-scene videos in the request.

import requests

url = "https://brain.predis.ai/predis_api/v1/create_content/"

payload = {
"brand_id": "YOUR_BRAND_ID",
"text": "3 tips for a healthy morning breakfast",
"media_type": "video",
"video_duration": "long", # long signifies multi-scene videos
"template_ids": [] # pass template_ids if you want video in specific design
}

headers = {"Authorization": "YOUR_API_KEY"}

response = requests.request("POST", url, data=payload, headers=headers)

if response.status_code == 200:
json_response = response.json()
post_id = response.get("post_id")
post_status = response.get("status")

else:
print("Error occurred - {}".format(response.text))

If you get a inProgress status in response, your request is successful and the video is getting generated. Once the video gets generated successfully (or fails), you will get a request on your configured webhook URL with more details about the video.