小编Avi*_*tor的帖子

如何在python中使用opencv同时播放多个视频?

嗨,大家好,我被困在这一点上.我想用opencv在屏幕上播放四个视频.任何人都可以帮我怎么做?假设我想同时玩

  1. first.avi
  2. second.avi
  3. third.avi
  4. fourth.avi

我指的是以下代码.它对单个avi文件非常有效.是否有必要连接或我可以在四个不同的窗口运行?欢迎任何建议导入cv2 import numpy as np

# Create a VideoCapture object and read from input file
# If the input is the camera, pass 0 instead of the video file name
cap = cv2.VideoCapture('first.avi')
cap2 =cv2.VideoCapture('second.avi')

if (cap.isOpened()== False): 
  print("Error opening video stream or file")
if (cap2.isOpened()== False): 
  print("Error opening video stream or file")

while(cap.isOpened()||cap2.isOpened()):
  # Capture frame-by-frame
  ret, frame = cap.read()
  ret, frame1 = cap2.read()
  if ret == True:

   # Display the resulting frame
    cv2.imshow('Frame',frame) …
Run Code Online (Sandbox Code Playgroud)

python opencv

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

标签 统计

opencv ×1

python ×1