VideoGenerator
VideoGenerator[imagespec]
generates a video with frames generated from imagespec.
VideoGenerator[<"Image"imagespec,"Audio"audiospec >]
returns a video with audio data generated from audioexpr.
VideoGenerator[…,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.
- 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 manipulate a Manipulate or an AnimatedImage animation imagefunc a function imagefunc of time that creates one or multiple images - 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 audiofunc a function audiofunc of time that creates a list or matrix of audio samples - 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[…]]. »
- 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
Examples
open allclose allScope (8)
Video from Images (3)
Video from a Function (3)
Create a video from a rotating image:
Use a function that 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:
Use functions to generate both the video and audio tracks:
The image function takes the time as input and rasterizes it to 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:
Compare file sizes and the last frame quality for different compression levels:
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 2021).
CMS
Wolfram Language. 2020. "VideoGenerator." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. 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