Seamlessly appending a new video at the end of an old video using Matlab

조회 수: 2 (최근 30일)
Gobert
Gobert 2021년 4월 6일
편집: Gobert 2021년 4월 7일
Hi,
I need your help! I want to SEAMLESSLY append video2 (of 5 min) at the end of video1 (of 34 min) to create video3 (of 39 min) . The following code did not help me (I could only get the video3 containing two concatenated videos - which I did not want). Can you please help?
vid1 = VideoReader('video1.mp4');
vid2 = VideoReader('video2.mp4');
videoPlayer = vision.VideoPlayer;
% new video
outputVideo = VideoWriter('video3.mp4');
outputVideo.FrameRate = vid1.FrameRate;
outputVideo.FrameRate = vid2.FrameRate;
open(outputVideo);
while hasFrame(vid1) && hasFrame(vid2)
img1 = readFrame(vid1,'native');
img2 = readFrame(vid2,'native');
imgt = [img1 img2];
writeVideo(outputVideo,imgt);
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Acquisition Toolbox Supported Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by