movis.contrib.presentation.Slide#

class movis.contrib.presentation.Slide(start_times: Sequence[float], end_times: Sequence[float], slide_file: str | PathLike, slide_counter: Sequence[int] | None = None)[source]#

Slide layer for showing PDF slides.

Many presentation videos use slides to explain the contents. This layer directly show the slides in the specified PDF file for convenience.

Note

This layer requires pdf2image to be installed.

Args:
start_times:

The start times for displaying slides.

end_times:

The end times for displaying slides.

slide_file:

The path to the PDF file containing the slides.

slide_counter:

The slide number for each slide. If None, the slide number is automatically assigned.

Examples:
>>> from movis.contrib.commentary import Slide
>>> # Show 0 page from 0.0 to 5.0 seconds, and 1 page from 5.0 to 10.0 seconds.
>>> slide1 = Slide(start_times=[0.0, 5.0], end_times=[5.0, 10.0], slide_file="slides.pdf")
>>> # Show 0 page from 0.0 to 5.0 seconds, and 1 page from 5.0 to 15.0 seconds.
>>> slide2 = Slide([0., 5., 10.], [5., 10., 15.], "slides.pdf", slide_counter=[0, 1, 1])

Methods

get_key(time: float) int[source]#

Return the key for caching.

get_state(time: float) int#

Returns the index of the state at the given time, or -1 if no state exists.

Attributes

duration

Returns the duration of the timeline.