title: how can I play multiple videos simultaneously using opencv in python?
body: <p>Hi guys I am stuck at this point. I want to play four videos on my screen using opencv . Can anyone help me how to do that? Suppose I want to play simultaneously</p>
  
  <ol>
  <li>first.avi</li>
  <li>second.avi</li>
  <li>third.avi</li>
  <li>fourth.avi</li>
  </ol>
  
  <p>I am referring following code. It plays very well for single avi file.
  Is it necessary to concatenate or  i can run in four different windows?. any suggestions are welcome
      import cv2
      import numpy as np</p>
  
  <pre><code># 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)
      cv2.imshow('Frame', frame1)
  
  
     # Press Q on keyboard to  exit
     if cv2.waitKey(25) &amp; 0xFF == ord('q'):
    break
    else: 
      break
  
  
  cap.release()
  cap2.release()
  
  cv2.destroyAllWindows()
  </code></pre>