Matlab: Error using VideoFileReader/setup

余生颓废 提交于 2020-01-15 07:21:50

问题


I'm using this code:

h = vision.VideoFileReader('num2.avi')

h = 
System: vision.VideoFileReader
Properties:
             Filename: '/Users/LoFe/Documents/BME/Work/Work/Work/num2.avi'
            PlayCount: Inf                                                
      ImageColorSpace: 'RGB'                                              
  VideoOutputDataType: 'single'  

It is working well, but when I want to call step on it, i get this:

while ~isDone(h)
    hFrame = step(h);
end

Error using VideoFileReader/setup
Could not open the specified file.

Error in
/Applications/MATLAB_R2013a.app/toolbox/matlab/system/+matlab/+system/+mixin   
/FiniteSource.p>FiniteSource.isDone
(line 39) 

I'm using MATLAB 2013a, on OS X (Mavericks), what should I do? It is working fine on Windows 7.


回答1:


As we discussed in the comments, the codec that was used to encode the video is may not supported on your Mac. For MATLAB, the supported codecs that the CVST video reader can read in are different between Mac and Windows.

As such, try re-encoding your video into a format that is native to the Mac, like a QuickTime movie file, or an MP4 file. HandBrake is a perfect tool to do this for you.

Also, perhaps try using MATLAB's native VideoReader class to see if you can read the file and extract video frames. Take a look at its documentation for more details: http://mathworks.com/help/matlab/ref/videoreader-class.html.

However, it looks like you have resolved the error, as converting it to a QuickTime movie file worked.

Glad I could help!



来源:https://stackoverflow.com/questions/25286782/matlab-error-using-videofilereader-setup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!