VideoMap

VideoMap[f,video]

applies f to partial video, audio and subtitle data corresponding to one frame of video, returning a new video.

VideoMap[f,video,n]

applies f to data corresponding to overlapping partitions of n video frames.

VideoMap[f,video,n,d]

applies f to partitions with offset d.

Details and Options

  • VideoMap operates on video, audio and subtitle partitions extracted from a Video object.
  • Using VideoMap[f,video,n], the partition slides by one image frame.
  • The function f can be any of the following:
  • fvimage function to apply to all video tracks
    <|"Image"fi,"Audio"fa|>functions to apply to video and audio tracks
  • Each of fi and fa can be one of the following:
  • Identitycopy the track over
    fan arbitrary function f
  • Each of fi and fa can take 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
  • In VideoMap[f,{video1,video2,},], data corresponding to each of the arguments are lists where each element i corresponds to the data extracted from videoi.
  • For multitrack video objects, data from the first video or audio track is fed to the function.
  • The result of fi can be a single Image object or a list of them, resulting in single or multiple video tracks. Similarly, fa can return a single Audio object or a list of Audio objects.
  • The time variables dur and offset can be given as a scalar in seconds, or a time or sample Quantity object.
  • The following options can be given:
  • AlignmentAutomaticalignment of the time stamps with partitions
    AudioEncodingAutomaticaudio encoding to use
    CompressionLevelAutomaticcompression level to use
    FrameRateAutomaticthe frame rate to use
    GeneratedAssetLocation$GeneratedAssetLocationthe location of the result
    OverwriteTargetFalsewhether to overwrite an existing file
    SubtitleEncodingAutomaticsubtitle encoding to use
    VideoEncodingAutomaticvideo encoding to use

Examples

open allclose all

Basic Examples  (2)

Process frames of a video:

Process video frames using time-varying arguments:

Scope  (7)

Function Specification  (5)

The function f receives an Association holding data for each partition:

Check the keys of the provided association:

Process individual video frames:

By default, only a video track is generated:

Specify functions to generate a video and an audio track:

Use the Identity function to copy over a track without processing:

Return a list of images from the function to generate multiple video tracks:

Generate multiple audio tracks:

Use Nothing to indicate that no data should be written for a particular evaluation. Drop frames with mean intensity smaller than a threshold:

Return an association from the function to explicitly specify to which track the data belongs:

Partition Specification  (2)

Specify a partition size corresponding to four frames:

Specify a partition size using a time Quantity:

By default, the offset of one frame is used:

Use an offset of four frames:

Specify an offset using a time Quantity:

Specify an offset proportional to the partition size by a Scaled amount:

Options  (2)

FrameRate  (2)

The FrameRate option specifies the frame rate of the resulting video:

By default, the frame rate of the original video is preserved:

When an offset is specified, the frame rate is adjusted proportionally in order to maintain a playback speed similar to the input. Sample every sixth frame:

Specify the frame rate to use:

The specified frame rate only affects the output video, and not the times sent in the association to the function:

Applications  (6)

Perform a time-varying image transformation:

Use audio data to process video frames:

Create a mosaic effect using a mosaic size increasing with time:

Add the audio spectrogram on the bottom of each frame:

Incorporate precomputed data in the generation of the new frames:

Use the external time series data to modify the video track:

Generate multiple tracks from the four corners of a video:

Properties & Relations  (1)

Properties of the output video are typically inferred from the output of the function:

Generate a video file with different properties than the input video:

Possible Issues  (2)

The image function should produce images with consistent dimensions:

The audio function should produce audio objects with consistent properties:

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

Text

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

BibTeX

@misc{reference.wolfram_2020_videomap, author="Wolfram Research", title="{VideoMap}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/VideoMap.html}", note=[Accessed: 21-April-2021 ]}

BibLaTeX

@online{reference.wolfram_2020_videomap, organization={Wolfram Research}, title={VideoMap}, year={2020}, url={https://reference.wolfram.com/language/ref/VideoMap.html}, note=[Accessed: 21-April-2021 ]}

CMS

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

APA

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