VideoGenerator

VideoGenerator[model]
generates one second of video of a given model.
VideoGenerator[model,dur]
generates a video of duration dur.
Details and Options



- VideoGenerator can be used to generate video objects algorithmically. It is typically used for creating video of a time-varying plot, a rotating 3D object, etc.
- Possible settings for model include:
-
imagespec model to create images for the video track <"Image"imagespec,"Audio"audiospec > models to create images and audio samples for video and audio tracks - The imagespec can be any of the following:
-
image uses image in the first track {image1,image2,…} uses the sequence of imagei in the first track {{im11,im12,…},{im21,im22,…},…} uses the sequence of {imi1,imi2,…} in the track
imagefunc a function imagefunc of time that creates one or multiple images - If imagefunc returns a list of images, the image at position i is assumed to be the frame for the
video track.
- The audiospec can be any of the following:
-
audio uses audio in the first track {audio1,audio2,…} uses the sequence of audioi in the first track {{a11,a12,…},{a21,a22,…},…} uses the sequence of {ai1,ai2,…} in the track
audiofunc a function audiofunc of time that creates a list or matrix of audio samples - If audiofunc returns a matrix of audio values, the list at position i is assumed to be the data for the
audio track.
- The duration specification dur can be any of the following:
-
dur time given in seconds Quantity[dur,"Seconds"] time given in seconds or any compatible unit Quantity[n,"Frames"] time given as a number of frames - To generate frames in parallel, use Parallelize[VideoGenerator[…]]. »
- By default, VideoGenerator places the new video under the "Video" directory in $WolframDocumentsDirectory.
- The following options are supported:
-
AudioEncoding Automatic audio encoding to use BitRate Automatic approximate bit rate to use CompressionLevel Automatic compression level to use FrameRate 30 the frame rate to use GeneratedAssetFormat Automatic the file format of the result GeneratedAssetLocation $GeneratedAssetLocation the location of the result OverwriteTarget False whether to overwrite an existing file RasterSize Automatic the raster size used to rasterize expressions SampleRate Automatic the audio sample rate to use VideoEncoding Automatic video encoding to use VideoTransparency False whether the output video should have a transparency channel
Examples
open allclose allScope (8)
Video from Images (3)
Video from a Function (3)
Create a video from a rotating image:
Show a few frames of the generated video:
Use a function to generate frames:
The function takes the time as input and rasterizes it to an Image:
Use a function to generate two video tracks:
The function generates blurred frames in the first track with increasing radius:
The function generates quantized images with increasing colors in the second track:
Video with Audio (2)
Create a video with an audio track:
The image function takes the time as input and outputs an Image:
The audio function takes the time as input and uses it to control the frequency of a triangle wave:
Options (10)
AudioEncoding (1)
Use the AudioEncoding option to specify the audio encoding to be used:
CompressionLevel (1)
Use the CompressionLevel option to control the file size of the result:
GeneratedAssetLocation (2)
Assets are automatically generated in the "Video" folder within $WolframDocumentsDirectory:
Specify the location of the asset created by VideoGenerator:
Use a LocalObject as the asset for the resulting Video object:
OverwriteTarget (1)
By default, if a file already exists it is not overwritten:

Overwrite an existing file by specifying OverwriteTargetTrue:
RasterSize (1)
By default, if the video tracks specification produces a Graphics object, the result is rasterized:
Use the RasterSize option to control the rasterization:
If the video tracks specification produces an Image, specifying the RasterSize option will resize the result:
SampleRate (2)
By default, if the audio tracks specification is an Audio object, the sample rate will be preserved:
Use the SampleRate option to resample the audio input:
If the audio tracks specification is a function, the default sample is Hz:
Use the SampleRate option to control the sample rate of the result:
VideoEncoding (1)
Use the VideoEncoding option to specify the video encoding to be used:
Applications (6)
Create a video by adding a still image to an audio signal:
Generate a video of rotating 3D graphics:
Generate a video by moving the viewpoint around a 3D object:
Visualize the viewpoint trajectory:
Generate the Video:
Create a Video object displaying the evolution of a cellular automaton:
Create a Video object displaying a ball bouncing down steps.
First, solve the differential equation governing the motion of the ball:
Precompute a "staircase" background:
Display the evolution of the ball's position over the staircase:
Create a video showing the travel directions from Champaign to Chicago:
Properties & Relations (3)
Parallelize an expensive frame generation to speed up the computation:
Use Animate to create an animation in a notebook:
VideoGenerator can achieve the same results but without displaying any controls:
The result is also more easily shareable outside a notebook, since it creates a video file.
Separately generated video and audio objects can be combined using VideoCombine.
Generate a video with no audio:
Combine the two using VideoCombine:
Text
Wolfram Research (2020), VideoGenerator, Wolfram Language function, https://reference.wolfram.com/language/ref/VideoGenerator.html (updated 2022).
CMS
Wolfram Language. 2020. "VideoGenerator." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/VideoGenerator.html.
APA
Wolfram Language. (2020). VideoGenerator. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VideoGenerator.html