Cinelytics uses OpenCV to read video. The main function is `read_video`, where you can flexibly grab either all or different sequences of the frames of any given video.
Reading Video using OpenCV¶
Helper Functions¶
Helper function for read_video
Helper function for read_video
Helper function for read_video
Examples¶
vid = read_video('files/interstellar-waves-edit.mp4', target_frames=[0,1,2,3,4,5])
len(vid); vid[0].shape
resizer = partial(resize, keep_aspect_ratio=True, scale_factor=2)
vid = read_video('files/interstellar-waves-edit.mp4', target_frames=[0,1,2,3,4,5],
resize_func=resizer)
vid[0].shape
vid = read_video('files/interstellar-waves-edit.mp4', target_frames=np.arange(100))
vid2 = read_video('files/interstellar-waves-edit.mp4', start_idx=0, end_idx=100, frame_stride=1)
vid3 = read_video('files/interstellar-waves-edit.mp4', target_frames=(0, 100, 1))
vid4 = read_video('files/interstellar-waves-edit.mp4', end_idx=100)
len(vid)
len(vid) == len(vid2) == len(vid3) == len(vid4)
vid = read_video('files/interstellar-waves-edit.mp4', target_frames=5, apply=as_tensor)
vid.shape