The SKIRT project
advanced radiative transfer for astrophysics
Public Member Functions | Private Attributes | List of all members
pts.visual.moviefile.MovieFile Class Reference

An instance of the MovieFile class allows creating a movie file from a sequence of still images. More...

Public Member Functions

def __init__ (self, outFilePath, shape=(800, 600), rate=24)
 The constructor launches ffmpeg to create a movie output file (replacing any existing file with the same name). More...
 
def addFrame (self, image)
 
def close (self)
 

Private Attributes

 _p
 
 _shape
 

Detailed Description

An instance of the MovieFile class allows creating a movie file from a sequence of still images.

Use the constructor to specify the filename and the frame size, then insert the frames one at a time with the addFrame() function, and finally flush all movie information to the file with the close() function. The resulting movie file uses MPEG-4 encoding and must have the .mp4 filename extension.

This class requires ffmpeg (https://ffmpeg.org) to be installed and in the PATH. The Anaconda Python distribution offers a package called "ffmpeg" that does just this. In other cases, the installation procedure might differ.

Constructor & Destructor Documentation

◆ __init__()

def pts.visual.moviefile.MovieFile.__init__ (   self,
  outFilePath,
  shape = (800,600),
  rate = 24 
)

The constructor launches ffmpeg to create a movie output file (replacing any existing file with the same name).

When the constructor finishes, ffmpeg is waiting for movie frames to be sent to it.

The constructor accepts the following arguments:

  • filepath: the absolute or relative path of the movie output file, which must end with the .mp4 extension.
  • shape: the number of movie frame pixels in the x and y directions; the default value is (800,600).
  • rate: the number of frames per second in the output movie; the default value is 24 fps.

The documentation for this class was generated from the following file: