小编Mod*_*ner的帖子

如何使用Python在线程中运行多个相机

下面是我使用多线程池并行播放多个视频的代码。但每个输入仅播放一个视频。我希望每个视频单独打开。未合并

import concurrent.futures

RTSP_URL = "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4"
RTSP_List = [RTSP_URL, RTSP_URL, RTSP_URL, RTSP_URL]


def url_to_video(url):
    video = cv2.VideoCapture(url)
    while True:
        _, frame = video.read()
        cv2.imshow("RTSP", frame)
        k = cv2.waitKey(1)
        if k == ord('q'):
            break
    video.release()
    cv2.destroyAllWindows()


while True:
    with concurrent.futures.ThreadPoolExecutor() as executor:
        executor.map(url_to_video, RTSP_List)```

how to play each video separately.


Run Code Online (Sandbox Code Playgroud)

python opencv

4
推荐指数
1
解决办法
901
查看次数

标签 统计

opencv ×1

python ×1