URIDECODEBIN and AppSrc together

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) :- Orin NX
• DeepStream Version :- 7.0

I am working on deepstream-test3 app. I modified that by adding an appsrc element. so there are two branches in the pipeline now.
The pipeline looks something like this.


AppSrc -> Jpegparse -> nvv4l2decoder -> streammux ->   
                                                    | -> streammux -> nvinfer -> . . . 
                                      Uridecodebin ->

My question is, is it possible to integrate two sources, one which uses URIdecodebin and another that uses appsrc.
I know that It works on multiple URIdecodebin sources. never tried Uridecodebin + Appsrc combination before and hence asking.

thanks.

please remove the first streammux. there is no limitation to source type. you can use Uridecodebin + Appsrc at the same time.

Sorry, Actually i was doing exactly what you are telling, there is only one streammux. But at a time only one stream is getting( only from appsrc or only from uridecodebin). I checked by accessing the sink pads of streammux, only one pad is recieving data at a time.
But the read_data function to get data by appsrc is also calling and i am getting log from read_data function when streammux receives data from uridecodebin.

  1. if the two source are connecting to nvstremmux, there will be two sink pads. you can two probe functions on nvstreammux 's sink_0 and sink_1 respectively. then you can add logs in the probe functions to check.
  2. if there are two sources, you need to set nvstreammux’s batch-size to 2.

“”“static GstPadProbeReturn
mux_probe_cb(GstPad *pad, GstPadProbeInfo *info, gpointer user_data) {
GstBuffer *buffer = GST_PAD_PROBE_INFO_BUFFER(info);
const gchar *pad_name = gst_pad_get_name(pad);
g_print(“Buffer received on muxer pad: %s\n”, pad_name);
return GST_PAD_PROBE_OK;
}”“”

This is the function i wrote for checking which sink pad is recieving the data at streammux.

“”"for (i = 1; i < 2; i++) {
GstPad *sinkpad, *srcpad;
GstElement *source_bin;
gchar pad_name[16] = {};
if (is_nvinfer_server) {
source_bin = create_source_bin(
i, “rtsp://admin:admin123@192.168.134.218:554/1/1”, &gpu_id);
} else {
source_bin = create_source_bin(
i, “rtsp://admin:admin123@192.168.134.218:554/1/1”, &gpu_id);
}

if (!source_bin) {
  g_printerr("Failed to create source bin. Exiting.\n");
  return -1;
}

gst_bin_add(GST_BIN(pipeline), source_bin);

g_snprintf(pad_name, 15, "sink_%u", i);
sinkpad = gst_element_request_pad_simple(streammux, pad_name);
if (!sinkpad) {
  g_printerr("Streammux request sink pad failed. Exiting.\n");
  return -1;
}
gst_pad_add_probe(sinkpad, GST_PAD_PROBE_TYPE_BUFFER, mux_probe_cb, NULL, NULL);

srcpad = gst_element_get_static_pad(source_bin, "src");
if (!srcpad) {
  g_printerr("Failed to get src pad of source bin. Exiting.\n");
  return -1;
}

if (gst_pad_link(srcpad, sinkpad) != GST_PAD_LINK_OK) {
  g_printerr("Failed to link source bin to stream muxer. Exiting.\n");
  return -1;
}

gst_object_unref(srcpad);
gst_object_unref(sinkpad);

}“”"

First , here i called the function at the sink pad connecting uridocebin src

“”" gchar pad_name_sink[16] = “sink_0”;
gchar pad_name_src[16] = “src”;
GstPad *sinkpad, *srcpad;

sinkpad = gst_element_request_pad_simple(streammux, pad_name_sink);
if (!sinkpad) {
g_printerr(“Streammux request sink pad failed. Exiting.\n”);
return -1;
}
gst_pad_add_probe(sinkpad, GST_PAD_PROBE_TYPE_BUFFER, mux_probe_cb, NULL, NULL); “”"

Second i called the function where the appsrc getting conneced to the sink pad of the stream mux.

“”“” if (!use_new_mux) {
g_object_set(G_OBJECT(streammux), “width”, MUXER_OUTPUT_WIDTH, “height”,
MUXER_OUTPUT_HEIGHT, “batch-size”, 2, “live-source”, TRUE,
“batched-push-timeout”, MUXER_BATCH_TIMEOUT_USEC, “gpu-id”,
gpu_id, NULL);
} else {
g_object_set(G_OBJECT(streammux), “batch-size”, 2, “batched-push-timeout”,
MUXER_BATCH_TIMEOUT_USEC, NULL);“”“”

This is how i set teh properties of the streammux.

Please check.

you need to add a probe function mux_probe_cb1 on sink_1 of nvstreammux.

“”"for (i = 1; i < 2; i++) {
GstPad *sinkpad, *srcpad;
GstElement *source_bin;
gchar pad_name[16] = {};
if (is_nvinfer_server) {
source_bin = create_source_bin(
i, “rtsp://admin:admin123@192.168.134.218:554/1/1”, &gpu_id);
} else {
source_bin = create_source_bin(
i, “rtsp://admin:admin123@192.168.134.218:554/1/1”, &gpu_id);
}

if (!source_bin) {
  g_printerr("Failed to create source bin. Exiting.\n");
  return -1;
}

gst_bin_add(GST_BIN(pipeline), source_bin);

g_snprintf(pad_name, 15, "sink_%u", i);
sinkpad = gst_element_request_pad_simple(streammux, pad_name);
if (!sinkpad) {
  g_printerr("Streammux request sink pad failed. Exiting.\n");
  return -1;
}
gst_pad_add_probe(sinkpad, GST_PAD_PROBE_TYPE_BUFFER, mux_probe_cb, NULL, NULL);""" 

Added the probe to sink_1 also here.

only one sink is receiving data(either sink_0 or sink_1). and that data i am able to view using osd.

Sorry for the late reply, Is this still an DeepStream issue to support? Thanks! please make sure the pipeline with either source can run well. please refer to deepstream-appsrc-test which already supports appsrc. you only need to add Uridecodebin.

yes.okay i will try by refering deepstream-appsrc-test. thanks

Sorry for the late reply, Is this still an DeepStream issue to support? Thanks!

Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 261
NvMMLiteBlockCreate : Block : BlockType = 261
Frame Number = 8 Number of objects = 0 Vehicle Count = 0 Person Count = 0 PTS = 0:00:00.000000000
Frame Number = 9 Number of objects = 0 Vehicle Count = 0 Person Count = 0 PTS = 0:00:00.000000000
ERROR from element stream-muxer: Input Output Color Format Mismatch
Error details: /dvs/git/dirty/git-master_linux/deepstream/sdk/src/gst-plugins/gst-nvmultistream/gstnvstreammux.cpp(1468): gst_nvstreammux_sink_event (): /GstPipeline:dstest-appsrc-pipeline/GstNvStreamMux:stream-muxer
Returned, stopping playback
Deleting pipeline

I am currently facing this issue. I build the pipeline as you told

it means the input format of nvstreammux is different with output format. I suggest using the following debug steps.

  1. make sure the pipeline with appsrc can work.
  2. disable appsrc, make sure the pipeline with Uridecodebin can work.
  3. debug the pipeline with appsrc and Uridecodebin .

There is no update from you for a period, assuming this is not an issue anymore. Hence we are closing this topic. If need further support, please open a new one. Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.