import cv2
import numpy as np
cap = cv2.VideoCapture(0)
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter('output.avi', fourcc, 20.0, (640, 480))


def capture():
    global cap, out
    _, frame = cap.read()
    out.write(frame)


def destroy():
    global cap, out
    cap.release()
    out.release()
    cv2.destroyAllWindows()

982c375f6b9c74b1c4748c07f7da42434e6a726d
<mask token>


def capture():
    global cap, out
    _, frame = cap.read()
    out.write(frame)


<mask token>

<mask token>


def capture():
    global cap, out
    _, frame = cap.read()
    out.write(frame)


def destroy():
    global cap, out
    cap.release()
    out.release()
    cv2.destroyAllWindows()

<mask token>
cap = cv2.VideoCapture(0)
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter('output.avi', fourcc, 20.0, (640, 480))


def capture():
    global cap, out
    _, frame = cap.read()
    out.write(frame)


def destroy():
    global cap, out
    cap.release()
    out.release()
    cv2.destroyAllWindows()

import cv2
import numpy as np
cap = cv2.VideoCapture(0)
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter('output.avi', fourcc, 20.0, (640, 480))


def capture():
    global cap, out
    _, frame = cap.read()
    out.write(frame)


def destroy():
    global cap, out
    cap.release()
    out.release()
    cv2.destroyAllWindows()
