Store the extracted frame from video file in array

Below code me to extract individual frame from the video, I just wanted to make a new video file from frame 21 to 24. I wanted to save frames 21 to 24 in an array that I could later convert to a video file.

    while success:
        success, image =
        cv2.imwrite("frame%d.jpg"%count, image)

what do you want to do, exactly ? do you want to write a video file, stitch a panorama, or make an array of it ? those things are all unrelated to each other.

please try to be as concise as possible, and remove the “garbage words” from your question.

this is easy to find: