New Features for nvivafilter

Hi Folks,

After using the filter plugin with my cuda filter I can now see new features that would be great to have in a future release.

  1. Ability to pass properties to the user’s custom cuda filter. In my case I need to make real-time adjustments based upon user input which would turn into property updates.
  2. Allow pre and post processing to be done once for the life of the filter or for every frame. In my case I don’t want it done more than once for the lifetime of the filter.




Is it possible to create the properties in init() and destroy it in deinit(). init() and deinit() functions should allow you maintain custom properties.

We also have pre_process() and post_process(). Could you leverage the two functions?

Please share your current gstreamer pipeline and what propertiesyou would like to pass into nvivafilter. It looks like we may be able to leverage GstMeta. Need more detail about the usecase so that we can discuss further.


    Here is the current list of properties.

    g_object_class_install_property (gobject_class, PROP_SILENT,
                    g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?",
                                    FALSE, G_PARAM_READWRITE));
    g_object_class_install_property (gobject_class, PROP_BYPASS_ON,
                    g_param_spec_boolean ("bypasson", "Bypass on", "Enable/Disable eeColor processing ?",
                                    FALSE, G_PARAM_READWRITE));
    g_object_class_install_property (gobject_class, PROP_TABLE_LOCATION,
                    g_param_spec_string ("tablelocation", "Table location", "Path to table ?",
                                    "UNKNOWN", G_PARAM_READWRITE));
    g_object_class_install_property (gobject_class, PROP_TABLE_NAME,
                    g_param_spec_string ("tablename", "Table name", "Name to identify the table",
                                    "UNKNOWN", G_PARAM_READABLE));
    g_object_class_install_property (gobject_class, PROP_TABLE_TYPE,
                    g_param_spec_string ("tabletype", "Table type", "Type of the table",
                                    "UNKNOWN", G_PARAM_READABLE));
    g_object_class_install_property (gobject_class, PROP_TABLE_ACTION,
                    g_param_spec_string ("tableaction", "Table action", "Action to perform(LOAD,UNLOAD,RELOAD)",
                                    "UNKNOWN", G_PARAM_READWRITE));
    g_object_class_install_property (gobject_class, PROP_SYSLOG_ON,
                    g_param_spec_boolean ("syslogon", "Syslog on", "Enable/Disabe Syslog ?",
                                    FALSE, G_PARAM_READWRITE));

g_object_class_install_property (gobject_class, PROP_DEM)_MODE,
g_param_spec_string (“demomode”, “Demo Mode”, “Demo mode to use”,

Here is the pipeline.

I was unable to add the pipeline image. How do I load images into this document. Thanks.

It might not be easy for us to put custom properties in nvivafilter. Is it possible to use global variables in your usecase?

For example, please put the variable in

int property_test = 0;

add print in gpu_process():

printf("property = %d \n", property_test);

and you can set it in gstreamer app:

#include <cstdlib>
#include <cstring>
#include <sstream>
#include <gst/gst.h>

using namespace std;

#define USE(x) ((void)(x))

static GstPipeline *gst_pipeline = nullptr;
static string launch_string;

GstClockTime usec = 1000000;
static int w = 1920;
static int h = 1080;

<b>extern int property_test;</b>

int main(int argc, char** argv) {

    gst_init (&argc, &argv);

    GMainLoop *main_loop;
    main_loop = g_main_loop_new (NULL, FALSE);
    ostringstream launch_stream;

    << "videotestsrc name=mysource ! "
    << "video/x-raw,width="<< w <<",height="<< h <<",framerate=30/1,format=NV12 ! "
    << "nvvidconv ! video/x-raw(memory:NVMM),format=NV12 ! "
    << "nvivafilter cuda-process=true ! "
    << "video/x-raw(memory:NVMM), format=(string)RGBA ! "
    << "nvoverlaysink ";

    launch_string = launch_stream.str();

    g_print("Using launch string: %s\n", launch_string.c_str());

    GError *error = nullptr;
    gst_pipeline  = (GstPipeline*) gst_parse_launch(launch_string.c_str(), &error);

    if (gst_pipeline == nullptr) {
        g_print( "Failed to parse launch: %s\n", error->message);
        return -1;
    if(error) g_error_free(error);

    gst_element_set_state((GstElement*)gst_pipeline, GST_STATE_PLAYING); 


    GstElement* src = gst_bin_get_by_name(GST_BIN(gst_pipeline), "mysource");
    gst_element_send_event (src, gst_event_new_eos ());
    // Wait for EOS message
    GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(gst_pipeline));
    gst_bus_poll(bus, GST_MESSAGE_EOS, GST_CLOCK_TIME_NONE);

    gst_element_set_state((GstElement*)gst_pipeline, GST_STATE_NULL);

    g_print("going to exit \n");
    return 0;

Build command:

$ g++ -Wall -std=c++11  test.cpp -o test $(pkg-config --cflags --libs gstreamer-app-1.0) -L/usr/lib/aarch64-linux-gnu/ -lnvsample_cudaprocess

In this demo, you should be able to set properties in app and get update value in gpu_process().

Hi Dane,

This worked great using the extern variables. Thanks.



I am facing a similar issue, and also was approaching using extern.

But I was looking for a more elegant solution, I see in the nvsample_cudaprocess functions the param

  • @param userPtr : point to user alloc data, should be free by user

What is the purpose of this param ?

To pass data from application level? If yes, how?

Thanks for any hints

HI MMontel,

I haven’t followed through with seeing if I can use userPtr. If you do please let me know.
The external variables solution worked find for me.

Thanks for reply, maybe somebody from Nvidia can give a hint? I couldn’t find any documentation about its usage.
If there is a common way other than using extern, please let me know, thanks!

userPtr is for private usage. Please follow #8

Ok thanks