OpenCV support for RTSP

Im trying to run a Python program on Rocky 10 which uses OpenCV to connect to an IP camera using RTSP.

I installed the python3-opencv package and its dependencies from EPEL (see below) but I am getting errors when connecting to the camera:

ERROR:0@5.536] global cap_ffmpeg_impl.hpp:1309 open Could not open codec libopenh264, error: -1313558101
[ERROR:0@5.536] global cap_ffmpeg_impl.hpp:1317 open VIDEOIO/FFMPEG: Failed to initialize VideoCapture
[ WARN:0@5.619] global cap_gstreamer.cpp:2823 handleMessage OpenCV | GStreamer warning: your GStreamer installation is missing a required plugin: Real Time Streaming Protocol (RTSP) source
[ WARN:0@5.619] global cap_gstreamer.cpp:2839 handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module uridecodebin0 reported: No URI handler implemented for "rtsp".
[ WARN:0@5.619] global cap_gstreamer.cpp:1698 open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0@5.620] global cap_gstreamer.cpp:1173 isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created

rpm -qi python3-opencv
Name        : python3-opencv
Version     : 4.10.0
Release     : 8.el10_0
Architecture: aarch64
Install Date: Tue 04 Nov 2025 06:06:33 PM UTC
Group       : Unspecified
Size        : 9702815
License     : BSD-3-Clause AND Apache-2.0 AND ISC
Signature   : RSA/SHA256, Sat 22 Mar 2025 10:43:27 AM UTC, Key ID 33d98517e37ed158
Source RPM  : opencv-4.10.0-8.el10_0.src.rpm
Build Date  : Fri 21 Mar 2025 09:16:50 PM UTC
Build Host  : buildhw-a64-05.iad2.fedoraproject.org
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : https://opencv.org
Bug URL     : 
Summary     : Python3 bindings for apps which use OpenCV
Description :
This package contains Python3 bindings for the OpenCV library.



Is there a missing package I can install to fix this? Ive previously run this program on Debian without issue so I know the program is not at fault.

Thanks

Not sure if it is needed but have you tried to install gstreamer1-rtsp-server.x86_64

Note that there are also plugins ‘rtsp’ and ‘rtspsrc’.

gstreamer1-rtsp-server did not work

do you know what the package names are for these struggling to find them?

Very easy to find out, since we know gstreamer is the key part, then you can check what gstreamer packages are available to install. You’ll then see from that a load of ones mentioning gstreamer1-plugins. Since RTSP no doubt is a plugin, would be why the server package didn’t help, since that would be if you want to run your own RTSP server. If you are looking to connect to a RTSP server, or playback RTSP, then that would be the plugin.

Based on my example below, we can check what is included in a package by listing it’s contents, and then grepping/filtering for certain phrases, like rtsp:

[root@rkelb ~]# dnf repoquery -l gstreamer1-plugins-good | grep -i rtsp
/usr/lib64/gstreamer-1.0/libgstrtsp.so

it would therefore potentially suggest that package is a place to start, eg: dnf install gstreamer1-plugins-good. Failing that, you can then repeat the repoquery command against all remaining gstreamer packages:

[root@rkelb ~]# dnf list *gstreamer*
Available Packages
PackageKit-gstreamer-plugin.x86_64                                1.2.8-8.el10                                 appstream
gstreamer1.x86_64                                                 1.24.11-1.el10                               appstream
gstreamer1-devel.x86_64                                           1.24.11-1.el10                               appstream
gstreamer1-plugins-bad-free.x86_64                                1.24.11-2.el10_0                             appstream
gstreamer1-plugins-bad-free-devel.x86_64                          1.24.11-2.el10_0                             crb      
gstreamer1-plugins-bad-free-libs.x86_64                           1.24.11-2.el10_0                             appstream
gstreamer1-plugins-base.x86_64                                    1.24.11-1.el10                               appstream
gstreamer1-plugins-base-devel.x86_64                              1.24.11-1.el10                               appstream
gstreamer1-plugins-base-tools.x86_64                              1.24.11-1.el10                               appstream
gstreamer1-plugins-good.x86_64                                    1.24.11-1.el10                               appstream
gstreamer1-plugins-good-gtk.x86_64                                1.24.11-1.el10                               appstream
gstreamer1-plugins-ugly-free.x86_64                               1.24.11-1.el10                               appstream
gstreamer1-rtsp-server.x86_64                                     1.24.11-1.el10                               appstream
gstreamer1-svt-av1.x86_64                                         2.3.0-1.el10_0                               epel     
libcamera-gstreamer.x86_64                                        0.3.2-3.el10_0                               appstream
libnice-gstreamer1.x86_64                                         0.1.22-7.el10_0                              epel     
pipewire-gstreamer.x86_64                                         1.2.7-1.el10                                 appstream
vlc-plugin-gstreamer.x86_64                                       1:3.0.21-16.el10_0                           epel

of which there are quite a few.

You can also check to see if it’s already there

gst-inspect-1.0 rtsp

Thanks thats got RTSP working although its telling me H264 codec plugin missing. Ive installed gstreamer1-plugins-good, bad & ugly but i cant get it going.

[libopenh264 @ 0x5555e38355a0] Unable to create decoder
[libopenh264 @ 0x5555e38355a0] Unable to create decoder
[libopenh264 @ 0x5555e3834e50] Unable to create decoder
[ERROR:0@5.591] global cap_ffmpeg_impl.hpp:1309 open Could not open codec libopenh264, error: -1313558101


Where do i find the codecs for H.264, H.265, AV1, VP9, AAC, AV1 & Opus please?

dnf repoquery --repo "epel-cisco-openh264" "*"
dnf repoquery --provides  openh264
root@rocky9:~# dnf list *264*
Available Packages
gstreamer1-plugin-openh264.x86_64                     1.18.2-1.el9                                   epel-cisco-openh264
mozilla-openh264.x86_64                               2.3.1-1.el9                                    epel-cisco-openh264
noopenh264.x86_64                                     0.1.0~openh264_2.4.1-2.el9                     epel               
noopenh264-devel.x86_64                               0.1.0~openh264_2.4.1-2.el9                     epel               
openh264.x86_64                                       2.3.1-1.el9                                    epel-cisco-openh264
openh264-devel.x86_64                                 2.3.1-1.el9                                    epel-cisco-openh264```

I dont know whether its possibly because Im on an ARM64 platform but Im getting not found for openh264 whatever I try. Thanks for help everyone.

It’s possible if nobody built them. On Fedora 43 for example on my RPI4:

root@rpi4:~# dnf list *264*
Updating and loading repositories:
 Fedora 43 - aarch64 - Updates                                                  100% |   1.0 KiB/s |   6.4 KiB |  00m06s
Repositories loaded.
Installed packages
mozilla-openh264.aarch64           2.6.0-2.fc43  fedora-cisco-openh264
openh264.aarch64                   2.6.0-2.fc43  fedora-cisco-openh264

Available packages
gstreamer1-plugin-openh264.aarch64 1.26.7-1.fc43 updates
mozilla-openh264-debuginfo.aarch64 2.6.0-2.fc43  fedora-cisco-openh264
noopenh264.aarch64                 2.6.0-2.fc43  fedora
noopenh264-devel.aarch64           2.6.0-2.fc43  fedora
openh264-debuginfo.aarch64         2.6.0-2.fc43  fedora-cisco-openh264
openh264-debugsource.aarch64       2.6.0-2.fc43  fedora-cisco-openh264
openh264-devel.aarch64             2.6.0-2.fc43  fedora-cisco-openh264

so if nothing for Rocky 10, try Fedora maybe? Either that or you can download source rpm from Fedora and build it with mock on aarch64 and then use it. Or perhaps request EPEL package the above h264 packages for aarch64.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.