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

51 views (last 30 days)
Hello,
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.

Answers (1)

Harshit Saini
Harshit Saini on 1 Mar 2023
I understand you are facing an error with MATLAB failing to read the video properties of your input video file. This can be caused by a variety of issues, such as incorrect codec or file format, or problems with the system libraries used by MATLAB.
Here are some steps you can try to troubleshoot the issue:
Check the video file format and codec: Make sure that the video file you are trying to read is in a format that is supported by MATLAB. Also, check that the required codec is installed on your system.
Previous versions of MATLAB relied on gstreamer-0.10 to process video, however, this dependency has been updated to gstreamer-1.0 or higher from R2017a and later.
The error message indicates that the suitable codecs are not installed on the system to decode the file. Try to determine if the file can be played outside MATLAB on the Linux system. If the video does not play on the system, it indicates that the suitable codecs are not available. Installing the correct gstreamer codecs may solve the issue.
Try a different video file: If the above steps do not resolve the issue, try using a different video file to see if the problem is specific to the input video file.
  4 Comments
Xenia Radmoser
Xenia Radmoser on 3 Mar 2023
My theory is that it is working on Ubuntu 20 because afterwards apparently Ubuntu stopped supporting some packages. That's what a friend of mine said. So try using Ubuntu 20!
Francesco Vespignani
Francesco Vespignani on 7 Mar 2024
same issue for me Ubuntu 22.04, Matlab2013a, gstreamer-1.0
quite common video (H264) are played ok outside matlab (vlc, etc)

Sign in to comment.

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!