API Walkthrough
The following is a detailed, step-by-step walkthrough of an example enhancement with the Video AI API
Step 1: Create a Video Request
The following will create a new video enhancement request. Simply include some details about the source video, output parameters, and desired enhancements. To access our most up-to-date functionality, please look at our API Reference page. This endpoint is free to use and does not consume any credits.
curl --request POST \
--url https://api.topazlabs.com/video/ \
--header 'X-API-Key: Your-API-Key' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"source": {
"resolution": {
"width": 800,
"height": 448
},
"container": "mp4",
"size": 477010,
"duration": 4,
"frameRate": 24,
"frameCount": 97
},
"output": {
"resolution": {
"width": 800,
"height": 448
},
"audioCodec": "AAC",
"audioTransfer": "Copy",
"frameRate": 24,
"dynamicCompressionLevel": "High",
"container": "mp4"
},
"filters": [ {
"model": "apo-8",
"slowmo": 1,
"fps": 60,
"duplicate": true,
"duplicateThreshold": 0.1
} ]
}'Step 2: Accept and Upload the Video Request
Accept
After you have submitted the video request - you can choose to continue by calling this endpoint.
curl --request PATCH \
--url https://api.topazlabs.com/video/[your-requestID]/accept \
--header 'X-API-Key: Your-API-Key' \
--header 'accept: application/json'Upload
Once this endpoint is called, you will receive a set of URL(s). For convenience, you may use the following code snippet to upload the video to that link from your local device. In this example, we will upload the entire video file to a single URL due to its small file size. If you receive more than one URL, please follow the segmentation instructions described here.
S3_UPLOAD_URL=[https://...]
curl --verbose --request PUT \
--upload-file "Your-Video-File" \
--header "Content-Type: video/mp4" \
"$S3_UPLOAD_URL"Once uploaded, you'll receive some information about your upload, including your eTag number. This will be useful for the next step.
Step 3: Complete the Video Upload
After you have finished uploading your video segments, you may use the following request to confirm that all of your video segments have been received. Once this endpoint is called, you video will begin processing with its enhancements.
curl --request PATCH \
--url https://api.topazlabs.com/video/[your-requestID]/complete-upload \
--header 'X-API-Key: Your-API-Key' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"uploadResults": [
{
"partNum": 1,
"eTag": "your-eTag"
}
]
}'You should receive a response confirming that your request is queued for processing once you have called the endpoint.
Get the Video Status
You may use the following request to view the status of your video request
curl --request GET \
--url https://api.topazlabs.com/video/[your-requestID]/status \
--header 'X-API-Key: Your-API-Key' \
--header 'accept: application/json'Once your video has finished processing, you will receive a link to download your video as a response to this endpoint.
Congratulations! You have just completed your first Video API request with Topaz Labs
Last updated