Matlab: loading wmv video files - matlab

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

Related

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

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.

Installing openCV on MATLAB with mex and MinGW64

I'm trying to install OpenCV on MATLAB2015b using mexopencv. I have downloaded and successfully installed MATLAB support for MinGW-w64 C/C++ Compiler add-on in MATLAB. This is MATLAB's suggested compiler when I type mex -setup. However, when I run mexopencv.make in MATLAB, I get the following error:
Error using mexopencv.make>pkg_config (line 333)
OpenCV library path not found: D:\opencv\build\x64\mingw\lib
Error in mexopencv.make>mex_options (line 265)
[cv_cflags, cv_libs] = pkg_config(opts);
Error in mexopencv.make (line 82)
mex_flags = mex_options(opts);
I have already added mexopencv-master directory to my MATLAB's Path. And I have already checked that I have downloaded the correct version of opencv for mexopencv (which is 3.4.1 as of now).
I don't know why \build\x64\mingw\lib\ doesn't exist. I have seen different tutorials but most of them use Microsoft Visual Studio 2013/2015 C++ to compile mexopencv. How can I compile OpenCV with MinGW-w64 on my own? Or is there another github package that I should've downloaded instead of this one?
I have tried to uninstall my current version of Visual Studio and install the 2013 version to use its C/C++ compiler. However, MATLAB doesn't recognize this compiler when I issue mex -setup.
Any help is appreciated. Also, I cannot use MATLAB's computer vision toolkit because I want to use a function that is not supported by it (Namely, the probabilistic Hough transform).

Build a shared library on a Raspberry using Lazarus

I'm trying to build a shared library to use on a raspberry pi (model 3B) using lazarus. After some puzzling I found out that my original library didn't work properly so I switched to a very simple library using this example.
But even this simple library doesn't compile properly to be used. When I try to open the library in another lazarus project it gives me the error:
< libName >: cannot open shared object file: No such file or directory
After some research I found the following diagnostics I could run. The file and ldd command in the compile library:
$file ./libname.so gives:
./libname.so: ELF 32-bit LSB shared object, ARM, EABI5 verion 1 (SYSV), dynamically linked, not stripped
$ldd ./libname.so
not a dynamic executable
I have searched for similar cases and from found that others had this problem when they tried to use libraries compile for a different platform/architecture. I already set the project>project options>compiler options>target platform to OS:= linux and Target CPU family: arm.
The system I am using (using $uname -a):
Linux raspberrypi 4.4.13-V7+ #894 SMP Mon Jun 13 13:13:27 BST 2016 armv7l GNU/Linux
with distro: Raspbian GNU/linux 8.0 (jessie)
Lazarus version: 1.2.4+dfsg2-1
FPC version: 2.6.4 arm-linux-gtk2
At this point I am not sure what is wrong and why this library isn't working. I can find very little information on this problem (on the aspberry platform and using lazarus) Any suggestions what I could try to make it work, compile it different or do some more diagnostics?
Found the solution. As Marco proposed above: Add initc to the uses part. It seems that if you try to make a library it has to include initc, cmem or LCL to the uses section because the library has to do some memory management for which it needs one of these units.
However this resulted in another error when trying to load the library:
"Undefined symbol: TC_SYSTEM_ISLIBRARY"
This seems to be a raspberry specific problem, compilers on other systems do not give this error. More information can be found HERE.
Eventually solved this by install fpc 3.0.0 compiler on the raspberry pi, compiled it and the library can be loaded properly (but still needs one of the above units).

MATLAB on Ubuntu 15.04: The VideoReader plugin libmwgstreamerplugin failed to load properly

In MATLAB R2015b following command:
obj = VideoReader('traffic.avi');
causes the following error:
Error using VideoReader/init (line 619)
The VideoReader plugin libmwgstreamerplugin failed to load properly.
Error in VideoReader (line 172)
obj.init(fileName);
I've installed gstreamer0.10 evidenced by:
alexander#alexander-desktop:~/Documents/MATLAB$ gst-
gst-codec-info-0.10 gst-inspect-0.10 gst-visualise-0.10
gst-discoverer-0.10 gst-launch-0.10 gst-xmlinspect-0.10
gst-feedback-0.10 gst-typefind-0.10 gst-xmllaunch-0.10
I'm assuming I have the required plugins because of the following feedback:
alexander#alexander-desktop:~/Documents/MATLAB$ gst-inspect-0.10 | grep avi
ogg: oggaviparse: Ogg AVI parser
typefindfunctions: video/x-msvideo: avi
navigationtest: navigationtest: Video navigation test
avi: avidemux: Avi demuxer
avi: avimux: Avi muxer
avi: avisubtitle: Avi subtitle parser
Can anybody help?
This is a known issue. Can you please try the following workaround in this Bug Report?
http://www.mathworks.com/support/bugreports/1246784
From the bug report link it appears to be an issue with the GLIBC version that MATLAB uses and what GStreamer uses.
Dinesh
To work around this issue, replace the version of the library libstdc++.so.6 shipped with MATLAB® with the native version on your system.
To do this, first complete the following steps to ensure that the system's libstdc++.so.6 version is higher than the one shipped with MATLAB®.
In a Linux terminal, navigate to matlabroot/sys/os/glnxa64 and type the following:
ls -l
The version of the library shipping with MATLAB® should be libstdc++.so.6.0.17.
Navigate to /usr/lib/x86_64-linux-gnu and type the following:
ls -l libstdc++*
If the resulting version is higher than 6.0.17, then continue with the following steps.
Navigate to matlabroot/sys/os/glnxa64.
Execute the following:
unlink libstdc++.so.6
ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6
Restart MATLAB®.

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 :)