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!