class Video(sieve.File)

Overview

sieve.Video is a utility class that helps with dealing with video files. sieve.Video is backed by sieve.File, so it has the same network overhead benefits, with some added properties to help work with video.

Example

import sieve
import cv2 as cv

video = sieve.Video(url="example.com/video.mp4")
print(video.fps)          # 24
print(video.frame_count)  # 240
print(video.width)        # 1366
print(video.height)       # 768
print(video.channels)     # 3

cap = video.cap
_, frame = cap.read()
gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
cv.imshow('frame', gray)  # displays the first frame

Constructor Arguments

  • path (str): The local path of a video file to load
  • url (str): The external url of a video file to load

For examples, see sieve.File.

Properties

path

@property
path(self) -> str

The path to the image file.

cap

@property
cap(self) -> cv2.VideoCapture:

The cv2.VideoCapture object that can used to read the video.

fps

@property
fps(self) -> float:

The frame rate of the video.

frame_count

@property
frame_count(self) -> int:

The number of frames in the video.

width

@property
width(self) -> int:

The width of the video.

height

@property
height(self) -> int:

The height of the video.

channels

@property
channels(self) -> int:

The number of channels in the video.