Add the audio of the original video to the video generated by matlab code.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
After running the following code which is trying to generate a new video based on a given video, i lost the original audio in the output video and i want to add this audio to the output, is there any solution for this that i can add it to my code, in other words i want for each frame of the video i want to add the coresponding audio sample.
The code (Just the useful part of the code):
while i1 < v1.NumberOfFrames && i2 < v2.NumberOfFrames && i3< v3.NumberOfFrames && i4 < v4.NumberOfFrames
if i1 < v1.NumberOfFrames
i1 = i1+1;
im = v1.read(i1);
im = imresize(im, [290 290]);
im = imrotate(im,-90);
iim1 = image(im,'XData',[0 0],'YData',[height1/2 - 290/2 height1/2 - 290/2]);
end
if i2 < v2.NumberOfFrames
i2 = i2+1;
im = v2.read(i2);
im = imresize(im, [290 290]);
im = imrotate(im,180);
iim2 = image(im,'XData',[width1/2-290/2 width1/2-290/2],'YData',[0 0]);
end
if i3 < v3.NumberOfFrames
i3 = i3+1;
im = v3.read(i1);
im = imresize(im, [290 290]);
im = imrotate(im,90);
iim3 = image(im,'XData',[width1-290 width1-290],'YData',[height1/2 - 290/2 height1/2 - 290/2]);
end
if i4 < v4.NumberOfFrames
i4 = i4+1;
im = v4.read(i4);
im = imresize(im, [290 290]);
iim4 = image(im,'XData',[width1/2-290/2 width1/2-290/2],'YData',[height1 - 290 height1 - 290]);
end
%frame=im2frame(gcf);
frame=getframe(gcf);
writeVideo(writerObj,frame);
drawnow
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Audio and Video Data 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!