Save the video stream while reading it

Save a video stream:

if saveFlag == '1':
    time = datetime.utcnow().replace(tzinfo=timezone.utc).astimezone(SHA_TZ)
    time_iso = time.isoformat(sep='T', timespec='seconds')
    out_path = 'save/' + scenarioStr + '_' + str(time_iso) + '.mp4'
    fourcc = cv2.VideoWriter_fourcc('m', 'p', '4', 'v')
    fps = 25
    frame_size = (int(capture.get(3)), int(capture.get(4)))
    video_writer = cv2.VideoWriter(out_path, fourcc, fps, frame_size)

Guess you like

Origin blog.csdn.net/March_A/article/details/130181171