Trim Video

Trim the start and end of a video to create a shortened clip

Max file size: 250MB
Max length: 2 minutes
0 sec 120 sec

Your video will display here

Hold tight, rendering may take a minute...

About the trim video demo

Trim a video by cutting off the start, end or both. This demo application shows you a how you can upload or fetch a video from a URL, set a start and end time and render a new trimmed video clip. A simple form allows you to see the total clip length and select the in and out points.

The original video file and time settings are posted to a backend script that creates a JSON payload with the edit parameters. The JSON is posted to the Shotstack video editing API and after a few seconds the video is rendered to the new length and the URL is sent back to be displayed on the web page.

This is a simple example of what can be done with the API. You might adapt this functionality as part of a simple workflow to trim an hour long stream in to shorter segments for social media, or it might be a component of a broader online video editing application.

This demo is available as an open source project built using basic HTML, Bootstrap and a simple jQuery script. The backend uses Node.js and Express and can be one-click installed as a Serverless application.

Get started with Shotstack's video editing API in two steps:

  1. Sign up for free to get your API key.
  2. Send an API request to create your video:
    curl --request POST 'https://api.shotstack.io/v1/render' \
    --header 'x-api-key: YOUR_API_KEY' \
    --data-raw '{
    "timeline": {
    "tracks": [
    {
    "clips": [
    {
    "asset": {
    "type": "video",
    "src": "https://shotstack-assets.s3.amazonaws.com/footage/beach-overhead.mp4"
    },
    "start": 0,
    "length": "auto"
    }
    ]
    }
    ]
    },
    "output": {
    "format": "mp4",
    "size": {
    "width": 1280,
    "height": 720
    }
    }
    }'