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

2 Ansichten (letzte 30 Tage)
Gobert
Gobert am 6 Apr. 2021
Bearbeitet: Gobert am 7 Apr. 2021
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

Antworten (0)

Kategorien

Mehr zu Data Acquisition Toolbox Supported Hardware finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by