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

2 vues (au cours des 30 derniers jours)
Gobert
Gobert le 6 Avr 2021
Modifié(e) : Gobert le 7 Avr 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

Réponses (0)

Catégories

En savoir plus sur Data Acquisition Toolbox Supported Hardware dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by