New Oct 24, 2024

Instant clipping just got clippier: Now for any VOD asset

Company/Startup Blogs All from Mux Blog - Video technology and more View Instant clipping just got clippier: Now for any VOD asset on mux.com

No need to bury the lede: Instant clipping has received a tremendous upgrade — it's now available for all on-demand video assets.

Previously, we enabled this feature for our live streams and VOD assets that originated from live streams where you can use an absolute timestamp to create clips. This was done using epoch timestamps as values for the program_start_time and program_end_time query parameters to generate clips based on the “Program Date Time” (aka “PDT”) values that get stamped into the content as live streams as it is being received by Mux either through RTMP or SRT ingest:

# Format
https://stream.mux.com/${PLAYBACK_ID}.m3u8?program_start_time=${EPOCH_TIME}&program_end_time=${EPOCH_TIME}

Example

https://stream.mux.com/sp9WNcgcktsmlvFLKgNm3jjSGRD00RPlq.m3u8?program_start_time=1707740400&program_end_time=1707740460

But what about assets that weren’t generated from live streams? With this update, instant clips can be created from any asset, at no extra cost, regardless of origin and clips can be created using relative time.

At Mux, we have two flavors of clipping: Instant clipping, and frame-accurate clipping. With frame-accurate clipping, you use an API to create a new asset with MP4 and master access support. This is great because distinct assets can be created from one video. But it also incurs a cost for encoding and storage because it's creating brand new assets. Instant clipping is a wonderful alternative when you don't need frame accuracy. It quickly spins up clips without creating a new asset and eliminates additional encoding and storage costs.

Let’s see how to take advantage of this feature.

Instant clipping in action

Using playback modifiers, you can provide some new parameters to create instant clips based on relative time.

asset_start_time

This parameter accepts relative time and can be set on a Playback URL, and sets the start time of the content within the asset, for example:

# Format
https://stream.mux.com/${PLAYBACK_ID}.m3u8?asset_start_time=${RELATIVE_TIME}

Example

https://stream.mux.com/sp9WNcgcktsmlvFLKgNm3jjSGRD00RPlq.m3u8?asset_start_time=10

asset_end_time

This parameter accepts relative time and can be set on a Playback URL, and sets the end time of the content within the asset, for example:

# Format
https://stream.mux.com/${PLAYBACK_ID}.m3u8?asset_end_time=${RELATIVE_TIME}

Example

https://stream.mux.com/sp9WNcgcktsmlvFLKgNm3jjSGRD00RPlq.m3u8?asset_end_time=20

Combining parameters

You can also use both of these parameters to create an instant clip of a specific portion of your asset, for example:

# Format
https://stream.mux.com/${PLAYBACK_ID}.m3u8?asset_start_time=${RELATIVE_TIME}&asset_end_time=${RELATIVE_TIME}

Example

https://stream.mux.com/sp9WNcgcktsmlvFLKgNm3jjSGRD00RPlq.m3u8?asset_start_time=10&asset_end_time=20

Using Mux Player?

We got it covered. You’ll need to provide the asset_start_time and asset_end_time parameters as extra source parameters for the asset as well as set the parameters for the storyboard source.

Consider the following for the web version of our Mux Player:

<script src="https://cdn.jsdelivr.net/npm/@mux/mux-player"></script>
<mux-player
stream-type="on-demand"
playback-id="sp9WNcgcktsmlvFLKgNm3jjSGRD00RPlq"
metadata-video-title="Test VOD"
extra-source-params="asset_start_time=10&asset_end_time=20"
storyboard-src="https://image.mux.com/sp9WNcgcktsmlvFLKgNm3jjSGRD00RPlq/storyboard.vtt?format=webp&asset_start_time=10&asset_end_time=20"
></mux-player>

A little bit about security

Instant clipping works great out of the box and can be easily modified by anyone to adjust the clips. But what if you wanted to restrict the ability to change these parameters? Well, we have an answer for that!

Using our Signed Playback URLs, you can generate a JWT that restricts the asset_start_time and asset_end_time from being changed.

But, what about images?

Images already support relative time through the time parameter which is the same as how these new parameters work (yay for consistency!). Storyboard generation has been updated to support these parameters as a way to generate storyboard tiles for frames between the asset_start_time and asset_end_time values.

#Format
https://image.mux.com/${PLAYBACK_ID}/storyboard.png?asset_start_time=${RELATIVE_TIME}&asset_end_time=${RELATIVE_TIME}

Example

https://image.mux.com/sp9WNcgcktsmlvFLKgNm3jjSGRD00RPlq/storyboard.png?asset_start_time=10&asset_end_time=20

Tell us what you think

We absolutely love receiving feedback on our products and features. Let us know what the new clipping functionality enables for you by sending us a message!

Scroll to top