Progressive video upload
api.video provides different ways to upload your videos. There are two ways to upload with tokens, and then there are two ways to upload depending on whether your video is over 200MB or under. This guide walks through how to do progressive video upload. Options covered in this guide include:
Progressive upload for a video that's 200MiB or more
Progressive upload for a video that's 200MiB or more using
byterange in the
Megabyte (MB) and Mebibyte (MiB) are both used to measure units of information on computer storage. 1 MB is 1000Kb (kilobytes), and 1 MiB is 1048.576Kb. api.video uses MiB.
Create an account
Before you can start uploading your first video, you need to create an api.video account.
Once you are logged in to the Dashboard, select the environment of your choice (sandbox or production) and copy your API key.
Choose an API client
The clients offered by api.video include:
To install your selected client, do the following:
Progressive upload in file chunks
When the video file you want to upload is too large to send in one request, you need to do a progressive upload. To upload the entire video, you must broken into chunks, and send each chunk in separate requests. The smallest chunk size allowed is 5 MiB.
When you do a progressive upload using one of the api.video clients, you must indicate when you send the last part.
If you implement this functionality without an api.video client, you do not need to indicate the last part of the progressive upload. api.video can track the chunk numbers based on your header which indicates
Content-Range, for example : part 3/3, according to the number of chunks you sent.
Progressive upload with byte range in the content-range header
A slightly more complicated way to upload a video that's 200 MiB or larger is to use
bytes in the
content-range header. This method requires that you define the exact byte ranges correctly, otherwise the entire upload to fail. When done correctly, your header will look like this:
Content-Range: bytes 0-5242879
And then continue from there. By default, the api.video clients handle uploads for you using this method. If you want to try it yourself without the client, the sample will look like this in cURL:
All api.video clients automatically use the
Content-Range: bytes method to upload big videos for you. You don't have to set it up yourself if you use a client!
Was this page helpful?