例程讲解06-Video-Recording->imageio_write写入二进制视频
import sensor
import image
import time
import machine
record_time = 10000
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time=2000)
clock = time.clock()
led = machine.LED("LED_RED")
stream = image.ImageIO("/stream.bin", "w")
led.on()
start = time.ticks_ms()
while time.ticks_diff(time.ticks_ms(), start) < record_time:
clock.tick()
img = sensor.snapshot()
stream.write(img)
print(clock.fps())
stream.close()
led.off()
raise (Exception("Please reset the camera to see the new file."))