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
- first.avi
- second.avi
- third.avi
- fourth.avi
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
# 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) & 0xFF == ord('q'):
break
else:
break
cap.release()
cap2.release()
cv2.destroyAllWindows()