Linux Mint 21.1 MATLAB 2022b VideoReader/initReader Could not read file due to an unexpected error. Reason: Unable to initialize the video properties - matlab

I have installed MATLAB 2022b on my LInux Mint 21.1. My laptop is an Acer Swift 3 with an Nvidia MX250 dedicated gpu. I have installed the drivers for the gpu, namely the nvidia-driver-525 and nvidia-utils-525 package.
The Nvidia X Server Settings seems to work and the Prime Profile is set to NVIDIA (Performance Mode).
The problem is when I am trying to load a video (.mp4 and .mov) in different frames, but when I ran the code I get this error in the console:
Main Error using VideoReader/initReader Could not read file due to an unexpected error. Reason: Unable to initialize the video properties
Error in audiovideo.internal.IVideoReader (line 136) initReader(obj, fileName, currentTime);
Error in VideoReader (line 104) obj#audiovideo.internal.IVideoReader(varargin{:});
Error in load_picture (line 2) vid = VideoReader(obj);
Error in Main (line 12) [vid, yval, t, nulv]=load_picture(obj);
When I was trying to run the code reading the video, I was getting this errors in the terminal session I opened MATLAB with:
(MATLAB:4591): GStreamer-WARNING **: 10:55:45.878: Failed to load plugin '/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstlibav.so': /home/malina/MATLAB/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by /lib/x86_64-linux-gnu/librubberband.so.2)
(MATLAB:4591): GStreamer-Base-CRITICAL **: 10:55:45.909: basetransform: second attempt to fixate caps returned invalid (NULL) caps on pad vaapipostproc0:sink
I moved the libstdc++.so.6 from the MATLAB/sys/os folder to an unused folder, I have read that by doing this matlab will be forced to use the systems libstdc++.so.6 package, the version coming with the install being known to cause problems as stated by some forums. Doing that resulted in the same error from the console while running the code, but there is no more output from the terminal session.
The problem might be driver specific, but I am unsure. I have installed the codecs and libgstreamer1.0 packages, but I do not know how to test if they are the correct version for matlab. I can open the files on my system normally, so the codecs shouldn't be the problems.
Can anyone guide me through solving this issue? I'd be really grateful. Let me know if you want any other info that might be useful and if there are any log files created by matlab that could be useful in solving this issue, please let me know where I can find them.

Related

MATLAB Error: Can't check VCRTs

When I start MATLAB I suddenly receive the following error message on the command line:
ERROR: Can't check 8.0 VCRTs (starter line:956) System Error:
0x00000005 ERROR: Can't check 9.0 VCRTs (starter line:995) System
Error: 0x00000005 Installing required 8.0 run-time libraries. This may
take a few minutes...
I tried to repair and reinstall the Visual C++ Redistributables (2005 and 2008), but that didn't solve the problem. Doing online research I mainly found out that people who had a similar problem reinstalled windows. Well, does anyone have another idea what I could try in order to solve that?

Unable to initialize the video obtain properties (videoreader in Matlab)

I can read one video using Matlab in windows but cannot read the same video from Matlab in ubuntu 14.04. The error is as follows:
>> aa = VideoReader('s12_32_xvid.avi');
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);
Can anyone help ?
This solved it for me. You need to install gstreamer0.10-ffmpeg.
https://in.mathworks.com/matlabcentral/answers/255157-can-t-load-video-using-videoreader-in-matlab-r2015-on-ubuntu-15-04-could-not-read-file-due-to-an-un
The instructions to install gstreamer0.10-ffmpeg are here:
https://askubuntu.com/questions/575869/how-do-i-install-gstreamer0-10-ffmpeg-on-ubuntu-14-10
Hope it helped
After installing the gstreamer0.10-ffmpeg, the problem may still exists, due to a missing codec. You may install the codecs using:
sudo apt install ubuntu-restricted-extras

GPUmat doesn't work in my matlab

I want to use GPU in matlab, so I installed CUDA toolkit(cuda_6.0.37), downloaded GPUmat 0.28 version. Of course my pc has geforce 850m. I clicked 'GPUstart', and it seems working and type the 'GPUmatSystemCheck', it says CUBLAS, CUFFT, CUDART installed, but there is warning 'GPUmat and SYSTEM architecture are different.'. My pc is 64 bit. Type the GPUsingle(1) on the command window, it says
'Warning: The following error was caught while executing 'GPUtype'
class destructor: Undefined function 'GPUtypeDelete' for input
arguments of type 'double'. Undefined function
'mxNumericArrayToGPUtypePtr' for input arguments of type
'GPUsingle'.'.
What should I do next? What am I missing?
I suppose you installed the newest version of GPUmat, which is a 32 bit version, and hence there is the warning. Maybe it would help to download an older version of GPUmat, which is made for 64 bit systems. I tried it myself and at least I don't get the warning anymore. Instead I have the problem that some DLL files are not found (Invalid MEX-file
'..\GPUmat\win64\bin\GPUfullInfo.mexw64': not found). You could still give it a try and see if it works for you.

ld: cannot find -lguide while compiling files using mex with intel c++ compiler

Here is the situation:
Ubuntu 13.04, Matlab 2012a and Intel C++ Composer XE 2013 for Linux.
I downloaded a matlab code archive and followed the instructions in it to compile the .cpp files. Formerly when I finished installing Matlab 2012a and started it, some error messages showed up and I googled out an answer which is:
sudo ln -s /lib/x86_64-linux-gnu/libc.so.6 /lib64/libc.so.6
And then there came out another error message which told me 'missing lstdc++' when I started compiling, the idea of re-installing g++ first came into my mind, and the error message disappeared after I did so. However, finally I got an error which I could not find an answer anywhere:
>> compilemex
ld: cannot find -lguide
mex: link of ' "max_pool.mexa64"' failed.
Error using mex (line 206)
Unable to complete successfully.
Error in compilemex (line 20)
eval(exec_string{1});
During the the process of searching for a solution, I found a thread for my previous 'missing lstdc++' error which differed from what I did to fix it, does this matter or not? And another hint is that I could not find any file named like 'libguide' under the /opt/intel/ directory, how could I fix it?
Thanks in advance!
Googl'ing for libguide, i found this:
http://software.intel.com/en-us/forums/topic/284445
According to this, the build script you're using refers to an old version of the intel compiler. Newer versions seem to have the functions in libguide.so moved to libiomp5.so.
So try replacing -lguide by -liomp5.
Disclaimer: this is pure google knowledge. Personally I have no idea what either library is good for :)

Matlab: loading wmv video files

I am trying to load a wmv video in Matlab as follows:
vidObj = mmreader('video.wmv');
However, I receive the following error:
The file requires the following codec(s) to be installed on your system: video/x-ms-asf
I don't understand why I am receiving this error, since I am able to play wmv files on my system. I am running Matlab 7.10.0 (R2010a) on Ubuntu 11.04. How can I fix this problem?
it might be hard to impossible to get this working on a linux system. Alternatively, you could write your own wmv import function (if you know how to talk to the underlying libraries on your linux system, i.e. vlc).
I have received the same error message because of a version conflict for the standard c++ library.
I have started MATLAB in a console window and recognized that Gstreamer fails to load a plug-in.
(:26573): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-0.10/libgstffmpeg.so':
/usr/local/MATLAB/2010b/bin/glnx86/../../sys/os/glnx86/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /usr/lib/libdirac_encoder.so.0)
The problem is, MATLAB ships with libstdc++.so.6.0.10 and GStreamer complains that it should work with libstdc++.so.6.0.13
So you should replace the symbolic link in MATLAB dir with the one in your system.
$ rm /usr/local/MATLAB/2010b/sys/os/glnx86/libstdc++.so.6
$ ln -s /usr/lib/libstdc++.so.6 /usr/local/MATLAB/2010b/sys/os/glnx86/libstdc++.so.6