Skip to content

Instantly share code, notes, and snippets.

@dasl-
Created May 28, 2019 05:04
Show Gist options
  • Save dasl-/37f88d1f63182c54d6c74d51da9e0ca9 to your computer and use it in GitHub Desktop.
Save dasl-/37f88d1f63182c54d6c74d51da9e0ca9 to your computer and use it in GitHub Desktop.
diff --git a/videoprocessor.py b/videoprocessor.py
index e04db66..d385abf 100644
--- a/videoprocessor.py
+++ b/videoprocessor.py
@@ -154,10 +154,19 @@ class VideoProcessor:
print("Found existing video file: " + save_path)
return save_path
else:
+ # self.__video_stream.download(save_path)
+ # return save_path
print("Unable to find existing video file. Downloading video...")
- self.__video_stream.download(save_path)
- return save_path
+ download_proc = sharedmem.background(
+ function = lambda save_path, video_stream: video_stream.download(save_path),
+ save_path = save_path,
+ video_stream = self.__video_stream
+ )
+ time.sleep(5)
+ return save_path + ".temp"
+ # for process in processes:
+ # process.wait()
def __get_data_directory(self):
save_dir = sys.path[0] + "/" + self.__DATA_DIRECTORY
@@ -228,8 +237,9 @@ class VideoProcessor:
def __process_video(self, video_player):
video_path = self.__download_video()
- vid_cap = cv2.VideoCapture(video_path)
+ vid_cap = cv2.VideoCapture(self.__video_stream.url)
video_fps = vid_cap.get(cv2.CAP_PROP_FPS)
+ print("VIDEO_FPS: " + str(video_fps))
num_frames = int(vid_cap.get(cv2.CAP_PROP_FRAME_COUNT))
vid_cap.release()
@@ -248,8 +258,8 @@ class VideoProcessor:
video_path = video_path
))
- # time.sleep(7)
- # video_player.playVideo(avg_color_frames, video_fps)
+ time.sleep(10)
+ video_player.playVideo(avg_color_frames, video_fps)
for process in processes:
process.wait()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment