mne_videobrowser.VideoFileHelsinkiVideoMEG#

class mne_videobrowser.VideoFileHelsinkiVideoMEG(fname: str, magic_str: str = 'HELSINKI_VIDEO_MEG_PROJECT_VIDEO_FILE')[source]#

Bases: VideoFile

Video file reader for video files in Helsinki VideoMEG project format.

Frame timestamps in milliseconds are stored in the timestamps_ms attribute, individual frames can be accessed using the get_frame_at method.

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

  • magic_str (str) – Magic string that should be at the beginning of video file.

Methods

close()

Close the video file.

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 duration of the video in seconds.

fname

Return the full path to the video file.

fps

Return the ESTIMATED 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]#

Close the video file.

get_frame_at(frame_idx: int) ndarray[tuple[Any, ...], dtype[uint8]] | None[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 ESTIMATED 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.

property duration: float#

Return the duration of the video in seconds.

This overrides the base class method to provide a more accurate duration that is based on the timestamps of the frames.

print_stats() None[source]#

Print statistics about the video file.