VideoMap
VideoMap[f,video]
applies f to partial video and audio 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.
VideoMap[f,{video1,video2,…},…]
applies f to a list of inputs extracted from each videoi.
Details and Options
- VideoMap operates on video and audio 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:
-
fv image 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:
-
Identity copy the track over f an arbitrary function f - Each of fi and fa can take the following arguments:
-
#Image video frames as Image objects #Audio a chunk of the audio as an Audio object #Time time from the beginning of the video #TimeInterval beginning and end time stamps for the current partition #FrameIndex index of the current output frame #InputFrameIndex index of the current input frame - In VideoMap[f,{video1,video2,…},…], data provided to each of the arguments is a list where the element corresponds to the data extracted from videoi.
- For multi-track 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 n and d can be given as a scalar in seconds, or a time or sample Quantity object.
- To process partitions in parallel, use Parallelize[VideoMap[…]].
- By default, VideoMap places the new video under the "Video" directory in $WolframDocumentsDirectory.
- VideoMap supports video containers and codecs specified by $VideoEncoders and $VideoDecoders.
- The following options can be given:
-
Alignment Automatic alignment of the time stamps with partitions AudioEncoding Automatic audio encoding to use CompressionLevel Automatic compression level to use FrameRate Automatic the frame rate to use GeneratedAssetFormat Automatic the format of the result GeneratedAssetLocation $GeneratedAssetLocation the location of the result OverwriteTarget False whether to overwrite an existing file SubtitleEncoding Automatic subtitle encoding to use VideoEncoding Automatic video encoding to use VideoTransparency False whether the output video should have a transparency channel
Examples
open allclose allBasic Examples (3)
Scope (8)
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:
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:
Properties & Relations (1)
Text
Wolfram Research (2020), VideoMap, Wolfram Language function, https://reference.wolfram.com/language/ref/VideoMap.html (updated 2022).
CMS
Wolfram Language. 2020. "VideoMap." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. 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