필터 지우기
필터 지우기

How can I obtain audio and video characteristics in multimedia info when I'm using a for loop?

조회 수: 1 (최근 30일)
I'm using this code but the multimedia characteristics from avi files are not showed and Matlab send me this error after run the program: ??? ??? Index exceeds matrix dimensions What I want is to obtain characteristics from audio and video from this files but I need a loop because there are too many files
files= dir('*.avi');
numfiles=length(files);
mydata= cell(numfiles,1);
info=cell(numfiles,1);
for j=1:numfiles
info{j}=mmfileinfo(files(j).name);
audio=info(j).Audio
video=info(j).Video
end
for k=1:numfiles
mydata{k}=importdata(files(k).name);
end

채택된 답변

Dinesh Iyer
Dinesh Iyer 2015년 8월 12일
The code below should fix the issue:
files= dir('*.avi');
numfiles=length(files);
mydata= cell(numfiles,1);
info=cell(numfiles,1);
isFileSupported = true(numfiles, 1) ;
for j=1:numfiles
try
info{j}=mmfileinfo(files(j).name);
audio = info{j}.Audio
video = info{j}.Video
catch ME
isFileSupported(j) = false;
continue;
end
end
supportedFiles = files(isFileSupported);
for k=1:numel(supportedFiles)
mydata{k}=importdata(supportedFiles(k).name);
end
Hope this helps.
I would not recommend importing the data of all files into MATLAB at once because this can eat up a lot of memory depending upon the file size. Import data for each file as you need it.
Hope this helps.
Dinesh

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by