Getting started

Integration & migration

Image & video API

DAM user guide

API overview

Account

Trim Videos

Learn how to trim videos using ImageKit.io.


You can trim a video using using so, eo and du options to specify start offset, end offset or duration.

Start offset - (so)

Specify start offset in seconds. The video before the start offset is removed from the output.

Usage - so-<value>

Possible values - Specify the time in seconds as a positive number up to 2 decimal places e.g. 20 or 10.55. It must be less than the duration of the input video.

Example - https://ik.imagekit.io/demo/img/60cd.mp4?tr=so-5. This will return a video starting from 5th second till the end. The preview below is showing as if video starts at 4th second but that is just one frame, as soon as the video starts playing, it will start from 5th second.

Starting 5th second

End offset - (eo)

Specify end offset in seconds. The video after the end offset is removed from the output.

Usage - eo-<value>

Example - https://ik.imagekit.io/demo/img/60cd.mp4?tr=eo-5. This will return a video starting from the beginning till 5th second.

Till 5 second

Possible values - Specify the time in seconds as a positive number up to 2 decimal places e.g. 20 or 10.55. It must be less than the duration of the input video.

Duration - (du)

Specify duration in seconds. It is often used with so to control the duration of the video to keep in output starting after so seconds.

Usage - du-<value>

Example - https://ik.imagekit.io/demo/img/60cd.mp4?tr=so-5,du-5. This will return a video starting from 5th second and will be 5 seconds long.

Starting 5th second and duration 5 seconds

Possible values - Specify the duration in seconds as a positive number up to 2 decimal places e.g. 20 or 10.55. It must be less than or equal to the duration of the input video.

This video is taken from Youtube.