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

3 visualizaciones (últimos 30 días)
Gobert
Gobert el 6 de Abr. de 2021
Editada: Gobert el 7 de Abr. de 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

Respuestas (0)

Categorías

Más información sobre Data Acquisition Toolbox Supported Hardware en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by