Using gstappsrc with nvv4l2h264enc

I have a program which starts an RTP stream using the following pipeline:
appsrc → videoconvert → x264enc → h264parse → h264pay → udpsink.

My appsrc properties are set using the following code:

  g_object_set (G_OBJECT (app->src),
                "caps", gst_caps_new_simple ("video/x-raw",
                                             "format", G_TYPE_STRING, "RGB",
                                             "width", G_TYPE_INT, WIDTH,
                                             "height", G_TYPE_INT, HEIGHT,
                                             "framerate", GST_TYPE_FRACTION, 0, 1,
                                             nullptr),
                "stream-type", 0, // GST_APP_STREAM_TYPE_STREAM
                "format", GST_FORMAT_TIME,
                "is-live", true,
                "do-timestamp", true,
                "min-latency", 0,
                "max-latency", 100000,
                nullptr);

How can I change this pipeline to work on the jetson nano? I have tried using nvv4l2h264enc as the encoder and nvvidconv as the videoconverter but get linking errors.

You would try:

appsrc ! video/x-raw,format=RGB ! videoconvert ! video/x-raw,format=RGBA ! nvvidconv ! nvv4l2h264enc ! h264parse ! rtph264pay ! udpsink 

It works even without the capsfilter. Also I have now learned that I can use gst-launch with things like appsink and appsrc to see if linking works. Thank you!

You are correct that it can check if linking the plugins is ok.
However:

  • appsrc wouldn’t push any frame so the pipeline wont’t run
  • appsink wouldn’t consume and release frames, so you may see increasing used memory as running it

Linking is mandatory, but performance is another step further.
videoconvert plugin is a CPU implementation, and can result in significant CPU usage for high pixel rates.
So better keep its task lite just adding an extra byte to BGRx or RGBA.
NV12 might be chosen instead resulting in much higher CPU usage and therefore limiting framerate.

Additional details: for easier use on receiver side, add these properties to nvv4l2h264enc:

... ! nvv4l2h264enc insert-sps-pps=1 insert-vui=1 ! ...