Video composition by selecting videos randomly

asked 2016-11-18 06:37:23 -0500

tinku gravatar image

I have multiple videos that I want to compose to get a single video. Currently I am using the following code to compose a video .

width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
fps = cap.get(cv2.CAP_PROP_FPS)
fourcc = cv2.VideoWriter_fourcc(*'DIVX')
out = cv2.VideoWriter("Output.avi", fourcc, fps, (width, height), True)
    if frame is None:
        print "end of video " + str(video_index) + " .. next one now"
        video_index += 1
        if video_index >= len(videoList):
        cap = cv2.VideoCapture(video[srt_time[video_index]])
        ret, frame =

This code gives me a video remix which contains a video one after another. But now I want a video remix which switches views between the videos randomly. Like for example video starts with video 1 and after some time it randomly switches to any of the other two videos . After reading that selected video it again randomly switches to another video. basically, there should be a random switch between videos in the composed videos.

edit retag flag offensive close merge delete