fix: accelerate with gpu

This commit is contained in:
rendies 2023-01-19 19:33:03 +07:00
parent 08a9122c3d
commit 4702d6ced1

View File

@ -49,7 +49,7 @@ def open_ffmpeg_stream_process(height, width):
# "-f rtsp rtsp://172.23.90.205:8554/stream" # "-f rtsp rtsp://172.23.90.205:8554/stream"
# ).split() # ).split()
args = ( args = (
"ffmpeg -re -stream_loop -1 -f rawvideo -vcodec rawvideo -pix_fmt " "ffmpeg -hwaccel cuda -re -stream_loop -1 -f rawvideo -vcodec rawvideo -pix_fmt "
"rgb24 -s " + str(width) + "x" + str(height) + " -i pipe:0 -pix_fmt nv12 " "rgb24 -s " + str(width) + "x" + str(height) + " -i pipe:0 -pix_fmt nv12 "
"-c:v libx264 -preset fast -crf 22 -bf 0 " "-c:v libx264 -preset fast -crf 22 -bf 0 "
"-f rtsp -rtsp_transport tcp rtsp://172.17.2.39/counter" "-f rtsp -rtsp_transport tcp rtsp://172.17.2.39/counter"
@ -344,6 +344,7 @@ def PeopleCounter():
# show the output frame # show the output frame
# with lock: # with lock:
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
ffmpeg_process.stdin.write(frame.astype(np.uint8).tobytes()) ffmpeg_process.stdin.write(frame.astype(np.uint8).tobytes())
# outputFrame = frame.copy() # outputFrame = frame.copy()