Instant live clipping

Learn how to generate instant video highlights from live streams by defining start and end times for real-time clipping.

What is live clipping?

Live clipping is the process of capturing and creating short video clips from a live stream as it happens. This feature lets broadcasters instantly extract key moments, turning them into highlights, social media content, or on-demand clips. It eliminates the need to wait for the live stream to finish, making it perfect for sharing engaging moments in real time.


NOTE

When you create a live clip using the stream URL, the clip is automatically converted into an on-demand media file. This means that your extracted clip remains accessible even after the live stream ends, making it available for further viewing or sharing.

You can also specify the access policy for the on-demand media that is generated by providing a query parameter (clipAccess). If no custom policy is set, the access policy for the generated clip will default to the livestream’s access policy.

If you prefer hands-on instructions, the Instant Live Clipping recipe walks you through the entire process.


Set up a live stream

To start creating live clips, first set up a livestream on FastPix by creating a live stream using the dashboard or using the Create new live stream API. After the livestream is active, you can generate the Stream URL using the provided playback ID. This URL can be used in any HLS-compatible player and serves as the basis for generating live clips.

Your stream URL would look like this:

https://stream.fastpix.io/{PLAYBACK_ID}.m3u8

Generate clips from live stream

Creating a live clip involves defining the clip's duration by appending query parameters to the Stream URL. FastPix simplifies this process by using start and end times in seconds.


NOTE

When you generate a live clip using the Stream URL, the clip is automatically converted into an on-demand media file. This ensures that the clip remains accessible even after the live stream ends.


Use the Stream URL with query parameters

You can generate a live clip by adding start and end parameters to your Stream URL. These parameters define the beginning and end of your clip.


Example:

https://stream.fastpix.io/{PLAYBACK_ID}.m3u8?start=10&end=70

This URL extracts a 60-second clip starting from the 10-second mark to the 70-second mark.


NOTE

The maximum duration for a clip is 20 minutes. If the start and end parameters exceed this limit, the clip will be automatically trimmed to 20 minutes.


Access policy for clips

You can also control the access policy of the generated on-demand media by specifying a clipAccess query parameter.

NOTE

Using the clipAccess parameter separately will result in another on-demand clip. It's better to combine start, end, clipAccess parameters all at once depending on your requirement.


https://stream.fastpix.io/{PLAYBACK_ID}.m3u8?start=10&end=70&clipAccess=private

  • If clipAccess=private, the generated clip will be restricted to authorized users. To control who can access private clips, use secure playback with JWTs. See Secure playback with JWTs for details.

  • If clipAccess=public, the generated clip will be accessible to anyone with the link.

  • If no clipAccess parameter is provided, the access policy of the generated clip will default to the access policy of the livestream.

Retrieve clip and playback

If you want to later retrieve the generated clip (stored as on-demand media) - use the get all clips from live stream API by passing the streamId of the actual live stream. The response will give you a list of all clipped media IDs along with other details related to the clipped media.

To initialize playback of the media, take the underlying playbackId from the specific clipped media and insert it in the stream URL below.

https://stream.fastpix.io/{PLAYBACK_ID}.m3u8

You can use this URL (with .m3u8 extension) in other video players as per your use case.


Otherwise, to directly stream your clipped media on a browser, you can also use the playback stream URL which is sharable. Simply preview your video by putting the playbackId on the stream URL.

 https://play.fastpix.io/?playbackId={PLAYBACK_ID}

Guidelines for start and end times

To ensure your live clips are generated correctly, follow these guidelines:

  • Use positive values only: Both start and end times must be positive integers, representing seconds in the livestream. Negative values are not allowed and will result in an error.

  • Start time must be earlier than end time: The start time must always precede the end time. Providing an end time that is less than the start time is invalid and will prevent the clip from being generated.

  • Valid time range: Ensure the start and end times fall within the duration of the live stream. For example, if the live stream has only reached 20 seconds, specifying end=30s will result in an error.