Matlab cannot read video, need decoder

Hello, I have set up Matlab R2023b on Rocky 8.9, but I cannot read a video file in matlab. It seems some video decoder packages are missing.

I have searched the matlab error message Could not read file due to an unexpected error. Reason: Unable to initialize the video properties, but only get posts about ubuntu and it seems I have to install package gstreamer0.10-ffmpeg.

On gstream download page, I don’t find a CentOS/Rocky option, maybe it has a different name on CentOS/Rocky? I don’t get further information about that, someone have hints? Many thanks!


  • OS: rocky 8.9, Kernel: Linux 4.18.0-513.9.1.el8_9.x86_64 x86_64, Matlab version: R2023b
  • My matlab script:
    v = VideoReader('sample.mp4');
  • video file info:
    > ffmpeg -i sample.mp4
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'sample.mp4':
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf58.20.100
      Duration: 00:00:09.55, start: 0.000000, bitrate: 1674 kb/s
      Stream #0:0[0x1](und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(progressive), 720x1280, 1499 kb/s, 29 fps, 29 tbr, 14848 tbn (default)
          handler_name    : Core Media Video
          vendor_id       : [0][0][0][0]
      Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 167 kb/s (default)
          handler_name    : Core Media Audio
          vendor_id       : [0][0][0][0]
  • matlab error message:
    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)
    Error in video (line 1)
    v = VideoReader('sample.mp4');

Package names will vary between distros, so what package name is available in Ubuntu most definitely won’t match in Rocky or any other EL-based distro:

[root@rocky8 ~]# dnf list gstreamer*
Available Packages
gstreamer-plugin-crystalhd.x86_64             3.10.0-22.el8      EPEL_8_EPEL_8                       
gstreamer1.i686                               1.16.1-2.el8       Rocky_Linux_Rocky_Linux_8_AppStream 
gstreamer1.x86_64                             1.16.1-2.el8       Rocky_Linux_Rocky_Linux_8_AppStream 
gstreamer1-devel.i686                         1.16.1-2.el8       Rocky_Linux_Rocky_Linux_8_AppStream 
gstreamer1-devel.x86_64                       1.16.1-2.el8       Rocky_Linux_Rocky_Linux_8_AppStream 
gstreamer1-plugins-bad-free.i686              1.16.1-4.el8       Rocky_Linux_Rocky_Linux_8_AppStream 
gstreamer1-plugins-bad-free.x86_64            1.16.1-4.el8       Rocky_Linux_Rocky_Linux_8_AppStream 
gstreamer1-plugins-bad-free-devel.i686        1.16.1-4.el8       Rocky_Linux_Rocky_Linux_8_PowerTools
gstreamer1-plugins-bad-free-devel.x86_64      1.16.1-4.el8       Rocky_Linux_Rocky_Linux_8_PowerTools
gstreamer1-plugins-base.i686                  1.16.1-3.el8       Rocky_Linux_Rocky_Linux_8_AppStream 
gstreamer1-plugins-base.x86_64                1.16.1-3.el8       Rocky_Linux_Rocky_Linux_8_AppStream 
gstreamer1-plugins-base-devel.i686            1.16.1-3.el8       Rocky_Linux_Rocky_Linux_8_AppStream 
gstreamer1-plugins-base-devel.x86_64          1.16.1-3.el8       Rocky_Linux_Rocky_Linux_8_AppStream 
gstreamer1-plugins-good.i686                  1.16.1-4.el8       Rocky_Linux_Rocky_Linux_8_AppStream 
gstreamer1-plugins-good.x86_64                1.16.1-4.el8       Rocky_Linux_Rocky_Linux_8_AppStream 
gstreamer1-plugins-good-gtk.i686              1.16.1-4.el8       Rocky_Linux_Rocky_Linux_8_AppStream 
gstreamer1-plugins-good-gtk.x86_64            1.16.1-4.el8       Rocky_Linux_Rocky_Linux_8_AppStream 
gstreamer1-plugins-ugly-free.i686             1.16.1-1.el8       Rocky_Linux_Rocky_Linux_8_AppStream 
gstreamer1-plugins-ugly-free.x86_64           1.16.1-1.el8       Rocky_Linux_Rocky_Linux_8_AppStream 
gstreamer1-svt-av1.x86_64                     0.8.7-1.el8        EPEL_8_EPEL_8                       
gstreamer1-svt-vp9.x86_64                     0.3.0-6.el8        EPEL_8_EPEL_8                       
gstreamer1-vaapi.x86_64                       1.16.1-1.el8       EPEL_8_EPEL_8                       
gstreamer1-vaapi-devel-docs.noarch            1.16.1-1.el8       EPEL_8_EPEL_8                       

try installing gstreamer1-plugins-good or gstreamer1-plugins-bad-free as well. You also have gstreamer1-plugins-ugly-free too as an option.

Also Rocky 8.9 isn’t supported anymore, so you should really be running 8.10.

Hi iwalker thanks for reply. I have installed gstreamer stuff but I get the same error message.

> rpm -qa | grep gstreamer

I found this:

suggests gstreamer1-libav from nux repository. So based on that, we do have an alternative:

dnf config-manager --enable extras
dnf install rpmfusion-free-release
dnf install gstreamer1-libav

you will need Rocky 8 Extras repository enabled to get that rpmfusion package installed.

gstreamer1-libav package works, thanks!

1 Like