video699.video.file

This module implements reading a video from a video file.

Module Contents

class video699.video.file.VideoFileFrame(video, number, duration, image)

Bases: video699.interface.FrameABC

A frame of a video read from a video file.

Parameters:
  • video (VideoABC) – The video containing the frame.
  • number (int) – The frame number, i.e. the position of the frame in the video. Frame indexing is one-based, i.e. the first frame has number 1.
  • duration (timedelta) – The elapsed time since the beginning of the video.
  • image (array_like) – The image data of the frame as an OpenCV CV_8UC3 RGBA matrix, where the alpha channel (A) is currently unused and all pixels are fully opaque, i.e. they have the maximum alpha of 255.
video

VideoABC – The video containing the frame.

number

int – The frame number, i.e. the position of the frame in the video. Frame indexing is one-based, i.e. the first frame has number 1.

image

array_like – The image data of the frame as an OpenCV CV_8UC3 RGBA matrix, where the alpha channel (A) is currently unused and all pixels are fully opaque, i.e. they have the maximum alpha of 255.

width

int – The width of the image data.

height

int – The height of the image data.

duration

timedelta – The elapsed time since the beginning of the video.

datetime

aware datetime – The date, and time at which the frame was captured.

video
number
image
duration
class video699.video.file.VideoFile(pathname, datetime, verbose=False)

Bases: video699.interface.VideoABC, collections.abc.Iterator

A video read from a video file.

Notes

It is not possible to repeatedly iterate over all video frames. A video file is opened as soon as the class is instantiated, and released only after the finalization of the object or after the last frame has been read.

Parameters:
  • pathname (str) – The pathname of a video file.
  • datetime (aware datetime) – The date, and time at which the video was captured.
  • verbose (bool, optional) – Whether a progress bar will be shown during the reading of the video. False if unspecified.
fps

int – The framerate of the video in frames per second.

width

int – The width of the video.

height

int – The height of the video.

datetime

aware datetime – The date, and time at which the video was captured.

uri

string – An IRI, as defined in RFC3987, that uniquely indentifies the video over the entire lifetime of a program.

Raises:OSError – If the video file cannot be opened by OpenCV.
fps
width
height
datetime
uri
__iter__(self)
_read_video(self, pathname, verbose)
__next__(self)
__del__(self)