I'm using the VideoEncoder to record video files in small chunks. When I hit some size limit, I close the file chunk and start a new one. However, every time I start a new video file, I lose ~700ms of frames. I've profiled the code and nothing appears to be running slowly. It just seems like qRgbEnc.get().getData().tofile(fp)
is dropping frames. Is there a way around this?
Code in question:
with depthai.Device(pipeline) as device:
qRgbEnc = device.getOutputQueue(args.codec, maxSize=5, blocking=False) # blocking true??
video_file = get_video_file(codec=args.codec)
fp = open(video_file, 'w')
while True:
while qRgbEnc.has():
qRgbEnc.get().getData().tofile(fp)
if start_new_file():
fp.close()
video_file = get_video_file(codec=args.codec)
fp = open(video_file, 'w')