Combine several videos in the same window (Python)
Hello,
is it possible to combine several videos either vertical or horizontal into the same window or output file?
The videos have the number of frames and format.
I tried using np.concentrate but this causes problems with the dimensions of the arrays.
Many thanks in advance
Edit: This is how it can be done - maybe there is a more elegant way but it works fine for me
import cv2
import numpy as
np np
cap = cv2.VideoCapture('Video3.avi',0)
cap1 =
cv2.VideoCapture('Video4.avi',0) while(cap.isOpened()):
cv2.VideoCapture('Video4.avi',0)
while(cap.isOpened()):
ret, frame = cap.read()
ret1, frame1 = cap1.read()
if ret == True:
both = np.concatenate((frame, frame1), axis=1)
cv2.imshow('Frame', both)
out.write(frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
else:
break
cap.release()
out.release()
cv2.waitKey(0)
cv2.destroyAllWindows()
cap.release()
out.release()
cv2.waitKey(0)
cv2.destroyAllWindows()