Skip to content

Instantly share code, notes, and snippets.

@youngsoul
Last active June 14, 2020 14:13
Show Gist options
  • Select an option

  • Save youngsoul/156f2c9de635a58e3dabb1aa3baea6f9 to your computer and use it in GitHub Desktop.

Select an option

Save youngsoul/156f2c9de635a58e3dabb1aa3baea6f9 to your computer and use it in GitHub Desktop.
Tello Video Writer Process. See https://github.com/youngsoul/tello-sandbox.git Tello_face_tracking.py for complete context
def video_recorder(pipe_conn, save_video, height=300, width=400):
global video_writer
# create a VideoWrite object, recoring to ./video.avi
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)
if video_writer is None and save_video == True:
video_file = f"video_{datetime.now().strftime('%d-%m-%Y_%I-%M-%S_%p')}.mp4"
video_writer = cv2.VideoWriter(video_file, cv2.VideoWriter_fourcc(*'MP4V'), 30, (width, height))
while True:
frame = pipe_conn.recv()
video_writer.write(frame)
time.sleep(1 / 30)
# then we got the exit event so cleanup
signal_handler(None, None)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment