import argparse
from pathlib import Path

import cv2

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("video", type=Path, help="Video file")
    parser.add_argument("--interval", "-i", type=int, default=1, help="Frame intervals")
    args = parser.parse_args()

    cap = cv2.VideoCapture(args.video.as_posix())
    fps = cap.get(cv2.CAP_PROP_FPS)

    frames = []
    f = 0
    while f < cap.get(cv2.CAP_PROP_FRAME_COUNT):
        cap.set(cv2.CAP_PROP_POS_FRAMES, f)
        frames.append(cap.read())
        f += int(fps)

    print(len(frames))
