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:
  • imageuses image in the first track
    {image1,image2,}uses the sequence of imagei in the first track
    manipulatea Manipulate or an AnimatedImage animation
    imagefunca function imagefunc of time that creates one or multiple images
  • The audiospec can be any of the following:
  • audiouses audio in the first track
    {audio1,audio2,}uses the sequence of audioi in the first track
    audiofunca function audiofunc of time that creates a list or matrix of audio samples
  • The duration specification dur can be any of the following:
  • durtime 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 Automaticaudio encoding to use
    BitRateAutomaticapproximate bit rate to use
    CompressionLevel Automaticcompression level to use
    FrameRate 30the frame rate to use
    GeneratedAssetFormatAutomaticthe file format of the result
    GeneratedAssetLocation $GeneratedAssetLocationthe location of the result
    OverwriteTarget Falsewhether to overwrite an existing file
    RasterSize Automaticthe raster size used to rasterize expressions
    SampleRate Automaticthe audio sample rate to use
    VideoEncoding Automaticvideo encoding to use

Examples

open allclose all

Basic Examples  (2)

Generate a video of a varying plot:

Generate video from rotating 3D graphics:

Scope  (8)

Video from Images  (3)

Create a two-second-long video from a single image:

Specify the number of frames to generate:

Verify the number of frames in the result:

Create a video from a list of images:

Show time series of frame color values:

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:

FrameRate  (1)

The default frame rate is 30 frames per second:

Specify the frame rate to use:

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:

Extract the points forming the path:

Create the video:

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:

Generate an audio sample:

Combine the two using VideoCombine:

Possible Issues  (1)

Parallelize an expensive frame generation to speed up the computation:

Parallelization does not benefit functions that are already fast and multi-threaded:

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

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

BibTeX

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

BibLaTeX

@online{reference.wolfram_2024_videogenerator, organization={Wolfram Research}, title={VideoGenerator}, year={2021}, url={https://reference.wolfram.com/language/ref/VideoGenerator.html}, note=[Accessed: 21-December-2024 ]}