Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Re: Extract audio from video

$
0
0
"vishnu kumar" <vishnubrett2005@hotmail.com> wrote in message <i7tu54$jiq$1@fred.mathworks.com>...
> if you don't mind , can you please show me an example?
%To get audio alone from the file
file='AB_original2.avi';
file1='vipmen1.wav'; %o/p file name
hmfr=video.MultimediaFileReader(file,'AudioOutputPort',true,'VideoOutputPort',false);
 hmfw = video.MultimediaFileWriter(file1,'AudioInputPort',true,'FileFormat','WAV');

 while ~isDone(hmfr)
  audioFrame = step(hmfr);
step(hmfw,audioFrame);
 end
close(hmfw);
close(hmfr);


%to get video alone from the file
file='AB_original2.avi';
file1='vipmen2.avi';
hmfr=video.MultimediaFileReader(file,'AudioOutputPort',false,'VideoOutputPort',true);
 hmfw = video.MultimediaFileWriter(file1,'AudioInputPort',false,'VideoInputPort',true);

 while ~isDone(hmfr)
  videoFrame = step(hmfr);
step(hmfw,videoFrame);
 end
close(hmfw);
close(hmfr);

Viewing all articles
Browse latest Browse all 19628

Trending Articles