Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How do I Play Multiple Videos Simultaneously with a Set Position?

I'm looking for a way to play multiple different videos simultaneously with each video having its own coordinated position when it pops up on the screen. (Also possibly have them automatically pop up on screen as the front window)

https://www.geeksforgeeks.org/opening-multiple-color-windows-to-capture-using-opencv-in-python/

I started off here but I'm not sure where to go from here. Also not sure if it's just my computer or the imshow function having trouble playing 2 different videos at the same time

Here's code I got so far:

% capturing from the first camera attached

cap1 = cv2.VideoCapture('Blue_Bananas.avi') cap2 = cv2.VideoCapture('Green_Oranges.avi')

% will continue to play until 27 sec have passed

while True:

ret1, frame1 = cap1.read()

%Show Video

cv2.imshow('frame1', frame1)

% Program will terminate at 27 sec

k = cv2.waitKey(30) & 0xff if k == 27: break

while True:

ret2, frame2 = cap2.read()     

cv2.imshow('frame2', frame2)

if k == 27:

    break

% Releasing all the resources

cap.release()

cv2.destroyAllWindows()