mne_videobrowser.VideoFileCV2#

class mne_videobrowser.VideoFileCV2(fname: str)[source]#

Bases: VideoFile

Video file reader for video files supported by OpenCV.

Parameters:

fname (str) – Full path to the video file to be read.

Methods

close()

Release the video capture object.

get_frame_at(frame_idx)

Read a specific frame from the video file.

print_stats()

Print statistics about the video file.

Attributes

duration

Return the possibly estimated duration of the video in seconds.

fname

Return the full path to the video file.

fps

Return the frames per second of the video file.

frame_count

Return the number of frames in the video file.

frame_height

Return the height of the video frames in pixels.

frame_width

Return the width of the video frames in pixels.

close() None[source]#

Release the video capture object.

get_frame_at(frame_idx: int)[source]#

Read a specific frame from the video file.

Parameters:

frame_idx (int) – Index of the frame to read.

Returns:

The frame as a NumPy array of shape (height, width, 3) or None if the frame cannot be read. The color format is RGB and the frame is in row-major order.

Return type:

npt.NDArray[np.uint8] | None

property frame_count: int#

Return the number of frames in the video file.

property fps: float#

Return the frames per second of the video file.

property frame_width: int#

Return the width of the video frames in pixels.

property frame_height: int#

Return the height of the video frames in pixels.

property fname: str#

Return the full path to the video file.