From 1c65521d25d2b7f9b67b4216ebb36fc9fc212f4e Mon Sep 17 00:00:00 2001 From: rendies Date: Wed, 18 Jan 2023 17:18:49 +0700 Subject: [PATCH] fix: subprocess communicate --- RunCounting.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RunCounting.py b/RunCounting.py index b165afe..6b5cc40 100644 --- a/RunCounting.py +++ b/RunCounting.py @@ -15,7 +15,6 @@ from flask import Flask from flask import jsonify from flask_cors import CORS, cross_origin import subprocess -import ffmpeg t0 = time.time() @@ -346,7 +345,6 @@ def PeopleCounter(): # show the output frame # with lock: ffmpeg_process.stdin.write(frame.astype(np.uint8).tobytes()) - ffmpeg_process.communicate() # outputFrame = frame.copy() # cv2.imshow("Real-Time Monitoring/Analysis Window", frame) @@ -387,6 +385,8 @@ def PeopleCounter(): vs.release() # close any open windows + ffmpeg_process.stdin.close() + ffmpeg_process.wait() cv2.destroyAllWindows() def generate():