vidsz

vidsz.interfaces package

Submodules

vidsz.interfaces.reader module

Defines interface for video reader

class vidsz.interfaces.reader.IReader

Bases: object

Video Reader Interface which will be implemented for every supported backend.

abstract property backend: str

Name of the Backend being used

Returns

current backend name

Return type

str

abstract property fps: float

FPS of Video

Returns

fps of video

Return type

float

abstract property frame_count: int

Total frames read

Returns

read frames’ count

Return type

int

abstract property height: int

Height of Video

Returns

height of video frame

Return type

int

abstract property info: dict

Video information

Returns

info of width, height, fps and backend.

Return type

dict

abstract is_open()bool

Checks if video is still open and last read frame was valid

Returns

True if video is open and last frame was not None, false otherwise.

Return type

bool

abstract property minutes: float

Total minutes read

Returns

read frames’ in minutes

Return type

float

abstract property name: str

Name of Video Source

Returns

name of video source

Return type

str

abstract read()Optional[numpy.ndarray]

Returns next frame from the video if available

Returns

next frame if available, None otherwise.

Return type

Union[np.ndarry, None]

abstract release()None

Release Resources

abstract property seconds: float

Total seconds read

Returns

read frames’ in seconds

Return type

float

abstract property width: int

Width of Video

Returns

width of video frame

Return type

int

vidsz.interfaces.writer module

Defines interface for video writer

class vidsz.interfaces.writer.IWriter

Bases: object

Video Writing Interface which will be implemented for every supported backend.

abstract property backend: str

Name of the Backend being used

Returns

current backend name

Return type

str

abstract property ext: str

Extension of Output Video

Returns

ext of video

Return type

str

abstract property fps: float

FPS of Output Video

Returns

fps of video

Return type

float

abstract property frame_count: int

Total frames written

Returns

written frames’ count

Return type

int

abstract property height: int

Height of Output Video

Returns

height of video frame

Return type

int

abstract property info: dict

Video information

Returns

info of width, height, fps, backend and ext

Return type

dict

abstract is_open()bool

Checks if writer is still open

Returns

True if writer is open, False otherwise

Return type

bool

abstract property minutes: float

Total minutes written

Returns

written frames’ in minutes

Return type

float

abstract property name: str

Name of Output Video

Returns

name of output video

Return type

str

abstract release()None

Release Resources

abstract property seconds: float

Total seconds written

Returns

written frames’ in seconds

Return type

float

abstract property width: int

Width of Output Video

Returns

width of video frame

Return type

int

abstract write(frame: numpy.ndarray)None

Write frame to output video

Parameters

frame (np.ndarray) – frame to write

abstract write_all(frames: Union[List[numpy.ndarray], vidsz.interfaces.reader.IReader])None

Write all frames to output video

Parameters

frames (Union[List[np.ndarray], IReader]) – Iterable object that contains frames.

Module contents

Interfaces contains various Reader, Writer abstract classes that will be implemented for every supported backend.