reader1 = VideoReader('input1.mp4');
reader2 = VideoReader('input2.mp4');
reader3 = VideoReader('input3.mp4');
writer = VideoWriter('output.mp4','MPEG-4');

writer.FrameRate = reader1.FrameRate;
open(writer);

while hasFrame(reader1)
   img1 = readFrame(reader1);
   img1 = padarray(img1,[20 5],255);
   img1 = insertText(img1,[5, 0],'Depth errors from phase wrapping','FontSize',15,'BoxColor',...
    'white','BoxOpacity',0,'TextColor','black');
   img2 = readFrame(reader2);
   img2 = padarray(img2,[20 5],255);
   img2 = insertText(img2,[5, 0],'Ours: Reduced errors','FontSize',15,'BoxColor',...
    'white','BoxOpacity',0,'TextColor','black');
   img3 = readFrame(reader3);
   img3 = padarray(img3,[20 5],255);
   img3 = insertText(img3,[5, 0],'Incorrect depth propagating in VideoNeRF','FontSize',15,'BoxColor',...
    'white','BoxOpacity',0,'TextColor','black');
   img = cat(2,img1,img2,img3);
   img = img(1:end-14,:,:);
   writeVideo(writer,img);
end

close(writer);