VideoTrim

VideoTrim[video,t]

returns the first t seconds of video.

VideoTrim[video,-t]

returns the last t seconds of video.

VideoTrim[video,{t1,t2}]

returns video starting at time t1 and ending at time t2 of video.

Details and Options

Examples

open allclose all

Basic Examples  (1)

Trim the first 10 seconds from a video:

Trim from second 10 to second 20 of the video:

Scope  (5)

Trim the first 10 seconds of a video:

Trim the last 10 seconds:

Trim from second 10 to second 20:

Trim using a valid time Quantity:

Trim a part of a remote video file:

Note that the trimmed video is stored as a local video object:

Options  (1)

AudioTracks  (1)

By default, all audio tracks are trimmed and are available in the trimmed video:

Trim without copying any audio tracks:

Applications  (3)

Extract an interesting portion of a video based on audio properties.

Import the audio track and use AudioLocalMeasurements to find the time when the audio has the greatest high-frequency content:

Extract the timestamp of the loudest partition:

Trim 3 seconds on either side of the interval:

Extract an interesting portion of a video based on image properties:

Define a function to detect whether an image has constant pixel values:

Use VideoTimeSeries to apply the function to each frame and plot the result:

Compute the intervals of constant and non-constant frames:

Find and trim the largest non-constant interval:

Use VideoTrim to partition a video file into smaller segments:

Partition the video into fixed-sized chunks of 20 seconds:

Compute and plot the mean intensity per frame for each video partition:

Perform an analysis of mean intensity value per frame on a specific segment:

Apply edge detection to video frames in a specific segment, generating a new video:

Properties & Relations  (2)

If the requested time is beyond the duration of the video, only the available data is returned:

Negative times are also clipped to 0:

Properties of the original video object are typically preserved when trimming:

Introduced in 2020
 (12.1)