Movie module

This section describes the movie making classes.

class fractalshades.movie.Movie(size=(720, 480), fps=24)[source]
__init__(size=(720, 480), fps=24)[source]

A movie-making class. To implement an actual movie use add_sequence and then make the movie.

Parameters:
size: (int, int)

Movie screen size in pixels. Default to 720 x 480

fps: int

movie frame-count per second

Notes

The movie submodule relies on the following dependencies:
  • scipy

  • pyAV

They will not be installed automatically with pip and shall be installed by the user:

pip install scipy
pip install av
add_sequence(seq)[source]

Adds a sequence (or ‘Camera move’ describing several frames) to this movie

Parameters:
seq: `Sequence`

The sequence to be added

export_frame(out_file, index=None, time=None)[source]

Output a single frame to .png format (mainly for debuging purposes).

Parameters:
out_file: str

The path to output file will be out_file_%i%.png where i is the frame number

index: int

The saved frame index, if not provided then time shall be.

time: float

The time for the saved frame index.

make(out_file, pix_fmt='yuv420p', crf=22)[source]

Make a .mp4 movie - Uses Codec AVC standard (H.264)

Parameters:
out_file: str

The path to output file

pix_fmt: “yuv444p” | “yuv420p”

The pixel format’s name - default: “yuv420p”

crf: int, 0 - 51

The “Constant Rate Factor” - default: 22 (51 = lowest quality)

class fractalshades.movie.Camera_pan(db, x_evol, y_evol, dx_evol, plotting_modifier=None)[source]
__init__(db, x_evol, y_evol, dx_evol, plotting_modifier=None)[source]

A movie sequence described as a rectangular frame trajectory in a database.

Parameters:
db: `fractalshades.db.Db`

The underlying database. It can be either a *.postdb or a *.db format. Using *.db opens more possibilities but is also much more computer-intensive.

x: couple of 1d array-like - (x_t, x)

trajectory of x in db screen coordinates. (Time is the full movie time point, not relative to this sequence)

y: couple of 1d array-like - (y_t, y)

trajectory of y in db screen coordinates (Time is the full movie time point, not relative to this sequence)

dx: couple of 1d array-like - (dx_t, dx)

trajectory of dx in db screen coordinates (Time is the full movie time point, not relative to this sequence)

plotting_modifier: Optional, callable(plotter, time)

A callback which will modify the db plotter instance before each time step. To be used only for a “.db” database format

class fractalshades.movie.Camera_zoom(db, h_evol)[source]
__init__(db, h_evol)[source]

A movie zooming sequence described as a frame trajectory in an exponential mapping.

Parameters:
db: `fs.db.Exp_Db`

The underlying database. It shall be a *.postdb format, and will be unwraped at different depth to form the movie layers

h_evol: couple of 1d array-like - (h_t, h)

Trajectory of zoom logarithmic factor h The screen is scaled by np.exp(h)

class fractalshades.movie.Custom_sequence(tmin, tmax, plotter_from_time, scratch_name)[source]
__init__(tmin, tmax, plotter_from_time, scratch_name)[source]

A Sequence for which each frame is computed from scratch.

This offers maximal flexibility but shall be used only for very short sequences as processing time is very high.

Parameters:
tmin: float

The starting time for this sequence

tmax: float

The end time for this sequence

plotter_from_time: t -> (`fractalshades.Fractal_plotter`, layer)

Function which takes a time value and returns a plotter object and the layer to plot (by its name)

scratch_name: str

The (relative path) name for the temporary db files directory. Note that this folder shall be cleaned manually, should you modifify the parameters for this custom sequence.