Install GStreamer SRT plugin on macOS
Today I was working on a project that uses GStreamer and reads content using the SRT protocol on my macOS. The SRT elements could not be found in my system after installing GStreamer using Homebrew. I’ve installed all the GStreamer sub-packages from Homebrew.
$ brew install gstreamer gst-plugins-base \ gst-plugins-good gst-plugins-bad \ gst-plugins-ugly gst-libav \ gst-rtsp-server gst-editing-services
Still, I could not find the
strsrc element, for example.
$ gst-launch-1.0 -v srtsrc uri="srt://127.0.0.1:7001" ! fakesink WARNING: erroneous pipeline: no element "srtsrc"
For some reason, not clear to me at the time, I did not have the plugin installed. This triggered me to look at the source code of GStreamer to find how the element is enabled. I know that GStreamer contains many plugins that depend on different third-party libraries. The SRT set of elements, resides in the
gst-plugins-bad bundle. Then it was clear to me that the SRT elements are only compiled if the libsrt is available in the host system at compilation time.
Ok, now I know what might be causing the SRT plugin to not be available on my GStreamer’s brew installation. In order to confirm that, I checked the Homebrew formula for its dependencies.
As I was guessing, libsrt is not a dependency of that formula. This means that the meson configuration we saw earlier is not letting the SRT plugin in the compilation process.
We need to modify the
gst-plugins-bad formula locally and then install from source.
First, we uninstall the
$ brew rm gst-plugins-bad
Then we can edit our local formula to add the
libsrt dependency. This is not strictly required, as we could just install libsrt manually and then recompile from source. But we will add here anyway, so we make sure we will not override this next time the package update. The following command will open your default editor as defined in the
EDITOR environment variable.
$ brew edit gst-plugins-bad
Add the line below to the dependency list:
We now install the package from source.
$ brew reinstall --build-from-source gst-plugins-bad
That's it. Now you should have the SRT plugin installed and all its elements will be available in your system. We can double-check that by inspecting the one element, like the
$ gst-inspect-1.0 srtsrc
You should see something like:
Yay! That is it. Now I can continue my work and have all the SRT elements available on my macOS GStreamer installation from Homebrew.
The icons used by this site can be found at Hacker icons created by Freepik - Flaticon.