movis.ops.trim#
- movis.ops.trim(layer: BasicLayer, start_times: Sequence[float], end_times: Sequence[float]) _TrimLayer [source]#
Trim a layer with given time intervals and concatenate them.
- Args:
- layer:
Layer to trim.
- start_times:
Start times of the intervals.
- end_times:
End times of the intervals.
- size:
Size of the composition. If
None
, the size of the layer is estimated.
- Returns:
Composition with the layer trimmed and concatenated.
- Examples:
>>> import movis as mv >>> layer = mv.layer.Video("video.mp4") >>> composition = mv.trim(layer, [0.0, 2.0], [1.0, 3.0]) # select 0.0-1.0 and 2.0-3.0, and concatenate them >>> composition.duration 2.0