How to queue a list of videos for analysis?
5 views (last 30 days)
Show older comments
Mark Lepage
on 30 Oct 2017
Answered: Mabin Mariam Joseph
on 8 Nov 2017
Hello,
I have a program written that does certain analysis on a video. However, I need to perform this analysis on many videos, thus is manually time consuming to load the next video into the program. Is there a way to queue a list of videos to be inputted in my program?
My pseudo code currently looks something like this:
obj = VideoReader('myVideo-1.MOV')
results = SOMEANALYSIS(obj)
My videos are in some form of myVideo-1, 'myVideo-2,..., myVideo-n, where n denotes the number of the video I am analysing.
Any input is appreciated.
0 Comments
Accepted Answer
Mabin Mariam Joseph
on 8 Nov 2017
Hello Mark,
You can use create a 'FileDatastore' object that can hold all the video files. The 'ReadFcn' property of the datastore object is a function that reads the file data specified as a function handle. Please see the sample code below:
loc='location of the files';
fds = fileDatastore(loc,'ReadFcn',@myread,'FileExtensions','.mp4');
data = readall(fds);
function v = myread(file)
v=VideoReader(file);
end
You can also refer to the following MATLAB Documentation links for further information:
https://www.mathworks.com/help/matlab/ref/filedatastore.html
https://www.mathworks.com/help/matlab/ref/matlab.io.datastore.readall.html
https://www.mathworks.com/help/matlab/datastore.html
0 Comments
More Answers (0)
See Also
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!