This Hello World guide should provide you with a basic understanding of how quick and easy it is to create a simple video using styled text, a soundtrack and a simple fade transition.
Before you begin ensure you have registered and received your API keys.
This tutorial uses Curl to create your first 'Hello World' video. Curl is a cross platform command line utility that can be used to POST data to an API. Curl is included by default on most modern operating systems including Windows 10, Linux and OS X.
To check if Curl is installed on your operating system open your terminal on Linux/OS X or the Command Prompt in Windows then type:
You should see an output like:
We'll use a text file to define the JSON data so that it is easy to edit and format. Open your preferred text editor and copy and paste the following JSON, save the file as hello.json:
You can now go ahead and POST the hello.json edit data to the API for rendering, to do this we'll use the render endpoint (using the staging sandbox URL). From the same directory as the hello.json file run the following Curl command:
Replace the x-api-key value with your own sandbox API key.
You should receive a 201 response code and payload similar to:
Take a note of the id, it will be different from the example above, you will need this in the next step. You should keep track of id in your own database as there is currently no way to retrieve a list of render id's.
Your video is now either waiting in a queue to be rendered or is being processed. To check the status and know when rendering is complete and the video file is ready we need to poll the API.
Using the id noted in the previous step and your own key, call the staging API using the following command:
Replace the UUID at the end of the render URL with the id output in the previous step.
In less than one minute you should receive a 200 response code and payload similar to the output below. The status parameter tells you what stage the render is at, done means the video is ready for download. Other status are queued, fetching, rendering, saving and failed.
If the status is failed then there has been an error and the render will not continue. Attempt to resolve the issue based on the error message then try again. If the problem persists check the community forum or contact us for support.
When the status returned from polling equals done, then the video is ready for hosting or downloading.
By default all videos are automatically sent to our video hosting and CDN service. After a few seconds the video should be available at the following locations:
The video created in this guide will be available at:
The Serve API provides more information on the status and availability of hosted files.
If you use your own hosting solution, you can opt-out from the Shotstack hosting service and transfer the file to the location of your choice.
Videos are stored temporarily for a 24 hour period at the following locations:
Download or transfer the video using the URL returned in the get render status response:
Do not serve the temporary URLs from your application as the file will be deleted after 24 hours. Check the Hosting and Serving Assets guide for the correct way to serve assets generated by the video editing API.
You will now have a basic understanding of the key steps needed to create a simple edit:
- Prepare the edit data
- POST the edit data to the API
- Poll the API and wait for the render to complete
- Serve the video from the Shotstack CDN
- Download or transfer the video to your own storage