Text to Video Usecase
Pictory's Text-to-Video APIs offer a dynamic way to transform the text into engaging videos.
These APIs allow for the creation and editing of videos based on various text inputs. For instance, if you have a blog or an article, you can easily convert it into a captivating video by simply providing the webpage URL. Text-to-Video APIs open up various possibilities, including:
- Generating new videos directly from existing text content.
- Converting your published blogs or articles into videos using their URLs.
Steps to generate video are mentioned in our Text to Video flow inside our Postman collection at Getting Started -> API Flows -> Text to Video Flow
Github Example for Text to Video.
Steps to Generate Video from Exiting Text
Pictory streamlines the video creation process by offering a preview of the video before finally generating your video. This feature allows users to review and customize any sections of the final video they wish to change. Here's a simple guide on how to generate a video preview from your content:
- Initiate a Video Preview Request: Begin by calling the Storyboard API. This action will generate a
job_id
in the response, which is essential for tracking your video's progress. You can opt to specify a callback URL using thewebhook
parameter in the Storyboard API. Once the Storyboard Job is completed, the response will be sent to the specifiedwebhook
URL in the request body.curl --request POST \ --url https://api.pictory.ai/pictoryapis/v1/video/storyboard \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --header 'Authorization: YOUR_AUTH_TOKEN' \ --header 'X-Pictory-User-Id: UNIQUE_CUSTOMER_ID' \ --data ' { "audio": { "aiVoiceOver": { "speaker": "Jackson", "speed": "100", "amplifyLevel": "1" }, "autoBackgroundMusic": true, "backGroundMusicVolume": 0.5 }, "brandLogo": { "url": "<YOUR_BRAND_LOGO>", "verticalAlignment": "top", "horizontalAlignment": "right" }, "videoName": "Video Name", "videoDescription": "Description Of Video", "language": "en", "videoWidth": "1080", "videoHeight": "1920", "scenes": [ { "text": "ENTER TEXT HERE WHICH NEEDS TO BE CONVERTED TO VIDEO", "voiceOver": true, "splitTextOnNewLine": true, "splitTextOnPeriod": true, } ], "videoWidth": "string", "videoHeight": "string", "webhook": "<WEBHOOK_CALLBACK_URL>" } '
The above Storyboard Request gives job_id
in response.
{
"success": true,
"data": {
"job_id": "6be314a6-2f0c-4ea5-b636-09aa16eb1d74"
}
}
You can use job_id
to get video preview and render parameters.
-
Monitor Job Status and Preview: In order to monitor the Job status you can use the
job_id
with the GET Job API to monitor the status of your request. Once the job is complete, you will receive a URL for the videopreview
along withrenderParams
in the response:curl --request GET \ --url https://api.pictory.ai/pictoryapis/v1/jobs/job_id \ --header 'Authorization:<YOUR_ACCESS_TOKEN>' --header 'X-Pictory-User-Id: <YOUR_UNIQUE_CUSTOMER_ID>' --header 'accept: application/json'
Above GET
job
API givesstatus
asin-progress
orcompleted
. Once Job Status iscompleted
below render response is sent.{ "success": true, "data": { "renderParams": { "audio": {...} "output": {...} "scenes":[{...}, {...}] }, "preview": "https://video.pictory.ai/preview/<JOB_ID>" } }
{ "job_id": "5ebf0ad3-6839-4e0c-a569-2e40a67598fb", "success": true, "data": { "status": "in-progress" } }
- Users can preview the video using the URL provided in
preview
parameter. renderParams
in the response body detailed settings like the URL for individual scenes and subtitle text for each scene in the video.
- Users can preview the video using the URL provided in
-
Customize Your Scenes: If scenes don’t meet your expectations, you can easily change them. Simply modify the scene
url
,animation
,text
etc in the renderParams scene object. This level of customization ensures that every aspect of your video can be tailored to your specific needs before generating the final video. -
Initiate Video Generation Request: Once you are happy with the video preview, proceed to the next step by calling the Video Render API. This action will initiate the final video generation process. Keep in mind that generating a video can take some time. Similar to the preview process (Step 1), this API will provide you with a
job_id
for tracking the progress of your video rendering. Additionally You can opt to specify a callback URL using thewebhook
parameter in the Render API. Once the Video Rendering Job is completed, the response will be sent to the specifiedwebhook
URL in the request body.
Send therenderParams
object received in previous steps as request body ofrender
API.curl --request POST \ --url https://api.pictory.ai/pictoryapis/v1/video/render \ --header 'Authorization: YOUR_AUTH_TOKEN' \ --header 'X-Pictory-User-Id: UNIQUE_CUSTOMER_ID' \ --data '{ "audio": {...} "output": {...} "scenes":[{...}, {...}] }'
-
Monitor Final Video Status: You can also use the
job_id
with the GET Job API to monitor the status of your video rendering request. When the rendering process is complete, you will receive the final video in the form of a URL.
curl --request GET \ --url https://api.pictory.ai/pictoryapis/v1/jobs/job_id \ --header 'Authorization:<YOUR_ACCESS_TOKEN>' --header 'X-Pictory-User-Id: <YOUR_UNIQUE_CUSTOMER_ID>' --header 'accept: application/json'
{
"job_id": "702f8260-c56a-4fbc-9741-ddc44df24aa2",
"success": true,
"data": {
"preview": "PreviewJsonFileUrl.json",
"txtFile": "textFileUrl.txt",
"audioURL": "audiofileurl.mp3",
"thumbnail": "videoThumbnailUrl.jpg",
"videoDuration": 13.13,
"videoURL": "OutputVideoUrl.mp4",
"vttFile": "OutputVideoVttFile.vtt",
"srtFile": "OutputVideoSrtFile.srt",
"shareVideoURL": "ShareVideoUrl.mp4",
"status": "completed"
}
}
{
"job_id": "5ebf0ad3-6839-4e0c-a569-2e40a67598fb",
"success": true,
"data": {
"status": "in-progress"
}
}
Updated 5 months ago