For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
StatusSupportDiscussionsLog inSign Up
Docs HomeAPI ReferenceVideo on DemandAI FeaturesLive StreamingVideo PlayerVideo DataCloud PlayoutRecipes
Docs HomeAPI ReferenceVideo on DemandAI FeaturesLive StreamingVideo PlayerVideo DataCloud PlayoutRecipes
  • Get started
    • Overview
    • Quickstart
  • Upload videos
    • Upload videos from device
    • Upload videos from a URL
    • Upload 4K videos
    • Speed up video processing
  • Playback and delivery
    • Play your videos
    • Embed a video in your app
    • Configure media quality levels
    • Enable MP4 Support for offline viewing
    • Create and manage playlists
  • Edit and transform videos
    • Add metadata to videos
    • Add a watermark to a video
    • Add an intro and outro to a video
    • Clip and trim videos
    • Merge and stitch videos
    • Remove unwanted video segments
  • Manage audio and subtitle tracks
    • Upload and play audio and subtitle tracks
    • Add subtitles to a video
    • Generate subtitles automatically
    • Add audio to a video
    • Replace a video's audio track
    • Normalize audio loudness
    • Overlay audio on a video timeline
  • Extract images from video
    • Create thumbnails from a video
    • Create GIFs from a video
    • Create timeline hovers from a video
  • Video security
    • Generate JWTs for secure media
    • Secure media access with JWTs
    • Restrict playback access
    • Set up DRM encryption
    • FairPlay DRM integration
  • VOD events
    • Media events
    • Transform media events
LogoLogo
StatusSupportDiscussionsLog inSign Up
On this page
  • Prerequisites
  • How clipping works
  • Create a clip using the API
  • Wait for the clip to become ready
  • Play the clip
  • Create a clip using the FastPix dashboard
  • Select your video
  • Define the clip segment
  • Choose the access policy
  • Create and verify the clip
  • Retrieve all clips for a source media
  • Frequently asked questions
  • What’s next?
Edit and transform videos

Clip and trim videos

Create video clips from existing media using start and end time parameters with the FastPix API.
Was this page helpful?
Previous

Merge and stitch videos

Learn to stitch multiple videos into one by merging base media with segments at defined timestamps or appending them at the end, and receive webhook updates for progress and completion.
Next
Built with

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).
  • 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 under Products > Media, or retrieve it programmatically from a previous API response.

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

  1. 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
1{
2 "inputs": [
3 {
4 "type": "video",
5 "url": "fp_mediaId://{Media_ID}",
6 "startTime": 0,
7 "endTime": 60
8 }
9 ],
10 "accessPolicy":"public"
11}

NOTE
In the request, replace {Media_ID} with your source mediaId.

ParameterTypeDescription
typestringSet to video.
urlstringSource reference in the form fp_mediaId://<source mediaId>.
startTimenumberClip start in seconds. Defaults to 0.
endTimenumberClip end in seconds. Defaults to the source duration.
accessPolicystringpublic 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
1{
2 "success": true,
3 "data": {
4 "id": "1cb4c22f-d9f6-4019-8905-30e6784ec87b",
5 "sourceMediaId": "5cfe8b2d-1c3a-4685-bd05-10fbc54c0015",
6 "trial": false,
7 "status": "Created",
8 "createdAt": "2025-12-22T09:06:14.849415Z",
9 "updatedAt": "2025-12-22T09:06:14.849435Z",
10 "playbackIds": [
11 {
12 "id": "652d5f58-5080-4459-b0bf-4250e9b71060",
13 "accessPolicy": "public",
14 "accessRestrictions": {
15 "domains": {
16 "defaultPolicy": "allow",
17 "allow": [],
18 "deny": []
19 },
20 "userAgents": {
21 "defaultPolicy": "allow",
22 "allow": [],
23 "deny": []
24 }
25 }
26 }
27 ],
28 "mediaQuality": "standard",
29 "title": "5cfe8b2d-1c3a-4685-bd05-10fbc54c0015",
30 "sourceAccess": false,
31 "maxResolution": "1080p",
32 "inputs": [
33 {
34 "type": "video",
35 "url": "fp_mediaId://5cfe8b2d-1c3a-4685-bd05-10fbc54c0015",
36 "startTime": 0,
37 "endTime": 60
38 }
39 ],
40 "optimizeAudio": false
41 }
42}

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 for instructions.

Alternatively, poll the Get media by ID 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.


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.
  2. Define the clip segment.
  3. Choose the access policy.
  4. Create and verify the clip.

Select your video

  1. Open the FastPix dashboard 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

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

Create and verify the clip

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

    Clip ready confirmation screen

  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


Retrieve all clips for a source media

Call the Get all clips of a media 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:

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

Response:

Response
1{
2 "success": true,
3 "data": [
4 {
5 "id": "80906e5f-2909-4191-bbbb-b7280413022d",
6 "duration": "00:00:05",
7 "status": "Ready",
8 "thumbnail": "https://images.fastpix.com/11d81d70-615c-4d5c-a93a-28c5de14d117/thumbnail.png",
9 "createdAt": "2025-10-29T09:58:21.828358Z",
10 "playbackIds": [
11 {
12 "id": "11d81d70-615c-4d5c-a93a-28c5de14d117",
13 "accessPolicy": "private"
14 }
15 ]
16 },
17 {
18 "id": "2aea2dea-f67d-4839-bd26-4337baa95141",
19 "duration": "00:00:05",
20 "status": "Ready",
21 "thumbnail": "https://images.fastpix.com/9417aa80-da6b-44bf-95ef-816bd7e494b4/thumbnail.png",
22 "createdAt": "2025-10-29T09:58:17.776712Z",
23 "playbackIds": [
24 {
25 "id": "9417aa80-da6b-44bf-95ef-816bd7e494b4",
26 "accessPolicy": "public"
27 }
28 ]
29 }
30 ],
31 "pagination": {
32 "totalRecords": 2,
33 "currentOffset": 1,
34 "offsetCount": 1
35 }
36}

Frequently asked questions

Are FastPix clips frame-accurate?

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.

What happens to a clip if I delete the source media?

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.

Can I create multiple clips from one source in a single request?

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.

Does clipping work on live-to-VOD recordings?

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
  • API Reference: Get all clips of a media
  • Create clip recipe
  • Secure playback with signed URLs