Skip to main content
Skip table of contents

How to Get Video, Clips and Images

In all examples below, ACCESS_TOKEN should be replaced with an actual access token for a selected channel (camera). For watching live or recorded video it is sufficient to have an access token with “watch” permission and you will need a “full” permission access token for image and clip extraction.

Live video

Get live video URLs:

CODE
curl -X GET "https://web.vxgdemo.vxgdemo.cloud-vms.com:443/api/v4/live/watch/" 
     -H "accept: application/json" 
     -H "Authorization: Acc ACCESS_TOKEN

Example of a response:

CODE
{
  "expire_hls": "2021-08-06T15:41:37.662355",
  "rtsp": "rtsp://54.172.31.247:554/live/u17m239530c239093_primary?ticket=media.eyJuIjogInUxN20yMzk1MzBjMjM5MDkzX3ByaW1hcnkifQ.1628261204.kW71CV7LPKxzWZCxUPczPDTAOK4",
  "hls": "https://d88wn9kkji59m.cloudfront.net:443/live/media-22/media.eyJuIjogInUxN20yMzk1MzBjMjM5MDkzX3ByaW1hcnkifQ.1628265397.RD39GS18IIRD7L8r2vqNwyPunVw/hls/u17m239530c239093_primary/index.m3u8?ticket=media.eyJuIjogInUxN20yMzk1MzBjMjM5MDkzX3ByaW1hcnkifQ.1628265397.RD39GS18IIRD7L8r2vqNwyPunVw",
  "expire": "2021-08-06T14:46:44.347031",
  "rtmp": "rtmp://54.172.31.247:1935/live/u17m239530c239093_primary?ticket=media.eyJuIjogInUxN20yMzk1MzBjMjM5MDkzX3ByaW1hcnkifQ.1628261204.kW71CV7LPKxzWZCxUPczPDTAOK4",
  "webrtc": {
    "ice_servers": [
      {
        "urls": [
          "stun:stun.l.google.com:19302"
        ]
      },
      {
        "username": "vxgturn",
        "credential": "vxgturn",
        "urls": [
          "turn:turn.vxg.io:3478?transport=udp"
        ]
      }
    ],
    "version": "2.0.2",
    "connection_url": "wss://webrtc-2.inst.auth2.cloud-svcp.com:443/239093/watch/08b6e083a9af4359f2f58feef045314629a2c4be/?ticket=media.eyJuIjogIjIzOTA5My93YXRjaC8wOGI2ZTA4M2E5YWY0MzU5ZjJmNThmZWVmMDQ1MzE0NjI5YTJjNGJlIn0.1628282504.eNXSKx8s6FLwoM9xrcGXLRQnbQc",
    "scripts": {
      "player": "https://web.vxgdemo.vxgdemo.cloud-vms.com:443/static/webrtc/CloudPlayer.webrtc2.js",
      "helpers": "https://web.vxgdemo.vxgdemo.cloud-vms.com:443/static/webrtc/CloudHelpers.js"
    }
  }
}

The response contains URLs and information for connecting to the live video using the following formats:

  • RTSP

  • RTMP

  • HLS

  • WebRTC

Recorded video

Get Recorded video URLs:

CODE
curl -X GET "https://web.vxgdemo.vxgdemo.cloud-vms.com:443/api/v4/records/?start=2021-08-06T10%3A45%3A00&end=2021-08-06T10%3A50%3A00" 
     -H "accept: application/json" 
     -H "Authorization: Acc ACCESS_TOKEN

Example of a response:

CODE
{
  "meta": {
    "expire": "2021-08-06T20:13:34.606064",
    "limit": 20,
    "next": null,
    "offset": 0,
    "previous": null,
    "total_count": 3
  },
  "objects": [
    {
      "end": "2021-08-06T10:45:19",
      "id": 2637475242,
      "size": 10324026,
      "start": "2021-08-06T10:44:22",
      "url": "https://skyvr-av-auth2-rel.s3.amazonaws.com/u17/m238299/c237863/20210806/104422.000000_profile-1-h264_d57.mp4?AWSAccessKeyId=ASIAWEOIJQJ5ZZKJDGET&Expires=1628280814&x-amz-security-token=IQoJb3JpZ2luX2VjEEcaCXVzLWVhc3QtMSJIMEYCIQCcnH7OqHNx5vo6rFjf2k0SF1kq21nmpmkx4ogFwV1LvwIhAI7bKCS1FARmdquqlckXF%2B%2FC1rL6zmwThRgKv9LlT83OKvoDCF8QABoMNDIxODYzNzE5NTQ3IgyzOf4dVS%2BZu9GOte0q1wORexA2crdwtd%2Fj10RpTlHnpsLJ9sm4%2B0bcvskjhRcMDeumVYN6VjvMdgFUxrKZ742S5L8GFbNp1I1IGT2ydYiByR5wcWfFCQl%2FQgayP8j3vNeK%2F6nHzqPuI8crAxQ3HOhTzpsAAHNZTm74VL3IVBRhWgzfTsaz5P3TwesJiiiUQH9TblU%2BjePGpJaC7qqdI%2BITndp0t%2Bohr5Wo3gR6k0fDkPUxulRSFXqGzdtSh5ZujRe5U6OavMCZDAumdT%2B58PIKa%2BPKqGcd8mMZywWQbrW%2FENJNP9UDgic3XS8v9CWB9BFw2Yq%2BEuuNcjVaRPS%2BLJIiSk95j%2BURaizwqIVGI8BSB6H8WHrVw0zRIGd7QWvyuDdFpSLER6h%2B6Ra2U4sibPjfIdyd2pfifaTu7j03aQo7yxmDkj3zI8gWA2LVHWSe08xIKnEZ9l8b3vUTnYyQoq25%2BWQtDcx81VMpB4r%2F35GJ5928yajBYNEZSiTjMIVd3U4QTEM4U8cA6WGzzwnH0Oam0%2BN1%2Bkn3uytnsTzvv9mb1SLtnWSmC8FW2anUcEU1%2BbbNEdj9TNnWG1KYHLmF1n6vUU2qmjGBi%2FuVdoK%2FLNhlb8y8kjJb0DgsziXA3LjIOqvmvs%2BM7XMw%2Boa1iAY6pAEGe%2BXUdeyVNeJK%2BcjmHljn1ugTdk0ji2CUeG%2BFE11cAjSU7u2F%2FFisWEJgHQ8qAsDq6JGIolISktVeGv83yKfDEnUKvSDysziVjZBgUnDF2ssYxtxq%2Furbkev6cD4xX8NHMmySUTlxUqkic%2FBumdXF0RvGxzdPuZ49WdYB5T7KA5w4L83iHhkT2Ey8wDuNyNhRBQiEKKpN1D7WMvz61ypCk4uVsg%3D%3D&Signature=Dq1d%2BYKuzhpQ558JoLplUjyWHRM%3D"
    },
    {
      "end": "2021-08-06T10:46:15",
      "id": 2637479315,
      "size": 10475722,
      "start": "2021-08-06T10:45:19",
      "url": "https://skyvr-av-auth2-rel.s3.amazonaws.com/u17/m238299/c237863/20210806/104519.000000_profile-1-h264_d56.mp4?AWSAccessKeyId=ASIAWEOIJQJ5ZZKJDGET&Expires=1628280814&x-amz-security-token=IQoJb3JpZ2luX2VjEEcaCXVzLWVhc3QtMSJIMEYCIQCcnH7OqHNx5vo6rFjf2k0SF1kq21nmpmkx4ogFwV1LvwIhAI7bKCS1FARmdquqlckXF%2B%2FC1rL6zmwThRgKv9LlT83OKvoDCF8QABoMNDIxODYzNzE5NTQ3IgyzOf4dVS%2BZu9GOte0q1wORexA2crdwtd%2Fj10RpTlHnpsLJ9sm4%2B0bcvskjhRcMDeumVYN6VjvMdgFUxrKZ742S5L8GFbNp1I1IGT2ydYiByR5wcWfFCQl%2FQgayP8j3vNeK%2F6nHzqPuI8crAxQ3HOhTzpsAAHNZTm74VL3IVBRhWgzfTsaz5P3TwesJiiiUQH9TblU%2BjePGpJaC7qqdI%2BITndp0t%2Bohr5Wo3gR6k0fDkPUxulRSFXqGzdtSh5ZujRe5U6OavMCZDAumdT%2B58PIKa%2BPKqGcd8mMZywWQbrW%2FENJNP9UDgic3XS8v9CWB9BFw2Yq%2BEuuNcjVaRPS%2BLJIiSk95j%2BURaizwqIVGI8BSB6H8WHrVw0zRIGd7QWvyuDdFpSLER6h%2B6Ra2U4sibPjfIdyd2pfifaTu7j03aQo7yxmDkj3zI8gWA2LVHWSe08xIKnEZ9l8b3vUTnYyQoq25%2BWQtDcx81VMpB4r%2F35GJ5928yajBYNEZSiTjMIVd3U4QTEM4U8cA6WGzzwnH0Oam0%2BN1%2Bkn3uytnsTzvv9mb1SLtnWSmC8FW2anUcEU1%2BbbNEdj9TNnWG1KYHLmF1n6vUU2qmjGBi%2FuVdoK%2FLNhlb8y8kjJb0DgsziXA3LjIOqvmvs%2BM7XMw%2Boa1iAY6pAEGe%2BXUdeyVNeJK%2BcjmHljn1ugTdk0ji2CUeG%2BFE11cAjSU7u2F%2FFisWEJgHQ8qAsDq6JGIolISktVeGv83yKfDEnUKvSDysziVjZBgUnDF2ssYxtxq%2Furbkev6cD4xX8NHMmySUTlxUqkic%2FBumdXF0RvGxzdPuZ49WdYB5T7KA5w4L83iHhkT2Ey8wDuNyNhRBQiEKKpN1D7WMvz61ypCk4uVsg%3D%3D&Signature=32Jhl9PqKUcUcCKqiAKJwFVgXak%3D"
    },
    {
      "end": "2021-08-06T10:47:11",
      "id": 2637483404,
      "size": 10479294,
      "start": "2021-08-06T10:46:15",
      "url": "https://skyvr-av-auth2-rel.s3.amazonaws.com/u17/m238299/c237863/20210806/104615.000000_profile-1-h264_d56.mp4?AWSAccessKeyId=ASIAWEOIJQJ5ZZKJDGET&Expires=1628280814&x-amz-security-token=IQoJb3JpZ2luX2VjEEcaCXVzLWVhc3QtMSJIMEYCIQCcnH7OqHNx5vo6rFjf2k0SF1kq21nmpmkx4ogFwV1LvwIhAI7bKCS1FARmdquqlckXF%2B%2FC1rL6zmwThRgKv9LlT83OKvoDCF8QABoMNDIxODYzNzE5NTQ3IgyzOf4dVS%2BZu9GOte0q1wORexA2crdwtd%2Fj10RpTlHnpsLJ9sm4%2B0bcvskjhRcMDeumVYN6VjvMdgFUxrKZ742S5L8GFbNp1I1IGT2ydYiByR5wcWfFCQl%2FQgayP8j3vNeK%2F6nHzqPuI8crAxQ3HOhTzpsAAHNZTm74VL3IVBRhWgzfTsaz5P3TwesJiiiUQH9TblU%2BjePGpJaC7qqdI%2BITndp0t%2Bohr5Wo3gR6k0fDkPUxulRSFXqGzdtSh5ZujRe5U6OavMCZDAumdT%2B58PIKa%2BPKqGcd8mMZywWQbrW%2FENJNP9UDgic3XS8v9CWB9BFw2Yq%2BEuuNcjVaRPS%2BLJIiSk95j%2BURaizwqIVGI8BSB6H8WHrVw0zRIGd7QWvyuDdFpSLER6h%2B6Ra2U4sibPjfIdyd2pfifaTu7j03aQo7yxmDkj3zI8gWA2LVHWSe08xIKnEZ9l8b3vUTnYyQoq25%2BWQtDcx81VMpB4r%2F35GJ5928yajBYNEZSiTjMIVd3U4QTEM4U8cA6WGzzwnH0Oam0%2BN1%2Bkn3uytnsTzvv9mb1SLtnWSmC8FW2anUcEU1%2BbbNEdj9TNnWG1KYHLmF1n6vUU2qmjGBi%2FuVdoK%2FLNhlb8y8kjJb0DgsziXA3LjIOqvmvs%2BM7XMw%2Boa1iAY6pAEGe%2BXUdeyVNeJK%2BcjmHljn1ugTdk0ji2CUeG%2BFE11cAjSU7u2F%2FFisWEJgHQ8qAsDq6JGIolISktVeGv83yKfDEnUKvSDysziVjZBgUnDF2ssYxtxq%2Furbkev6cD4xX8NHMmySUTlxUqkic%2FBumdXF0RvGxzdPuZ49WdYB5T7KA5w4L83iHhkT2Ey8wDuNyNhRBQiEKKpN1D7WMvz61ypCk4uVsg%3D%3D&Signature=z6e1YYYSdJHzQByUsj1FtTQW0uE%3D"
    }
  ]
}

The response contains links to recorded video chunks in standard MP4 format.

Images from recorded video

You can generate images from the recorded video for any duration and with a period that is bigger than a keyframe interval for a particular video stream. For example, you can generate images every 30 seconds for the last 12 hours. The result of this operation will be 60/30x60x12 = 1,440 JPEG images. The image resolution will be the same as the original video resolution.

  1. Start an image generation task and specify duration and interval.

CODE
curl -X POST "https://web.vxgdemo.vxgdemo.cloud-vms.com:443/api/v4/images/generation/tasks/" 
     -H "accept: application/json" 
     -H "Content-Type: application/json" 
     -H "Authorization: Acc ACCESS_TOKEN" 
     -d "{ 
            \"start\": \"2020-02-07T09:00:00\", 
            \"end\": \"2020-02-07T10:00:00\", 
            \"period\": 1.5
        }"

Here start and end are times in UTC format, period is an image generation period in seconds.

The response will contain a task id that can be used for checking the status. It can take time if you extract images for a long duration.

CODE
{
    "id": 6832,
}
  1. Check the task status.

CODE
curl -X GET "https://web.vxgdemo.vxgdemo.cloud-vms.com:443/api/v4/images/generation/tasks/6832/" 
     -H "accept: application/json" 
     -H "Authorization: Acc ACCESS_TOKEN"

Here 6832 is the task ID.

The response will contain the status.

CODE
{
    "status": "done",
}
  1. Retrieve the generated images.

CODE
curl -X GET "https://web.vxgdemo.vxgdemo.cloud-vms.com:443/api/v4/storage/images/?start=2020-02-07T09%3A00%3A00&end=2020-02-07T10%3A00%3A00" 
     -H "accept: application/json" 
     -H "Authorization: Acc ACCESS_TOKEN"

The response will have links to JPEG images.

CODE
{
  "objects": [
    {
      "height": 240,
      "id": 689124135,
      "origin": "recording_thumbnail",
      "size": 11959,
      "time": "2020-02-07T09:00:41",
      "url": "https://skyvr-av-auth2-rel.s3.amazonaws.com/u17/m214679/c214255/20200427/090041.000000_primary_d42.jpg?Signature=...",
      "width": 320
    },
    {
      "height": 240,
      "id": 689125536,
      "origin": "recording_thumbnail",
      "size": 11983,
      "time": "2020-02-07T09:01:23",
      "url": "https://skyvr-av-auth2-rel.s3.amazonaws.com/u17/m214679/c214255/20200427/090123.000000_primary_d42.jpg?Signature=...",
      "width": 320
    }
  ]

Images from live video

You can generate images from live video with a period that is bigger than a keyframe interval for a particular video stream. Once enabled the image generation will keep working until it is disabled.

  1. Enable or disable image generation for live video.

CODE
curl -X PUT "https://web.vxgdemo.vxgdemo.cloud-vms.com:443/api/v4/images/generation/live" 
     -H "accept: application/json" 
     -H "Content-Type: application/json" 
     -H "Authorization: Acc ACCESS_TOKEN" 
     -d "{ 
            \"image_generation_period\": 60
        }"

Here 60 is the image generation period in seconds. Set it to null to disable live image generation.

  1. Check if live image generation is enabled.

CODE
curl -X GET "https://web.vxgdemo.vxgdemo.cloud-vms.com:443/api/v4/images/generation/live" 
     -H "accept: application/json" 
     -H "Authorization: Acc ACCESS_TOKEN" 

The response will contain an image generation period or null if image generation is disabled.

CODE
{
    "image_generation_period": 60,
}
  1. Retrieve the generated images.

It is the same as in the previous section for images from recorded video.

Clips from recorded video

  1. Start a clip creation task:

CODE
curl -X POST "https://web.vxgdemo.vxgdemo.cloud-vms.com:443/api/v4/clips" 
     -H "accept: application/json" 
     -H "Content-Type: application/json" 
     -H "Authorization: Acc ACCESS_TOKEN" 
     -d "{ 
            \"start\": \"2020-02-07T09:00:00\", 
            \"end\": \"2020-02-07T09:15:00\", 
        }"

Here start and end are times in UTC format.

The response will contain a task id that can be used for checking the task status. It can take time if you create a long clip.

CODE
{
    "id": 142,
}
  1. Check the task status and retrieve the clip.

CODE
curl -X GET "https://web.vxgdemo.vxgdemo.cloud-vms.com:443/api/v4/clips/142" 
     -H "accept: application/json" 
     -H "Authorization: Acc ACCESS_TOKEN"

Here 142 is the task ID.

The response will contain the status.

CODE
{
    "status": "done",
}

If the status is done then a link to a clip and a clip's thumbnail will be in the same response.

CODE
{
    "url": "https://skyvr-av-auth2-rel.s3.amazonaws.com/u17/m212787/c212363/clips/2295627_d298.mp4?Signature=...",
    "thumb.url": "https://skyvr-av-auth2-rel.s3.amazonaws.com/u17/m212787/c212363/clips/2295627.jpg?Signature=..."
}


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.