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
0 个评论
采纳的回答
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 Center 和 File Exchange 中查找有关 Audio and Video Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!