If you want to trim the beginning or end from a video, the API video trimming functionality is what you're looking for.

Let's say we want to trim the video below, keeping only the part where the bunny yawns. It starts around 2 seconds into the video, and lasts for around 3 seconds.

Sending the request

First of all, we need to tell the API which video to trim.

To provide a video you can either:

Provide a public url as a source containing the video file

Upload it as an asset to our servers and provide an asset_id as a source

For the purposes of this example, we will be using a dummy url as a source. Here it is, in the render payload:

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

By passing the from & to variables to the trim object, we define a time range (in seconds). This is the section of the video we want to keep (the part where the bunny yawns). It is also possible to pass a duration instead of to , with a value of 3 (seconds), which would yield the same result.

The resulting response will look like this:

  "id": "b477e483-592a-4bc6-a22b-563ef7f48e25",

Getting the render results

We recommend using a Webhook to process all your rendering events, but for this example we'll be polling the API. (A more detailed description of polling the API can be found here, under 'Sending the request').

curl \
  --header "Authorization: veed_test_oEnZhnd3vg0LEoTs6Z9Ij" \

Once the rendering is complete, you should get a RENDER/SUCCESS response:

    "type": "RENDER/SUCCESS",
    "payload": {
      "id": "b477e483-592a-4bc6-a22b-563ef7f48e25",
      "progress": 100,
      "url": "https://cdn.veed.dev/R1vqZ0KfPp5y2z7ddiTyt.mp4"

The response returns a url , from which you can download the resulting render and enjoy your new trimmed video!

And here's the result: