Uploading Video

This guide will show you how to upload video files to Castr and get them ready for streaming to your audience.

The process involves directly uploading the file to a provided link, making it not resumable. If there is an error in your network connectivity while uploading, it will require a start over.

Directly uploading files from your local machine is recommended for file size <5GB. For files that are >5GB in size, we recommend using the Multipart Upload feature that's coming soon.

Step 1: Create a folder

You can make a POST /v2/videos call to create a new video object.

Sample request:

curl --request POST \
     --url https://api.castr.com/v2/videos \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '{"name":"myfolder"}'

Sample Response:

Here you will need the _id of the folder for moving on to the next step.

  "_id": "6517f0a4b5ffafac50584572",
  "name": "myfolder",
  "enabled": true,
  "type": "vod",
  "data": [],
  "user": "6517f056305a32ac3a0a8c9c",
  "creation_time": "2023-09-30T09:55:48.648Z"

Step 2: Get a Signed Link for Direct Upload

To generate a signed link for uploading a file to the video object you created in Step 1, use POST /videos/{video-id}/uploads with {video-id} taken from _id in Step 1.

Sample request:

curl --request POST \
     --url https://api.castr.com/v2/videos/6517f0a4b5ffafac50584572/uploads \
     --header 'accept: application/json' \
     --header 'authorization: {your_authentication}'

Sample Response:

The response contains the Signed Link for Step 3.

  "url": "https://castr-us-east-1.s3.us-east-1.amazonaws.com/",
  "fields": {
    "bucket": "castr-us-east-1",
    "X-Amz-Algorithm": "AWS4-HMAC-SHA256",
    "X-Amz-Credential": "AKIAYLUZI3YZDIXLDSHC/20230930/us-east-1/s3/aws4_request",
    "X-Amz-Date": "20230930T095750Z",
    "key": "vod_uploads/vd883b52005f7711ee9be6/vJnMnUByNr0QaD5H.mp4",
    "Policy": "eyJleHBpcmF0aW9uIjoiMjAyMy0wOS0zMFQxNTo1Nzo1MFoiLCJjb25kaXRpb25zIjpbeyJidWNrZXQiOiJjYXN0ci11cy1lYXN0LTEifSx7IlgtQW16LUFsZ29yaXRobSI6IkFXUzQtSE1BQy1TSEEyNTYifSx7IlgtQW16LUNyZWRlbnRpYWwiOiJBS0lBWUxVWkkzWVpESVhMRFNIQy8yMDIzMDkzMC91cy1lYXN0LTEvczMvYXdzNF9yZXF1ZXN0In0seyJYLUFtei1EYXRlIjoiMjAyMzA5MzBUMDk1NzUwWiJ9LHsia2V5Ijoidm9kX3VwbG9hZHMvdmQ4ODNiNTIwMDVmNzcxMWVlOWJlNi92Sm5NblVCeU5yMFFhRDVILm1wNCJ9XX0=",
    "X-Amz-Signature": "9b237a027c89488657311ff37af6259848dbc24547227646ae830c7361662109"


Signed Link expiration

The Signed Link expires after 6 hours from creation time, and you won't be able to upload to that link anymore.

Step 3: Upload a local video file to the Signed link location

Once you get the Signed link from Step 2, you can start uploading your file.

Sample request:

Replace the file= field with the local link to your file.

curl --location --request POST 'https://castr-us-east-1.s3.us-east-1.amazonaws.com/' \
--form 'key="vod_uploads/vd883b52005f7711ee9be6/vJnMnUByNr0QaD5H.mp4"' \
--form 'bucket="castr-us-east-1"' \
--form 'X-Amz-Algorithm="AWS4-HMAC-SHA256"' \
--form 'X-Amz-Credential="AKIAYxxxxxxxS56IGPM/20240226/us-east-1/s3/aws4_request"' \
--form 'X-Amz-Date="20240226T125307Z"' \
--form 'Policy="eyJleHBpcmF0xxxxxxxxxowN1oiLCJjb25kaXRpb25zIjpbeyJidWNrZXQiOiJjYXN0ci11cy1lYXN0LTEifSx7IlgtQW16LUFsZ29yaXRobSI6IkFXUzQtSE1BQy1TSEEyNTYifSx7IlgtQW16LUNyZWRlbnRpYWwiOiJBS0lBWUxVWkkzWVpGUzU2SUdQTS8yMDI0MDIyNi91cy1lYXN0LTEvczMvYXdzNF9yZXF1ZXN0In0seyJYLUFtei1EYXRlIjoiMjAyNDAyMjZUMTI1MzA3WiJ9LHsia2V5Ijoidm9kX3VwbG9hZHMvdmRmM2MxMDY3MGQ0YTUxMWVlYmVkYy9xUkExM0xiNFZrVEJDNTl4Lm1wNCJ9XX0="' \
--form 'X-Amz-Signature="5deedcdbe84dd16df8d4xxxxxxxxbb4dfcf6db8517c57c5ab"' \
--form 'file=@/Users/Castr/canada.mp4'

After uploading the video file successfully, the response will return a 200 success code. Then you can call to GET /videos/{id} to retrieve the video details with the {id} being the video identifier.

If you wish to know more about how Direct Link Upload works, please visit this article from AWS.



Castr only support MP4 files.


Files are kept 15 days after account is expired

When your subscription plan ends, Castr will continute to store your files for the next 15 days. After that, the files will be deleted permanently.