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 Center および File ExchangeData 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