How can I use VideoReader to read a variable file name
5 views (last 30 days)
Show older comments
Tristan Sayre
on 25 May 2018
Commented: Tristan Sayre
on 25 May 2018
I am writing a function that will call many videos and take certain frames from them. I am trying to use a loop in order to allow for the function to read the video names in a folder and place them in VideoReader so I can look through many videos without having to import each video individually.
The general area of issue in the code is here:
videos = dir(videoFolder);
for k=3:length(videos)
vidName = videos(k).name;
v = VideoReader(vidName);
%motion detection code follows
end
where vidName returns the desired name but I believe VideoReader is searching for the file named "vidName" as opposed to the video file name it represents. I receive this error:
Error using VideoReader/init (line 601)
The filename specified was not found in the MATLAB path.
Error in VideoReader (line 171)
obj.init(fileName);
Error in motion_detection (line 12)
v = VideoReader('vidName');
0 Comments
Accepted Answer
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!