I want to display video with sound
27 views (last 30 days)
Show older comments
I am trying to display video in my guivideo with sound. I used this code below;
vidObj1=VideoReader('video1.mp4');
vidObj1.CurrentTime = 0.1;
currAxes = axes;
while hasFrame(vidObj1)
vidFrame = readFrame(vidObj1);
image(vidFrame, 'Parent', currAxes);
currAxes.Visible = 'off';
pause(1/vidObj1.FrameRate);
end
imshow('background.jpg');
pause (5);
vidObj2=VideoReader('video2.mp4');
vidObj2.CurrentTime = 0.5;
currAxes = axes;
while hasFrame(vidObj2)
vidFrame = readFrame(vidObj2);
image(vidFrame, 'Parent', currAxes);
currAxes.Visible = 'off';
pause(1/vidObj2.FrameRate);
end
It displayed video but there was no sound. What can i do ?
1 Comment
Geoff Hayes
on 5 Feb 2019
cansu - your above code is only displaying the video frames. See https://www.mathworks.com/matlabcentral/answers/332090-how-read-video-and-audio-stream-in-any-format-file-multimedia for an idea of what to do (but you may need the Computer Vision System Toolbox).
Answers (0)
See Also
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!