@@ -20,10 +20,10 @@ update:
2020from maix import video, image, camera, app, time
2121
2222cam = camera.Camera(640 , 480 , image.Format.FMT_YVU420SP )
23- e = video.Encoder()
23+ e = video.Encoder(width = cam.width(), height = cam.height() )
2424f = open (' /root/output.h265' , ' wb' )
2525
26- record_ms = 2000
26+ record_ms = 5000
2727start_ms = time.ticks_ms()
2828while not app.need_exit():
2929 img = cam.read()
@@ -77,10 +77,10 @@ while not app.need_exit():
7777 - ` f = open(xxx) ` 打开并创建一个文件
7878 - ` f.write(frame.to_bytes(False)) ` 将编码结果` frame ` 转换为` bytes ` 类型,然后调用` f.write() ` 将数据写入文件中
7979
80- 5 . 定时2s退出
80+ 5 . 定时5s退出
8181
8282 ``` python
83- record_ms = 2000
83+ record_ms = 5000
8484 start_ms = time.ticks_ms()
8585 while not app.need_exit():
8686 if time.ticks_ms() - start_ms > record_ms:
@@ -99,12 +99,12 @@ while not app.need_exit():
9999from maix import video, time, image, camera, app
100100
101101cam = camera.Camera(640 , 480 , image.Format.FMT_YVU420SP )
102- e = video.Encoder(capture = True )
102+ e = video.Encoder(width = cam.width(), height = cam.height(), capture = True )
103103e.bind_camera(cam)
104104
105105f = open (' /root/output.h265' , ' wb' )
106106
107- record_ms = 2000
107+ record_ms = 5000
108108start_ms = time.ticks_ms()
109109while not app.need_exit():
110110 frame = e.encode()
0 commit comments