Concatenate two video together one below the other

15 views (last 30 days)
I am trying to play two video files one below the other at the same time. The videos are of different dimension. I tried this code but get an error saying "Dimensions of matrices being concatenated are not consistent."
I understand the error because frame sizes are different. but how to correct the code?
Frame2:- 681x1429x3 single
Frame1:- 525x700x3 single
Also, I tried to play two videos of same dimension, it worked but was zoomed in . How do I zoom out and play the videos as is?
if true
{
vid1 = vision.VideoFileReader('R1.avi');
vid2 = vision.VideoFileReader('FR2.avi');
vidP = vision.VideoPlayer;
while ~isDone(vid1)
frame1 = step(vid1);
frame2 = step(vid2);
frame = vertcat(frame1, frame2);
step(vidP,frame);
end
release(vid1);
release(vid2);
release(vidP);
}
end
Thank you. Any help is much appreciated.

Answers (1)

Prakhar Jain
Prakhar Jain on 12 Nov 2018
Hi Srinidhi,
You can refer the following answer by Walter. how to combine two videos in matlab

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!