logo

用保存视频的例程,在sd卡里的视频怎么是0字节大小?

2019-04-23 11:54
6
uye4
67c92ca2-76c8-4a20-9151-8a0e3cad6313.png
2019-04-23 14:19
I
网红小智智 星瞳科技

要重启OpenMV才能看到。

I
网红小智智 星瞳科技

请提供全部的代码文本。

2019-04-23 16:55
6
uye4

@kidswong999 import sensor, image, time, mjpeg, pyb

RED_LED_PIN = 1

BLUE_LED_PIN = 3

sensor.reset() # Initialize the camera sensor.

sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE

sensor.set_framesize(sensor.QVGA) # or sensor.QQVGA (or others)

sensor.skip_frames(10) # Let new settings take affect.

clock = time.clock() # Tracks FPS.

pyb.LED(RED_LED_PIN).on()

sensor.skip_frames(30) # Give the user time to get ready.

pyb.LED(RED_LED_PIN).off()

pyb.LED(BLUE_LED_PIN).on()

m = mjpeg.Mjpeg("test1.mjpeg")

#mjpeg.Mjpeg(filename, width=Auto, height=Auto)创建一个mjpeg对象,

#filename为保存mjpeg动图的文件路径

print("You're on camera!")

for i in range(200):

clock.tick()

m.add_frame(sensor.snapshot())

#mjpeg.add_frame(image, quality=50)

#quality为视频压缩质量。

print(clock.fps())

m.close(clock.fps())

pyb.LED(BLUE_LED_PIN).off()

print("Done! Reset the camera to see the saved recording.")

测试的例程,重新上电还是一样0字节