VideoReader Failed to init Ubuntu 20.04

13 views (last 30 days)
gaspard BLANCHET
gaspard BLANCHET on 27 Sep 2020
Answered: 福 周 on 1 Apr 2022
I'm trying to process video with matlab 2020b on Ubuntu 20.04. But I receive this log:
Error using VideoReader/initReader (line 734)
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 GMM (line 7)
video = VideoReader('./walking/person01_walking_d1_uncomp.avi');
The installation of gstream0.1 is not available.
Do you have any idea of what I'm missing?

Answers (3)

Urmila Rajpurohith
Urmila Rajpurohith on 21 Oct 2020
Hi
The reason is that old versions of MATLAB used to rely on gstreamer-0.10 to process video but from at least R2017a the dependency of gstreamer library has changed to gstreamer-1.0 or higher.
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.
To do so, follow the steps below:
1. Copy the file to /tmp
2. On the Linux terminal, execute: gst-launch-1.0 playbin uri=file:///tmp/<filename> video-sink=appsink audio-sink=fakesink text-sink=fakesink.
If this errors out, it indicates that the suitable codecs are not available.
Installing the correct gstreamer codecs may solve the issue.
Hope this helps!

Mohamed Bencherif
Mohamed Bencherif on 8 Sep 2021
I had a similar issue in Matlab R2021a, Ubuntu 20.04,
The best thing is to install all the packages of gstreamer.
check this link..
Install GStreamer on Ubuntu or Debian
Run the following command:
sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev 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 gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 gstreamer1.0-pulseaudio
The installation of gsteramer fixed the problem.
  1 Comment
Allen Takahashi
Allen Takahashi on 20 Oct 2021
I get the exact same message as the original poster on Linux Mint 19.3 and Matlab 2020a. Running the gst-launch command per UR I get "No decoder available for type 'video/x-msvideo'.". I have run the Install GStreamer command above and it made no difference. I can successfully play the AVI file using VLC; if I query VLC as to the codec it comes back with "RV24".
I can't find a codec called RV24; the closest I have found is RGB24 - but it is unclear to me that this is a codec.
Is there a way to access the codec VLC is using in Matlab? Or if RGB24 really is what I'm looking for, where do I put it so Matlab can find it?

Sign in to comment.


福 周
福 周 on 1 Apr 2022
I had a similar issue in Matlab R2021a, Ubuntu 18.04,
The best thing is to install all the packages of gstreamer. but i can not install that
so, i also find this: link: https://www.insidentally.com/articles/000012/
在 Ubuntu 中安装多媒体解码器
通过使用“ubuntu-restricted-extras”包,可以将必要的多媒体编解码器安装在 Ubuntu 及其衍生发行版中。它是一个包含各种多媒体包的软件包。
为了安装多媒体编解码器,您需要启用由 Ubuntu 创建的软件库 “multiverse”,这个库向用户提供非开源软件。
运行以下命令以启用 multiverse 和 restricted 存储库:
要启用“multiverse”存储库,请运行:
$ sudo add-apt-repository multiverse
要启用“restricted”存储库,请运行:
$ sudo add-apt-repository restricted
然后更新仓库索引,运行:
$ sudo apt update
最后,运行以下命令安装多媒体编解码器。它会让你进行两次确认,你只需要通过点击“回车”按钮进行确认。
$ sudo apt install ubuntu-restricted-extras
and if you can not install this 'ubuntu-restricted-extras', such as:
"
  1. Connection failed [IP: 91.189.88.152 80]
  2. E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
"
try this link: https://zhuanlan.zhihu.com/p/61228593 ( change the ubuntu source)

Community Treasure Hunt

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

Start Hunting!