Gstreamer string parsing question re: "gst_uri_is_valid"

So my test code is as follows:

#include <stdio.h>
#include <glib.h>
#include <gst/gst.h>

int main(int argc, char *argv[]) {
	g_autoptr(GstElement) pipeline = NULL;
...
	pipeline = gst_parse_launch(
			"nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1' ! nvv4l2h265enc bitrate=8000000 ! h265parse ! qtmux ! filesink location=test.mp4",
			&pipeline_error);

	if (pipeline_error) {
		g_error("%s", pipeline_error->message);
	}
...
	// cleanly shut down the pipeline
	gst_element_set_state(pipeline, GST_STATE_NULL);
	return 0;
}

I’m currently getting this when I run it:

(birbcam:12866): GStreamer-CRITICAL **: 15:29:33.737: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed

** (birbcam:12866): ERROR **: 15:29:33.745: syntax error
Trace/breakpoint trap (core dumped)

Eventually, I’m hoping to add elements to the pipeline to detect birds and other wildlife, but first I want a simple example that records video to a file in an accelerated manner. The string i’m using works fine at the command line with gst-launch-1.0 and is cut and pasted out of the accelerated gstreamer guide.

I’ve build pipelines manually in gstreamer by creating the elements and stitching them together with gst_bin_add_many. This is the first time i’ve used gst_parse_launch and I suspect the string within is where I have made the mistake. I will probably figure it out eventually (i did), but I would appreciate any help if anybody is more familiar with the gstreamer framework in C/C++ (i have a version in gstreamermm as well). Fwiw I get the same error in that version of the program. It doesn’t seem to like that string.

Edit: I managed. The corrected version is :

pipeline = gst_parse_launch(
			"nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1 ! nvv4l2h265enc bitrate=8000000 ! h265parse ! qtmux ! filesink location=test.mp4",
			&pipeline_error);

The solution was to remove the single quotes. It works and writes a mp4 with h265 in it from the camera, yay. Now all I need is DeepStream and I can detect all of hte birbs.

Edit: and it works in gstreamermm too!

5 Likes

Thanks for sharing the solution.

1 Like

Same error appears using escaped double quotes, too. Removing them worked as in your example. Thanks.

Hi
I am trying to do same thing for rtmp streaming using below command,

pipeline = gst_parse_launch (“gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! ‘video/x-raw(memory:NVMM),width=(int)1920,height=(int)1080,framerate=16/1’ ! omxh264enc profile=8 bitrate=1000000 ! video/x-h264 ! h264parse ! flvmux ! rtmpsink location=rtmp://URL”, NULL);

I am able to run this command on terminal but when integrated it in c code facing error : "**(Գ>h�:14723): GStreamer-CRITICAL : 21:31:54.112: gst_element_make_from_uri: assertion ‘gst_uri_is_valid (uri)’ failed
"
Can someone help here to resolve this ?

thanks.

Hi Ar_24,

Please help to open a new topic. Thanks