import sensor, image, time, mjpeg, pyb
from pyb import RTC
RED_LED_PIN = 1
BLUE_LED_PIN = 3
Time = [2023, 6, 4, 7, 0, 1, 0, 0]
Act_Time = [4, 7 , 0 , 0]
Set_Time = [0, 15, 0, 0]
Days = 2
X = 30
Fps = 44
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.set_windowing((240, 240))
sensor.skip_frames(time = 2000)
clock = time.clock()
rtc = RTC()
rtc.datetime(Time)
m = [0]
for B in range(X * Days):
m.append(mjpeg.Mjpeg(str(B + 1) + ".mjpeg"))
for Day_count in range(Days):
pyb.LED(RED_LED_PIN).on()
sensor.skip_frames(time = 2000)
print("You're on camera!")
while((rtc.datetime()[2] * 86400 + rtc.datetime()[4] * 3600 + rtc.datetime()[5] * 60 + rtc.datetime()[6]) < ((Act_Time[0] + Day_count) * 86400 + Act_Time[1] * 3600 + Act_Time[2] * 60 + Act_Time[3])):
print("**********Wait**********" + '\n')
print(str(rtc.datetime()[4]) + 'h', str(rtc.datetime()[5]) + 'm', str(rtc.datetime()[6]) + 's')
print("wait" + '\n')
pyb.LED(RED_LED_PIN).off()
pyb.LED(BLUE_LED_PIN).on()
for A in range(X):
for i in range(Fps * ((Set_Time[0] * 86400 + Set_Time[1] * 3600 + Set_Time[2] * 60 + Set_Time[3]) / X)):
print("**********ACT**********" + '\n')
print(str(rtc.datetime()[4]) + 'h', str(rtc.datetime()[5]) + 'm', str(rtc.datetime()[6]) + 's')
clock.tick()
m[A + 1 + X * Day_count].add_frame(sensor.snapshot())
print(str(clock.fps()) + 'fps' +'\n', "Num = " + str(i))
print(A + 1 + X * Day_count, '\n' )
m[A + 1 + X * Day_count].close(clock.fps())
pyb.LED(BLUE_LED_PIN).off()
print("Done! Reset the camera to see the saved recording.", '\n')
K
kesd
@kesd
0
声望
1
楼层
199
资料浏览
0
粉丝
0
关注
kesd 发布的帖子
-
为什么 每次录制视频的时间都会少呢?哪位大佬帮忙看看 设置的是录制15个小时 出来每段视频只有20分钟 共30段视频