如何实现上电自动录制视频并保存
-
通电时开启自动录制
实现每五分钟保存视频到sd卡
-
import sensor import time import mjpeg import machine sensor.reset() # Reset and initialize the sensor. sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240) sensor.skip_frames(time=2000) # Wait for settings take effect. led = machine.LED("LED_RED") while True: led.on() m = mjpeg.Mjpeg("example.mjpeg") clock = time.clock() # Create a clock object to track the FPS. for i in range(5*60*30): clock.tick() m.add_frame(sensor.snapshot()) print(clock.fps()) m.close(clock.fps()) led.off() print("saved")