Video file I/O requires Gstreamer 1.0 and higher

33 views (last 30 days)
Raymond Chiu
Raymond Chiu on 23 Oct 2018
Commented: Clyde Webster on 9 Jan 2019
What is causing the error and what are the steps for corrective action? Error message:
MATLAB has a later version of libstdc++:
  • attempts to use the older libstdc++ version prevents MATLAB from starting
alias matlab='LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21 /usr/local/MATLAB/R2018b/bin/matlab -desktop'
  • explicit MATLAB invocation (via alias below) with MATLAB's libstdc++ does not resolve error:
alias matlab='LD_PRELOAD=/usr/local/MATLAB/R2018b/sys/os/glnxa64/libstdc++.so.6.0.22 /usr/local/MATLAB/R2018b/bin/matlab -desktop'
R2018b is installed on Ubuntu 16.04. GStreamer install command:
apt-get install libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-doc gstreamer1.0-tools
GStreamer plays videos from command line:
gst-launch-1.0 playbin uri=file:////home/user/MATLAB_DATA/OverheadCamDetect/OverheadCam.mp4
MATLAB has the newer version of the libstdc++ versions available:
ls -l /usr/local/MATLAB/R2018b/sys/os/glnxa64/libstdc++.so.6.0.22 #V22: MATLAB
ls -l /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21 #V21: Ubuntu_16.04
Because MATLAB is packaged with a later version of stdlibc++, explicitly call MATLAB packaged stdlibc++ (same error results)
alias matlab='LD_PRELOAD=/usr/local/MATLAB/R2018b/sys/os/glnxa64/libstdc++.so.6.0.22 /usr/local/MATLAB/R2018b/bin/matlab -desktop'
OTHER UNSUCCESSFUL APPROACHES
Redirecting the link to the older libstdc++ prevents MATLAB from starting:
cd /usr/local/MATLAB/R2018b/sys/os/glnxa64
sudo unlink /usr/local/MATLAB/R2018b/sys/os/glnxa64/libstdc++.so.6 #V22: MATLAB
sudo ln -s /usr/local/MATLAB/R2018b/sys/os/glnxa64/libstdc++.so.6.0.22 libstdc++.so.6
Attempts to rename libstdc++ per Mathworks instructions was NOT successful (MATLAB would not start):
cd /usr/local/MATLAB/R2018b/sys/os/glnxa64
ls -l libstdc++.*
sudo mv libstdc++.so.6 backuplibstdc++.so.6
sudo mv libstdc++.so.6.0.22 backuplibstdc++.so.6.0.22
ls -l ls -l backuplibstdc++.*
% MATLAB fails to boot so restore the files to original condition:
sudo mv backuplibstdc++.so.6.0.22 libstdc++.so.6.0.22
sudo mv backuplibstdc++.so.6 libstdc++.so.6
  1 Comment
Marcelo Herrera
Marcelo Herrera on 23 Oct 2018
I have the same issue, i can read .avi without problem, but no .mp4. The output of videoReader.getFileFormats only show .avi and .mj2. with or without gstreamer1.0 (oficial)in Ubuntu 16.04.5 x64. Fresh instalation of Matlab R2018b

Sign in to comment.

Answers (2)

Marcelo Herrera
Marcelo Herrera on 24 Oct 2018
Edited: Marcelo Herrera on 24 Oct 2018
I have a solution that work for me in Ubuntu 16.04.5 LTS:
First Uninstall and purge gstreamer1.0 and gstreamer0.1
Compiling from source
  1. Download and compiling orc-0.4.28 (https://gstreamer.freedesktop.org/src/orc/)
  2. Decompress the .xy file. Inside the decompressed directory* $ ./configure* $ make* $ sudo make install
  3. Do the same in point 2 for https://gstreamer.freedesktop.org/src/:
gstreamer/gstreamer1.14.4
gst-plugins-base/gst-plugins-base-1.14.4/
gst-libav/gst-libav-1.14.4/
gst-plugins-good/gst-plugins-good-1.14.4
After this, run matlab from shell $ matlab ... et voila
Please, tellme if this solution work for you.
#gstreamer #ubuntu16.04 #mp4
  6 Comments
Clyde Webster
Clyde Webster on 9 Jan 2019
I've completed these steps, unfortunately the error persists.
Matlab: R2018b
OS: Ubuntu 16.04

Sign in to comment.


sophia bano
sophia bano on 5 Nov 2018
I was getting the same gstreamer error on Matlab2018b in Ubuntu 16.04. The following solution worked for me: https://uk.mathworks.com/matlabcentral/answers/294258-hello-i-have-a-problem-with-videoreader-on-matlab-r2016a-with-ubtuntu-lts16-04

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by