DEV Community

FlyNestor for Rollideo

Posted on

Create a video with auto-generated voice-overs with an API call

If you want to generate videos with voice-overs and to skip the repetitive tasks of video creation, follow this tutorial.

In this tutorial we are going to call an API with Python.

On the website Rollideo, you can launch the video generation directly from the home page, or use the APIs for more automation.

To use the Rollideo APIs:

  • Step 1: Create an account to get a free API key
  • Step 2: put your API key in the following code.
import requests, json, time

APIKEY = 'YOUR SECRET KEY HERE'
voice1 = "Joanna"

text1 = "A super easy tool to automatically create videos with auto-generated voice-overs and the exact subtitles. Example of a video sequence with " + voice1 +"'s voice."

picture1 = 'https://i.postimg.cc/3r4RL5YX/ocean1.jpg'

data = {
    'text_segments': [
   {
    'api_source_type': 'picture',
    'picture': picture1,
    'textforvideo': text1,  
    'voice_id': voice1  
   }
  ]
}

headers = {'x-api-key': f"{APIKEY}"}
response = requests.post('https://rollideo.com/create/video', headers=headers, json=data)
data2 = response.json()
print(data2)
launched = data2.get("launched", "ko")

if launched == "ok":
    # Use the Polling API endpoint to find out the status the above request /create/video.
    for i in range(1000):
        time.sleep(10)
        print(i)
        response2 = requests.post('https://rollideo.com/task/video', headers=headers, json=data2)
        success = response2.json().get("success", "not yet")
        if success == "ok" or success == "ko":
            print(response2.json())
            break
else:
    print("The launch of the task has failed")
    print(data2.get("message"))
Enter fullscreen mode Exit fullscreen mode

With a free account, you can create a video with one sequence.

You can upgrade your account to create longer videos with many sequences.

Top comments (0)