Created
November 1, 2017 02:13
-
-
Save vpatov/2b68d1d7de8bbad36de6e40b9b18f8c3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
def accept_connections: | |
while(True): | |
connection = server_socket.accept()[0].makefile('wb') | |
camera.start_recording(connection, format='h264', splitter_port=2, | |
resize=(640,360)) | |
try: | |
camera.wait_recording(7*60*60) #assuming this records for 7 hours? | |
except: | |
pass | |
# create and start the connection thread | |
conn_thread = threading.Thread(target=accept_connections) | |
conn_thread.run() | |
# start recording video in the main thread | |
camera.start_recording(completed_video + '{}.h264'.format(dt.datetime.now().strftime('%Y%m%d%H%M%S') ), bitrate=4500000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment