How can I obtain audio and video characteristics in multimedia info when I'm using a for loop?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Jose Peñaloza
le 12 Août 2015
Commenté : Jose Peñaloza
le 13 Août 2015
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 commentaires
Réponse acceptée
Dinesh Iyer
le 12 Août 2015
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
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Audio and Video Data dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!