Jetson TX2 + Gstreamer + C++

Hi to everybody,

Here is the question: i do have simple gstreamer pipeline

gst-launch-1.0 nvarguscamerasrc ! “video/x-raw(memory:NVMM), width=(int)1280, height=(int)720” ! nvvidconv ! nvoverlaysink overlay-w=640 overlay-h=480 and it’s works just fine (al least as expected)

BUT when i try to implement the same pipeline in C++ (all error checks are removed due no minimaze source size)

    [i]GstElement * pCameraSource = gst_element_factory_make("nvarguscamerasrc",  "src");

    GstCaps * pSrcCaps = gst_caps_new_simple ("video/x-raw(memory:NVMM)",
          "width", G_TYPE_STRING, "(int)1280",
          "height", G_TYPE_STRING, "(int)720",
          NULL);
    GstElement * pVidConverter = gst_element_factory_make("nvvidconv", "converter");

    GstElement * pSink		   = gst_element_factory_make("nvoverlaysink", "sink");

(1) g_object_set(pSink, “overlay-w”,640, NULL);
(2) g_object_set(pSink, “overlay-h”,480, NULL);

ProgramData * pData 	   = NULL;

gst_bin_add_many(GST_BIN(m_pGSTPipeline), pCameraSource, pVidConverter, pSink, NULL);

    gst_element_link_filtered(pCameraSource, pVidConverter, pSrcCaps);

gst_element_link_filtered(pVidConverter, pSink, gst_caps_new_simple("video/x-raw(memory:NVMM", "format","(string)I420" , NULL));

//Start pipeline
GstStateChangeReturn ret = gst_element_set_state(m_pGSTPipeline, GST_STATE_PLAYING);[/i]

i have almost the same result (without strings (1)(2)) except a couple of things:First one is that stream size are not 1280/720 (size is 2592/1458). Second one is that with strings (1)(2) (set nvoverlaysink properties as i presume) nothing works at all (no onscreen output).It looks like params simply are not passed to GstElements or passed incorrectly.

Due to bash command correct output it is clear that i do something wrong/incorrect.
Can somebody provide information/advice for “how to reach the same result”? or perhaps suggest some information source as to start with?

Tnx

Hi,
Here is a sample of launching gstreamer pipeline. FYR.

Hi,

Probably i described my question not clearly
parse from string is a well known/common way to construct gstreamer pipeline BUT i need to construct it from GstElement’s with proper properties and media formats applied between them (as long as string parse is available it should be possible too)

tnx

UPD:
found similar problem https://devtalk.nvidia.com/default/topic/934515/jetson-tk1/using-x-raw-memory-nvmm-in-gstreamer-program/ it looks like nothing changed since TK1, get_caps_from_string still works just fine but gst_caps_new_simple ("video/x-raw(memory:NVMM) cause an GStreamer-CRITICAL

Hi,
Please also refer to source of nvgstcapture-1.0( nvgstapps_src.tbz2 )
https://developer.nvidia.com/embedded/dlc/r32-2-1_Release_v1.0/TX2-AGX/sources/public_sources.tbz2

Also need to call gst_caps_features_new():

caps =
gst_caps_new_simple ("video/x-raw", "format", G_TYPE_STRING, str_color,
    "width", G_TYPE_INT, width, "height", G_TYPE_INT, height, "framerate",
    GST_TYPE_FRACTION, NVGST_DEFAULT_CAPTURE_FPS, 1, NULL);

feature = gst_caps_features_new ("memory:NVMM", NULL);
gst_caps_set_features (caps, 0, feature);
1 Like

Hi DaneLLL

Thanks for the source link, gst_caps_feature_new did the trick (haven’t met this approach nor in the forum not in the gstreamer tutorials (https://gstreamer.freedesktop.org/documentation/tutorials/index.html?gi-language=c)

I think now topic is difinetly might be closed as it’s solved.
thanks again.