VideoReader - How to import video with audio

3 vues (au cours des 30 derniers jours)
Kai-Markus Mueller
Kai-Markus Mueller le 6 Sep 2012
Dear all,
I need to load a .mp4 video into Matlab to process it frame by frame. The video contain audio as well.
To import the video into Matlab I am using:
xyloObj = VideoReader( MyVideo ); info = get(xyloObj);
info =
Duration: 50.4746
Name: 'SuperMarioTest.mp4'
Path: 'C:\Users\programmer\Documents\MATLAB\'
Tag: ''
Type: 'VideoReader'
UserData: []
BitsPerPixel: 24
FrameRate: 29.9700
Height: 1080
NumberOfFrames: 1514
VideoFormat: 'RGB24'
Width: 1920
Everything works fine and I am able to process the video frame by frame and save the output in another .mp4 file, but the output video has no audio!:
mov.cdata = vidFrames(:,:,:,1);
mov.colormap = [];
OBJ.writeVideo(mov.cdata);
I have the following problem: I need the audio to be present in the output video (the same audio that is present in the input video).
How can I do that???
Thanks a lot for you help!

Réponses (3)

Walter Roberson
Walter Roberson le 6 Sep 2012
Unfortunately, base MATLAB does not provide any routines for writing audio with video. I have not heard of any of the toolboxes providing routines for it, but I have not investigated that either.

Sean de Wolski
Sean de Wolski le 6 Sep 2012

Kai-Markus Mueller
Kai-Markus Mueller le 7 Sep 2012
Thanks for your answers!
So, the only way to solve the problem is to buy an extra toolbox (vision)? Any free software?

Community Treasure Hunt

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

Start Hunting!

Translated by