Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

Video composition by selecting videos randomly

$
0
0
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 . video_index=0 cap=cv2.VideoCapture(video[srt_time[video_index]]) 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) count=cap.get(cv2.CAP_PROP_FRAME_COUNT) fourcc = cv2.VideoWriter_fourcc(*'DIVX') out = cv2.VideoWriter("Output.avi", fourcc, fps, (width, height), True) while(cap.isOpened()): ret,frame=cap.read() if frame is None: print "end of video " + str(video_index) + " .. next one now" video_index += 1 if video_index >= len(videoList): break cap = cv2.VideoCapture(video[srt_time[video_index]]) ret, frame = cap.read() out.write(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.

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>