這個bug卡了半天,這里記錄一下
Error using VideoReader/init (line 619) Could not read file due to an unexpected error. Reason: Unable to initialize the video obtain properties Error in VideoReader (line 172) obj.init(fileName);
環境:Ubuntu16.04
首先安裝gstreamer0.10-ffmpeg
1 sudo add-apt-repository ppa:mc3man/gstffmpeg-keep 2 sudo apt-get update 3 sudo apt-get install gstreamer0.10-ffmpeg
重啟MATLAB,如果像我一樣還是報錯,別慌,繼續安裝codecs(解碼器)
sudo apt install ubuntu-restricted-extra
若可以讀取部分視頻但仍提示的這個錯誤,為什么仍然報錯orz
因為libstdc++的庫要比ubuntu16.04的庫版本更新。
cd /你自己安裝的matlab目錄/sys/os/glnxa64
ls -l
這時應該看到自己的鏈接庫為libstdc++.so.6.0.20
cd /usr/lib/x86_64-linux-gnu
ls -l libstdc++*
若列表里,版本高於6.0.20

(找到了問題)
然后
cd /你自己安裝的matlab目錄/sys/os/glnxa64
sudo unlink libstdc++.so.6
sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6
重啟MATLAB后,問題解決。
PS:MATLAB官網說,MatlabR2016b以后的版本,解決了這個問題。
另外找不到java lib記得配置環境變量
export MATLAB_JAVA=/usr/local/MATLAB/R2017b/sys/java/jre/glnxa64/jre/