arcjetCV.utils.video module
- class arcjetCV.utils.video.Video(path)[source]
Bases:
objectConvenience wrapper for opencv video capture.
This class provides a simple interface for working with video files using OpenCV. It encapsulates functionality for reading frames from a video file, setting the current frame, and writing processed frames to a new video file.
- Attributes:
fpath (str): Path to the video file. name (str): Name of the video file. folder (str): Directory containing the video file. ext (str): Extension of the video file. cap: OpenCV VideoCapture object for reading video frames. nframes (int): Total number of frames in the video. fps (float): Frames per second of the video. shape (tuple): Shape of the video frames (height, width, channels). last_frame: Last frame read from the video. writer: OpenCV VideoWriter object for writing processed frames. _lock: Threading lock for thread-safe access to the video capture object.
Example:
`python video = Video('input_video.mp4') print(video) frame = video.get_frame(0) `
- class arcjetCV.utils.video.VideoMeta(video, path)[source]
Bases:
dictSubclass of dictionary designed to save/load video metadata in JSON format.
This class extends the dictionary class to provide functionality for saving and loading video metadata in JSON format. It also includes methods for resetting frame crop parameters and setting frame crop parameters.
- Attributes:
folder (str): Directory containing the video metadata file. name (str): Name of the video metadata file. ext (str): Extension of the video metadata file. path (str): Path to the video metadata file.
Example:
`python video = Video('input_video.mp4') # load video video_meta = VideoMeta(video, 'metadata.json') # create/load metadata obj video_meta.write() # write metadata to file `