You can trim a video using using so
, eo
and du
options to specify start offset, end offset or duration.
You can also provide an arithmetic expressions like idu_div_2
, bdu_mul_0.2
, or bdu
as a value for these parameter. Doing so will first calculate the value of the expression and then apply transformations using that value. Learn more about arithmetic expressions here.
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, or an arithmetic expression like idu_div_2
. 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.
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.
Possible values - Specify the time in seconds as a positive number up to 2 decimal places, e.g., 20 or 10.55, or an arithmetic expression like idu_div_2
. 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.
Possible values - Specify the time in seconds as a positive number up to 2 decimal places, e.g., 20 or 10.55, or an arithmetic expression like idu_div_2
. It must be less than or equal to the duration of the input video.
This video is taken from Youtube.