@@ -0,0 +1,1188 @@
+#!/usr/bin/env python3%0A# encoding: utf-8%0A# pylint: disable=no-member%0A%0A%22%22%22Play a video with OpenCV.%22%22%22%0A%0Aimport cv2%0A%0Adef main():%0A    %22%22%22The main function of this module.%22%22%22%0A    cv2.namedWindow('video', cv2.WINDOW_AUTOSIZE)%0A%0A    cap = cv2.VideoCapture(0)%0A%0A    # Set the image resolution.%0A    # If the camera's resolution is less than 1920x1080,%0A    # it will use its maximum resolution. Need test.%0A    cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1920)%0A    cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 1080)%0A    cap.set(cv2.CAP_PROP_FPS, 60.0)%0A%0A    width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))%0A    height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))%0A    fps = cap.get(cv2.CAP_PROP_FPS)%0A%0A    output_file = 'output.mp4'%0A    fourcc = cv2.VideoWriter_fourcc(*'X264')%0A    wrt = cv2.VideoWriter(output_file, fourcc, fps, (width, height))%0A%0A    while cap.isOpened():%0A        ret, frame = cap.read()%0A        if not ret:  # done%0A            break%0A%0A        wrt.write(frame)%0A%0A        cv2.imshow('video', frame)%0A%0A        key = cv2.waitKey(30) & 0xFF%0A        if key == 27 or key == ord('q'):  # ESC, quit%0A            break%0A%0A    cap.release()%0A    wrt.release()%0A    cv2.destroyAllWindows()%0A%0Aif __name__ == '__main__':%0A    main()%0A

add record_camera.py