Adding a built plugin to library


I’ve been using a capture card with GStreamer using the AJA plugin (GitHub - centricular/gst-aja: GStreamer plugin for AJA capture/output cards) with Ubuntu 24 and GStreamer 1.24.

I built the plugin from source and to use it I use this command from terminal (this command displays just fine):

gst-launch-1.0 --gst-plugin-path=/home/neuro/Documents/gst-aja ajasrc ! \
    videoconvert ! autovideosink

Is there a way to add the plugin to the gst library without having to call --gst-plugin-path?

Perhaps a folder I can put the build file in?

The reason being it’s not working with opencv I think this may be the issue.

gst_string = "ajasrc --gst-plugin-path=/home/neuro/Documents/gst-aja!\
                videoconvert ! \
                video/x-raw,format=BGR ! \
vid = cv2.VideoCapture(gst_string, cv2.CAP_GSTREAMER)

Output from OpenCV:

(python:16581): GStreamer-CRITICAL **: 17:47:33.508: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed

(python:16581): GStreamer-CRITICAL **: 17:47:33.508: gst_structure_get_int: assertion 'structure != NULL' failed
[ WARN:0@30.053] global cap_gstreamer.cpp:1714 open OpenCV | GStreamer warning: cannot query video width/height

(python:16581): GStreamer-CRITICAL **: 17:47:33.508: gst_structure_get_fraction: assertion 'structure != NULL' failed
[ WARN:0@30.053] global cap_gstreamer.cpp:1722 open OpenCV | GStreamer warning: cannot query video fps
[ WARN:0@30.053] global cap_gstreamer.cpp:1777 open OpenCV | GStreamer warning: Cannot query video position: status=0, value=-1, duration=-1

You could use the GST_PLUGIN_PATH environment variable, or the GstRegistry / GstPlugin API. Passing --blabla parameters like this to OpenCV is not going to work.

Amazing, worked like a charm! Thank you very much.

For those wondering use it like this:

GST_PLUGIN_PATH=/path/to/plugin/ python3

and the remove the --gst-plugin-path= from the pipeline string.