Video Reader and Audio

10 views (last 30 days)
Jessica
Jessica on 22 May 2018
Answered: Walter Roberson on 22 May 2018
I am using the below code to merge multiple videos together. Is it possible to save the audio from one of the videos to the merged (new) video?
vid1 = VideoReader(LeftVideo,'CurrentTime',TimeOffset_L);%Left
vid2 = VideoReader(RightVideo,'CurrentTime',TimeOffset_R);%Right
videoPlayer = vision.VideoPlayer;
outputVideo = VideoWriter(OutPutVideo);
outputVideo.FrameRate = vid1.FrameRate;
open(outputVideo);
for i=1:60
img1 = readFrame(vid1);
img2 = readFrame(vid2);
imgt=[img1 img2];
step(videoPlayer, imgt);%play video
writeVideo(outputVideo, imgt); %record new video
end
release(videoPlayer);
close(outputVideo);

Accepted Answer

Walter Roberson
Walter Roberson on 22 May 2018

More Answers (0)

Categories

Find more on Audio I/O and Waveform Generation in Help Center and File Exchange

Products


Release

R2016b

Community Treasure Hunt

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

Start Hunting!