> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://fastpix.com/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://fastpix.com/docs/_mcp/server.

# Clip and trim videos

FastPix lets you extract clips from existing on-demand assets for content repurposing and social sharing, pull highlights, promotional snippets, or chaptered segments without re-uploading the source video.

Clips are useful for promotional snippets, social cut-downs, chaptered highlights, and ad-supported segment extraction from longer HLS assets.

This guide explains how to create shorter video clips from media that's already uploaded to FastPix. You can extract any segment from a video by specifying a start time and end time.

\


## Prerequisites

* A FastPix account with an active workspace ([Activate your account](/getting-started/activate-your-account)).
* Your **Access Token ID** and **Secret Key** from the FastPix Dashboard → API Settings. FastPix uses these for HTTP Basic authentication.
* A source `mediaId` in the same workspace. A `mediaId` is the unique identifier FastPix assigns to every on-demand asset when you upload or create it.
* A decision on `accessPolicy`. The `accessPolicy` field controls who can play the resulting clip: `public` means anyone with the `playbackId` can stream it, and `private` restricts playback to signed URLs.

\


## How clipping works

FastPix treats every clip as a new on-demand asset derived from a parent `mediaId`. When you create a clip, FastPix transcodes the requested segment, generates its own HLS renditions, and assigns a fresh `mediaId` and `playbackId`. The `playbackId` is a separate, access-controlled identifier used to build the stream URL `https://stream.fastpix.com/<playbackId>.m3u8`.

Both the source and the clip must live in the same workspace. FastPix cuts on the nearest keyframe (GOP boundary) to your requested `startTime` and `endTime`, so the resulting duration can differ from the exact values you send by a few hundred milliseconds depending on the source GOP size.

\


## Create a clip using the API

1. You need the media ID of the video you want to clip. You can find it in the [FastPix dashboard](https://dashboard.fastpix.com/) under **Products > Media**, or retrieve it programmatically from a previous API response.

A media ID looks like this: `5cfe8b2d-1c3a-4685-bd05-10fbc54c0015`

2. Send a `POST` to `https://api.fastpix.com/v1/on-demand`. In the `inputs` array, set `type` to `video` and `url` to `fp_mediaId://{Media_ID}`. Provide `startTime` and `endTime` in seconds. Omit them to clone the full source duration.

**Request body:**

**`Request`**

```json Request
{ 
  "inputs": [ 
    { 
      "type": "video", 
      "url": "fp_mediaId://{Media_ID}", 
      "startTime": 0, 
      "endTime": 60 
    } 
  ],
  "accessPolicy":"public"
} 
```

> **NOTE**\
> In the request, replace `{Media_ID}` with your source `mediaId`.

| Parameter      | Type   | Description                                                                    |
| -------------- | ------ | ------------------------------------------------------------------------------ |
| `type`         | string | Set to `video`.                                                                |
| `url`          | string | Source reference in the form `fp_mediaId://<source mediaId>`.                  |
| `startTime`    | number | Clip start in seconds. Defaults to `0`.                                        |
| `endTime`      | number | Clip end in seconds. Defaults to the source duration.                          |
| `accessPolicy` | string | `public` or `private`. Controls playback access on the resulting `playbackId`. |

**Response:**

FastPix returns the new `mediaId`, the `sourceMediaId` (your parent asset), and an array of `playbackIds` with their access configuration.

**`Response`**

```json Response
{
  "success": true,
  "data": {
    "id": "1cb4c22f-d9f6-4019-8905-30e6784ec87b",
    "sourceMediaId": "5cfe8b2d-1c3a-4685-bd05-10fbc54c0015",
    "trial": false,
    "status": "Created",
    "createdAt": "2025-12-22T09:06:14.849415Z",
    "updatedAt": "2025-12-22T09:06:14.849435Z",
    "playbackIds": [
      {
        "id": "652d5f58-5080-4459-b0bf-4250e9b71060",
        "accessPolicy": "public",
        "accessRestrictions": {
          "domains": {
            "defaultPolicy": "allow",
            "allow": [],
            "deny": []
          },
          "userAgents": {
            "defaultPolicy": "allow",
            "allow": [],
            "deny": []
          }
        }
      }
    ],
    "mediaQuality": "standard",
    "title": "5cfe8b2d-1c3a-4685-bd05-10fbc54c0015",
    "sourceAccess": false,
    "maxResolution": "1080p",
    "inputs": [
      {
        "type": "video",
        "url": "fp_mediaId://5cfe8b2d-1c3a-4685-bd05-10fbc54c0015",
        "startTime": 0,
        "endTime": 60
      }
    ],
    "optimizeAudio": false
  }
}
```

> **NOTE**\
> You can create an unlimited number of clips from a single source `mediaId`. Each clip is a new on-demand asset, so on-demand video pricing applies for encoding, storage, and delivery.

\


### Wait for the clip to become `ready`

Clip encoding happens asynchronously. The clip's `status` starts as `"Created"` and changes to `"Ready"` when it's available for playback.

The most reliable way to detect when a clip is ready is with webhooks. Listen for the `video.media ready` event on your webhook endpoint. See [Set up webhooks](/webhooks/set-up-webhooks) for instructions.

Alternatively, poll the [Get media by ID](/video-on-demand-api/manage-videos/get-media) endpoint and check the `status` field. Don't poll more than once per second.

\


### Play the clip

After the clip status is `"Ready"`, create a playback URL using the playback ID from the response:

```
https://stream.fastpix.com/{PLAYBACK_ID}.m3u8
```

You can use this URL with any HLS-compatible player, including the [FastPix player](/web-player/install-the-fastpix-web-player).

\


## Create a clip using the FastPix dashboard

If you prefer a visual interface, you can create clips directly from the FastPix dashboard without writing any code.

To create a clip from the dashboard, you need to:

1. [Select your video](#select-your-video).
2. [Define the clip segment](#define-the-clip-segment).
3. [Choose the access policy](#choose-the-access-policy).
4. [Create and verify the clip](#create-and-verify-the-clip).

\


### Select your video

1. Open the [FastPix dashboard](https://dashboard.fastpix.com/) and go to **Products > Media**.
2. In the media list, select the video you want to clip.

### Define the clip segment

1. On the **Manage media** page, click the **Create Clips** tab.
2. Enter the **Start time** and **End time** for your clip in seconds.
   * Use the **Preview Clip** button to watch the exact segment before creating it.
   * Drag the **red** (start) and **green** (end) timeline handles to fine-tune your selection.
   * Use the **Zoom In (+)** and **Zoom Out (–)** buttons to adjust the timeline view for more precision.

![Fields for selecting clip start and end times](https://static.fastpix.com/fp-new-ui-create-clip-tab.png)

### Choose the access policy

1. Choose your **access policy** from the dropdown next to **Create as Public Clip**:
   * **Public**: Anyone with the playback URL can stream the clip.
   * **Private**: Access is restricted according to your workspace access policy.

![Access setting selector with Public and Private options](https://static.fastpix.com/fp-new-ui-create-clip-set-access.png)

### Create and verify the clip

1. Click **Create Clip**. FastPix processes and encodes the segment.

   ![Clip ready confirmation screen](https://static.fastpix.com/fp-new-ui-create-clip-ready.png)

2. The clip appears in your **Media list** as a new entry. Select it to view its **Playback IDs** and confirm its access settings.

   ![Clipped video generated in media list](https://static.fastpix.com/fp-new-ui-create-clip-media-list.png)

\


## Retrieve all clips for a source media

Call the [Get all clips of a media](/video-on-demand-api/manage-videos/get-media-clips) endpoint with the source `mediaId` to list every clip derived from that parent. The response returns each clip's `id`, `duration`, `status`, `thumbnail`, and its `playbackIds` with `accessPolicy`.

Replace `{ACCESS_TOKEN_ID}` and `{SECRET_KEY}` with your actual values.

**Request:**

```bash
curl -X GET 'https://api.fastpix.com/v1/on-demand/{MEDIA_ID}/media-clips' \
  --user '{ACCESS_TOKEN_ID}:{SECRET_KEY}'
```

**Response:**

**`Response`**

```json Response
{
    "success": true,
    "data": [
        {
            "id": "80906e5f-2909-4191-bbbb-b7280413022d",
            "duration": "00:00:05",
            "status": "Ready",
            "thumbnail": "https://images.fastpix.com/11d81d70-615c-4d5c-a93a-28c5de14d117/thumbnail.png",
            "createdAt": "2025-10-29T09:58:21.828358Z",
            "playbackIds": [
                {
                    "id": "11d81d70-615c-4d5c-a93a-28c5de14d117",
                    "accessPolicy": "private"
                }
            ]
        },
        {
            "id": "2aea2dea-f67d-4839-bd26-4337baa95141",
            "duration": "00:00:05",
            "status": "Ready",
            "thumbnail": "https://images.fastpix.com/9417aa80-da6b-44bf-95ef-816bd7e494b4/thumbnail.png",
            "createdAt": "2025-10-29T09:58:17.776712Z",
            "playbackIds": [
                {
                    "id": "9417aa80-da6b-44bf-95ef-816bd7e494b4",
                    "accessPolicy": "public"
                }
            ]
        }
    ],
    "pagination": {
        "totalRecords": 2,
        "currentOffset": 1,
        "offsetCount": 1
    }
}
```

\


#### Frequently asked questions

FastPix cuts on the nearest keyframe (GOP boundary) to the `startTime` and `endTime` you provide. The final clip duration can differ from the exact requested values by a few hundred milliseconds depending on the source GOP size. For tighter cuts, re-encode the source with a shorter GOP before clipping.

Each clip is an independent on-demand asset with its own `mediaId`, `playbackId`, and stored renditions. Deleting the source `mediaId` does not delete existing clips, and deleting a clip does not affect the source.

No. One `POST` to the create media endpoint produces one clip. To create clips in bulk, issue one request per segment — typically in parallel from your application code. Each clip is billed as a separate on-demand asset.

Yes. Once a live stream has produced an on-demand recording with a `mediaId`, you can clip it the same way as any other source asset using `fp_mediaId://<mediaId>`.

\


## What's next?

* [API Reference: Create media](/video-on-demand-api/upload-and-import-videos/create-media)
* [API Reference: Get all clips of a media](/video-on-demand-api/manage-videos/get-media-clips)
* [Create clip recipe](/recipes/create-clip-from-existing-media)
* [Secure playback with signed URLs](/video-security/generate-jwts-for-secure-media)