Managing media assets

Uploading a new asset

To create a place for your new asset you will need to send a POST /assets request to our API:

curl \
  -X POST \
  --header "Authorization: veed_test_oEnZhnd3vg0LEoTs6Z9Ij" \
  https://api.veed.io/api/assets
{
  "id": "28a510a8-6690-4cdc-b319-e0e02ebf1a2e",
  "type": "video",
  "url": "https://cdn.veed.io/380rreVE_9uhiksitOGIW.mp4"
}

You can then use the url returned (in the response) as the destination for uploading your asset:

curl \
  --upload-file video.mp4 \
  https://cdn.veed.io/380rreVE_9uhiksitOGIW.mp4

Using the asset

Now you have uploaded your video, audio or image, as an asset, you can use the API to make changes to it.

First, you need to construct a render object (you can read more about that here, under Constructing the render object)

When constructing the render object, you can now use the asset id as a source (instead of a public url). The elements being used must match that type of asset (in this case, video).

Let's take another look at the trimming a video example we did earlier, using the url:

{
  "elements": [
    {
      "type": "video",
      "params": {
        "source": {
          "url": "https://cdn.veed.io/380rreVE_9uhiksitOGIW.mp4" 
        },
        "trim": {
          "from": 2.0,
          "to": 5.0
        }
      }
    }
  ]
}

Now, we are going to use the asset id instead of the url . The request looks like this:

{
  "elements": [
    {
      "type": "video",
      "params": {
        "source": {
          "asset_id": "28a510a8-6690-4cdc-b319-e0e02ebf1a2e" 
        },
        "trim": {
          "from": 2.0,
          "to": 5.0
        }
      }
    }
  ]
}

Processing

Here are 2 operations you can perform on your video and audio assets - cleaning and transcribing. The first is used to clean the audio of background noise. The second is used to transcribe speech into text.


Cleaning

When creating an asset, you can pass in a clean: true field into the body of the request, and your file will be cleaned from all background noise, as soon as it's uploaded:

curl \
  --request POST \
  --header "Content-Type: application/json" \
  --data '{ "clean": true } ' \
  https://api.veed.io/api/assets

Transcribing

You can also pass in a transcribe: true field into the body of the request when creating an asset, and any speech that is detected will be transcribed into text, as soon as it's uploaded. The text will be stored in the transcription field of the asset object once finished:

curl \
  --request POST \
  --header "Content-Type: application/json" \
  --data '{ "transcribe": true } ' \
  https://api.veed.io/api/assets
{
  "id": "28a510a8-6690-4cdc-b319-e0e02ebf1a2e",
  "type": "video",
  "url": "https://cdn.veed.dev/380rreVE_9uhiksitOGIW.mp4",
  "trancription": [
    { "value": "Hey, how are you?", "from": "1.54", "to": "3.34" },
    { "value": "This is an example of transcription feature", "from": "3.73", "to": "5.26"},
  ]
}

Did this page help you?