class pixeltable.iterators.FrameIterator
Iterator over frames of a video. At most one offps, num_frames or keyframes_only 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.
Parameters:
-
fps(float | None): 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, or if greater than the native framerate of the video, then the framerate of the video will be used (all frames will be extracted). -
num_frames(int | None): Exact number of frames to extract. The frames will be spaced as evenly as possible. Ifnum_framesis greater than the number of frames in the video, all frames will be extracted. -
keyframes_only(bool, default:False): If True, only extract keyframes. -
all_frame_attrs(bool, default:False): If True, outputs apxt.Jsoncolumnframe_attrswith the followingpyav-provided attributes (for more information, seepyav’s documentation on VideoFrame and Frame):index(int)pts(int | None)dts(int | None)time(float | None)is_corrupt(bool)key_frame(bool)pict_type(int)interlaced_frame(bool)
frame_idx,pos_msec, andpos_frameas separate columns.