'''
example name：Record video
version：v1.0
date：2020.3
Author：01Studio
Description: Use the camera module to Record video!
Forum: forum.01studio.org
'''

#import related modules
from picamera import PiCamera
from time import sleep

#creat camera object
camera = PiCamera()

#active cmaera
camera.start_preview()

sleep(3) #Wait for the camera to stabilize


#Recording video, 10 seconds
camera.start_recording('/home/pi/Desktop/video.h264')
sleep(10)
camera.stop_recording()

#Close the camera
camera.stop_preview()
