fps
or num_frames
may be specified. If fps
is specified, then frames will be extracted at the specified rate (frames per second). If num_frames
is specified, then the exact number of frames will be extracted. If neither is specified, then all frames will be extracted. The first frame of the video will always be extracted, and the remaining frames will be spaced as evenly as possible.
Args: fps: Number of frames to extract per second of video. This may be a fractional value, such as 0.5. If omitted or set to 0.0, then the native framerate of the video will be used (all frames will be extracted). If fps
is greater than the frame rate of the video, an error will be raised. num_frames: Exact number of frames to extract. The frames will be spaced as evenly as possible. If num_frames
is greater than the number of frames in the video, all frames will be extracted. all_frame_attrs: If True, outputs a pxt.Json
column frame_attrs
with the following pyav
-provided attributes (for more information, see pyav
’s documentation on VideoFrame and Frame):
index
(int
)pts
(Optional[int]
)dts
(Optional[int]
)time
(Optional[float]
)is_corrupt
(bool
)key_frame
(bool
)pict_type
(int
)interlaced_frame
(bool
)
frame_idx
, pos_msec
, and pos_frame
as separate columns.
View source on GitHub
Methods
close()
Close the iterator and release all resources
Signature:
create()
Signature:
input_schema()
Provide the Pixeltable types of the init() parameters
The keys need to match the names of the init() parameters. This is equivalent to the parameters_types parameter of the @function decorator.
Signature:
output_schema()
Specify the dictionary returned by next() and a list of unstored column names
Signature:
- tuple[dict[str, pixeltable.type_system.ColumnType], list[str]]: a dictionary which is turned into a list of columns in the output table a list of unstored column names