VideoIntervals

VideoIntervals[video,crit]

returns time intervals of video for which the criterion crit is satisfied.

VideoIntervals[video,crit,n]

evaluates criterion crit on partitions of n video frames.

VideoIntervals[video,crit,n,d]

evaluates crit on partitions with offset d.

VideoIntervals[{video1,video2,},crit,]

applies crit to a list of inputs extracted from each videoi.

Details and Options

  • VideoIntervals can be used to detect time intervals of interest in a video, such as constant frame, silent audio intervals, intervals containing a specific object, etc.
  • A criterion crit of a single argument gets applied to image frames or a list of image frames.
  • A pure function crit can access video and audio data as well as time using the following arguments:
  • #Imagevideo frames as Image objects
    #Audioa chunk of the audio as an Audio object
    #Timetime from the beginning of the video
    #TimeIntervalbeginning and end time stamps for the current partition
    #FrameIndexindex of the current output frame
    #InputFrameIndexindex of the current input frame
  • In VideoIntervals[{video1,video2,},crit,], data provided to each of the arguments is a list where the i^(th) element corresponds to the data extracted from videoi.
  • By default, partitions are offset by one frame.
  • VideoIntervals supports video containers and codecs specified by $VideoDecoders.
  • The following options can be given:
  • AlignmentCenteralignment of the time stamps with partitions
    MaxItems Infinitymaximum number of intervals to return
  • By default, measurements are returned at the center of each partition. Using the Alignment option, measurements can be returned at the beginning (Left) or end (Right) of each partition.

Examples

open allclose all

Basic Examples  (2)

Find video intervals with constant frames:

Find video intervals with loud audio:

Scope  (5)

Specify the criterion as a pure function:

Specify the criterion as a normal function:

The input to the criterion function is an association with keys "Time", "TimeInterval", "Image", "FrameIndex", "InputFrameIndex" and "Audio" (if present):

Evaluate the criterion on a buffer of five frames:

If the partition size is not Automatic, the value for "Image" and will be a list of images:

The value for "Audio" is always a single Audio object of the appropriate duration:

Evaluate the criterion on non-overlapping partitions of five frames:

Specify partition size and offset using time quantities:

Options  (1)

MaxItems  (1)

By default, using MaxItems, the whole input is evaluated for possible intervals of interest:

Stop the computation once n complete intervals have been detected:

Applications  (2)

Find the intervals that contain the most motion in a video:

Extract the corresponding frames:

Find the intervals that contain constant frames:

Delete such intervals from the video:

Compare the duration of the original and resulting videos:

Wolfram Research (2020), VideoIntervals, Wolfram Language function, https://reference.wolfram.com/language/ref/VideoIntervals.html.

Text

Wolfram Research (2020), VideoIntervals, Wolfram Language function, https://reference.wolfram.com/language/ref/VideoIntervals.html.

CMS

Wolfram Language. 2020. "VideoIntervals." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/VideoIntervals.html.

APA

Wolfram Language. (2020). VideoIntervals. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VideoIntervals.html

BibTeX

@misc{reference.wolfram_2024_videointervals, author="Wolfram Research", title="{VideoIntervals}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/VideoIntervals.html}", note=[Accessed: 06-October-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_videointervals, organization={Wolfram Research}, title={VideoIntervals}, year={2020}, url={https://reference.wolfram.com/language/ref/VideoIntervals.html}, note=[Accessed: 06-October-2024 ]}