DeepStream Transformation Failed

• Hardware Platform (Jetson / GPU)
GPU
• DeepStream Version
6.2
• NVIDIA GPU Driver Version (valid for GPU only)
525.125.06
• Issue Type( questions, new requirements, bugs)
Bugs
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)

I have a problem with Transformation Failed -1 error in DeepStream. I have added reconnecting to http sources as done in this topic. The reconnect seems to be working with one source as intended, however the problem occurs when I use more than one source.
I attached the logs from the command - DBG_NVBUFSURFTRANSFORM=1 ./deepstream-app -c "your_config" > log.log 2>&1
log.log (6.4 MB)

Additionally here are the DeepStream logs from another run where the problem occurred again in Debug mode:

**PERF:  29.66 (31.33)  29.86 (31.79)
nvstreammux: Successfully handled EOS for source_id=0
**PERF:  29.40 (30.86)  30.28 (31.50)
**PERF:  0.00 (25.62)   30.05 (31.25)
**PERF:  0.00 (21.90)   30.07 (31.06)
**PERF:  0.00 (19.13)   30.03 (30.95)
**PERF:  0.00 (16.98)   30.05 (30.85)
**PERF:  0.00 (15.26)   30.04 (30.76)
**PERF:  0.00 (13.86)   30.06 (30.71)
**PERF:  0.00 (12.69)   30.06 (30.65)
**PERF:  0.00 (11.71)   30.06 (30.60)
**PERF:  0.00 (10.87)   30.07 (30.56)
**PERF:  0.00 (10.14)   30.05 (30.53)
**PERF:  0.00 (9.50)    30.05 (30.50)
**PERF:  0.00 (8.94)    30.06 (30.47)
** WARN: <watch_source_status:758>: No data from source 0 since last 60 sec. Trying reconnection
** INFO: <reset_source_pipeline:1746>: Resetting source 0
ERROR from source: Could not establish connection to server.
Debug info: gstsouphttpsrc.c(1376): gst_soup_http_src_parse_status (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin0/GstURIDecodeBin:src_elem/GstSoupHTTPSrc:source:
Could not connect: Connection refused (4), URL: http://192.168.60.95:8000/camera/mjpeg, Redirect to: (NULL)
ERROR from source: Internal data stream error.
Debug info: gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin0/GstURIDecodeBin:src_elem/GstSoupHTTPSrc:source:
streaming stopped, reason error (-5)
ERROR from typefindelement2: Stream doesn't contain enough data.
Debug info: gsttypefindelement.c(986): gst_type_find_element_chain_do_typefinding (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin0/GstURIDecodeBin:src_elem/GstTypeFindElement:typefindelement2:
Can't typefind stream
**PERF:  0.00 (8.44)    24.86 (30.15)
**PERF:  0.00 (7.99)    24.52 (29.86)
nvbufsurftransform.cpp:3424: => Transformation Failed -1

ERROR from source: Internal data stream error.
Debug info: gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin1/GstURIDecodeBin:src_elem/GstSoupHTTPSrc:source:
streaming stopped, reason error (-5)
** INFO: <reset_source_pipeline:1746>: Resetting source 1

(deepstream-app:8287): GLib-GObject-WARNING **: 12:41:14.230: g_object_set_is_valid_property: object class 'GstNvJpegDec' has no property named 'DeepStream'
Using GPU 0 (NVIDIA GeForce RTX 3050, 20 SMs, 1536 th/SM max, CC 8.6, ECC off)

**PERF:  FPS 0 (Avg)    FPS 1 (Avg)
**PERF:  0.00 (7.59)    18.32 (29.28)
nvbufsurftransform.cpp:3424: => Transformation Failed -1

ERROR from source: Internal data stream error.
Debug info: gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin1/GstURIDecodeBin:src_elem/GstSoupHTTPSrc:source:
streaming stopped, reason error (-5)
** INFO: <reset_source_pipeline:1746>: Resetting source 1

(deepstream-app:8287): GLib-GObject-WARNING **: 12:41:20.024: g_object_set_is_valid_property: object class 'GstNvJpegDec' has no property named 'DeepStream'
Using GPU 0 (NVIDIA GeForce RTX 3050, 20 SMs, 1536 th/SM max, CC 8.6, ECC off)
**PERF:  0.00 (7.23)    18.33 (28.75)
Cuda failure: status=1 in cuResData at line 339
nvbufsurftransform.cpp:3424: => Transformation Failed -1

nvbufsurftransform.cpp(3837) : getLastCudaError() CUDA error : Recevied NvBufSurfTransformError_Execution_Error : (1) invalid argument.
ERROR: nvdsinfer_context_impl.cpp:339 Failed to make stream wait on event, cuda err_no:709, err_str:cudaErrorContextIsDestroyed
ERROR: nvdsinfer_context_impl.cpp:1625 Preprocessor transform input data failed., nvinfer error:NVDSINFER_CUDA_ERROR
0:01:54.158147625  8287 0x555556101400 WARN                 nvinfer gstnvinfer.cpp:1388:gst_nvinfer_input_queue_loop:<primary_gie> error: Failed to queue input batch for inferencing

Thank you in advance!

I analyzed the error log and guessed that the problem was caused by a failed reconnection.

Is 192.168.60.95 still online when reconnecting?

In addition, you can view the logs of httpsrc use the following command line.

GST_DEBUG_NO_COLOR=1 GST_DEBUG=3,souphttpsrc:7 ./deepstream-app -c "your_config" > log.log 2>&1

When reconnecting, try to ignore the related errors, I’m not sure if it will work properly for http

        if (!subBin->reconfiguring ||
            g_strrstr (debuginfo, "500 (Internal Server Error)")) {
          subBin->reconfiguring = TRUE;
          g_timeout_add (0, reset_source_pipeline, subBin);
        }

@junshengy 192.168.60.95 is offline when reconnecting. If it’s online then the reconnect does work.
Also I have noticed that if the other source is offline while trying to reconnect, then the FPS drops for the other source which is online and I think the other source generates these Transformation Failed -1 errors and it then logs for e.g. Resetting source 1 which is actually online at that moment.

Here are the logs for GST_DEBUG_NO_COLOR=1 GST_DEBUG=3,souphttpsrc:7 ./deepstream-app -c "your_config" > log.log 2>&1
log.log (66.8 MB)

I tried adding:

if (!subBin->reconfiguring ||
            g_strrstr (debuginfo, "500 (Internal Server Error)") || g_strrstr (debuginfo, "Internal data stream error")) {
          subBin->reconfiguring = TRUE;
          g_timeout_add (0, reset_source_pipeline, subBin);
        }

But I’m not sure if that’s correct.

1.Reconnecting requires stopping the pipeline and then restarting it, so the fps of the active source will also drop.

I guess the reconnection failure caused the transform error. Try modify error check code like this.

g_strrstr (debuginfo, "Could not establish connection to server")

@junshengy I have added your suggested error:

if (!subBin->reconfiguring ||
            g_strrstr (debuginfo, "500 (Internal Server Error)") || g_strrstr (debuginfo, "Internal data stream error.") || g_strrstr (debuginfo, "Could not establish connection to server.")) {
          subBin->reconfiguring = TRUE;
          g_timeout_add (0, reset_source_pipeline, subBin);
        }

But it doesn’t seem to help.

If the pipeline is restarted then I think pipeline expects to get 2 sources, but it gets 1 and because of that it might crash?
Here are the logs when DeepStream is running and I turn off the second source:

**PERF:  29.57 (30.67)  30.17 (31.07)
**PERF:  29.60 (30.32)  29.80 (30.66)
**PERF:  29.57 (30.14)  30.17 (30.55)
**PERF:  29.51 (30.03)  30.11 (30.48)
nvstreammux: Successfully handled EOS for source_id=1
**PERF:  29.67 (29.96)  27.91 (25.85)
**PERF:  29.64 (29.91)  0.00 (22.20)
**PERF:  29.56 (29.87)  0.00 (19.45)
**PERF:  29.59 (29.84)  0.00 (17.30)
**PERF:  29.58 (29.82)  0.00 (15.59)
**PERF:  29.59 (29.80)  0.00 (14.18)
**PERF:  29.60 (29.78)  0.00 (13.00)
**PERF:  29.60 (29.77)  0.00 (12.01)
**PERF:  29.58 (29.75)  0.00 (11.16)
**PERF:  29.59 (29.74)  0.00 (10.42)
**PERF:  29.59 (29.73)  0.00 (9.77)
**PERF:  29.60 (29.73)  0.00 (9.20)
** WARN: <watch_source_status:758>: No data from source 1 since last 60 sec. Trying reconnection
** INFO: <reset_source_pipeline:1746>: Resetting source 1
ERROR from source: Could not establish connection to server.
Debug info: gstsouphttpsrc.c(1376): gst_soup_http_src_parse_status (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin1/GstURIDecodeBin:src_elem/GstSoupHTTPSrc:source:
Could not connect: Connection refused (4), URL: http://192.168.60.225:8000/camera/mjpeg, Redirect to: (NULL)
ERROR from source: Internal data stream error.
Debug info: gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin1/GstURIDecodeBin:src_elem/GstSoupHTTPSrc:source:
streaming stopped, reason error (-5)
ERROR from typefindelement2: Stream doesn't contain enough data.
Debug info: gsttypefindelement.c(986): gst_type_find_element_chain_do_typefinding (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin1/GstURIDecodeBin:src_elem/GstTypeFindElement:typefindelement2:
Can't typefind stream
**PERF:  24.77 (29.45)  0.00 (8.69)
**PERF:  24.76 (29.21)  0.00 (8.23)
nvbufsurftransform.cpp:3424: => Transformation Failed -1

0:01:43.512898629  9048 0x55b81368e860 ERROR         nvvideoconvert gstnvvideoconvert.c:3768:gst_nvvideoconvert_transform: buffer transform failed
ERROR from source: Internal data stream error.
Debug info: gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin0/GstURIDecodeBin:src_elem/GstSoupHTTPSrc:source:
streaming stopped, reason error (-5)
** INFO: <reset_source_pipeline:1746>: Resetting source 0

(deepstream-app:9048): GLib-GObject-WARNING **: 14:52:06.005: g_object_set_is_valid_property: object class 'GstNvJpegDec' has no property named 'DeepStream'
Using GPU 0 (NVIDIA GeForce RTX 3050, 20 SMs, 1536 th/SM max, CC 8.6, ECC off)

**PERF:  FPS 0 (Avg)    FPS 1 (Avg)
**PERF:  22.87 (28.89)  0.00 (7.82)
**PERF:  24.72 (28.70)  0.00 (7.45)
nvbufsurftransform.cpp:3424: => Transformation Failed -1

0:01:54.782495293  9048 0x55b81368e860 ERROR         nvvideoconvert gstnvvideoconvert.c:3768:gst_nvvideoconvert_transform: buffer transform failed
ERROR from source: Internal data stream error.
Debug info: gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin0/GstURIDecodeBin:src_elem/GstSoupHTTPSrc:source:
streaming stopped, reason error (-5)
** INFO: <reset_source_pipeline:1746>: Resetting source 0

(deepstream-app:9048): GLib-GObject-WARNING **: 14:52:17.229: g_object_set_is_valid_property: object class 'GstNvJpegDec' has no property named 'DeepStream'
Using GPU 0 (NVIDIA GeForce RTX 3050, 20 SMs, 1536 th/SM max, CC 8.6, ECC off)
**PERF:  24.40 (28.46)  0.00 (7.11)
**PERF:  23.10 (28.26)  0.00 (6.80)
**PERF:  24.74 (28.12)  0.00 (6.52)
nvbufsurftransform.cpp:3424: => Transformation Failed -1

0:02:06.194922072  9048 0x55b81368e860 ERROR         nvvideoconvert gstnvvideoconvert.c:3768:gst_nvvideoconvert_transform: buffer transform failed
ERROR from source: Internal data stream error.
Debug info: gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin0/GstURIDecodeBin:src_elem/GstSoupHTTPSrc:source:
streaming stopped, reason error (-5)
** INFO: <reset_source_pipeline:1746>: Resetting source 0

(deepstream-app:9048): GLib-GObject-WARNING **: 14:52:28.686: g_object_set_is_valid_property: object class 'GstNvJpegDec' has no property named 'DeepStream'
Using GPU 0 (NVIDIA GeForce RTX 3050, 20 SMs, 1536 th/SM max, CC 8.6, ECC off)
Segmentation fault (core dumped)

If I run DeepStream with the second source already offline it quits instantly, because I guess it expects 2 sources, but only gets frames from one. Here are the logs:

** INFO: <bus_callback:240>: Pipeline ready

ERROR from source: Could not establish connection to server.
Debug info: gstsouphttpsrc.c(1376): gst_soup_http_src_parse_status (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin1/GstURIDecodeBin:src_elem/GstSoupHTTPSrc:source:
Could not connect: Connection refused (4), URL: http://192.168.60.225:8000/camera/mjpeg, Redirect to: (NULL)
ERROR from source: Internal data stream error.
Debug info: gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin1/GstURIDecodeBin:src_elem/GstSoupHTTPSrc:source:
streaming stopped, reason error (-5)
** INFO: <reset_source_pipeline:1746>: Resetting source 1
ERROR from typefindelement1: Stream doesn't contain enough data.
Debug info: gsttypefindelement.c(986): gst_type_find_element_chain_do_typefinding (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin1/GstURIDecodeBin:src_elem/GstTypeFindElement:typefindelement1:
Can't typefind stream
ERROR from source: Could not establish connection to server.
Debug info: gstsouphttpsrc.c(1376): gst_soup_http_src_parse_status (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin1/GstURIDecodeBin:src_elem/GstSoupHTTPSrc:source:
Could not connect: Connection refused (4), URL: http://192.168.60.225:8000/camera/mjpeg, Redirect to: (NULL)
ERROR from source: Internal data stream error.
Debug info: gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin1/GstURIDecodeBin:src_elem/GstSoupHTTPSrc:source:
streaming stopped, reason error (-5)
ERROR from typefindelement2: Stream doesn't contain enough data.
Debug info: gsttypefindelement.c(986): gst_type_find_element_chain_do_typefinding (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin1/GstURIDecodeBin:src_elem/GstTypeFindElement:typefindelement2:
Can't typefind stream
Quitting

(deepstream-app:9523): GLib-GObject-WARNING **: 14:54:04.855: g_object_set_is_valid_property: object class 'GstNvJpegDec' has no property named 'DeepStream'
Using GPU 0 (NVIDIA GeForce RTX 3050, 20 SMs, 1536 th/SM max, CC 8.6, ECC off)
App run failed

I think I know where the problem is. When uridecodebin fails to reconnect, the error of souphttpsrc will be passed to the downstream, then the error will be passed to bus_callback, and then exit.

Try to modify create_uridecode_src_bin , replace the uridecodebin like this figure.

souphttpsrc location=xxxx  --> queue --> nvjpegdec  --> ..
                            |
                            |
                   add buffer probe at here .

If I understand correctly I should attach buffer probe to cap_filter instead of dec_que.
Here is the modified code:

static gboolean
create_uridecode_src_bin (NvDsSourceConfig * config, NvDsSrcBin * bin)
{
  gboolean ret = FALSE;
  GstCaps *caps = NULL;
  GstCapsFeatures *feature = NULL;
  bin->config = config;
  gchar elem_name[50];
  bin->rtsp_reconnect_interval_sec = config->rtsp_reconnect_interval_sec;
  bin->rtsp_reconnect_attempts = config->rtsp_reconnect_attempts;
  bin->num_rtsp_reconnects = 0;

  bin->src_elem = gst_element_factory_make (NVDS_ELEM_SRC_URI, "src_elem");
  if (!bin->src_elem) {
    NVGSTDS_ERR_MSG_V ("Could not create element 'src_elem'");
    goto done;
  }

  if (config->dewarper_config.enable) {
    if (!create_dewarper_bin (&config->dewarper_config, &bin->dewarper_bin)) {
      g_print ("Creating Dewarper bin failed \n");
      goto done;
    }
  }
  bin->latency = config->latency;
  bin->udp_buffer_size = config->udp_buffer_size;

  if (g_strrstr (config->uri, "file:/")) {
    config->live_source = FALSE;
  }
  if (g_strrstr (config->uri, "rtsp://") == config->uri) {
    configure_source_for_ntp_sync (bin->src_elem);
  }

  g_object_set (G_OBJECT (bin->src_elem), "uri", config->uri, NULL);
  g_signal_connect (G_OBJECT (bin->src_elem), "pad-added",
      G_CALLBACK (cb_newpad), bin);
  g_signal_connect (G_OBJECT (bin->src_elem), "child-added",
      G_CALLBACK (decodebin_child_added), bin);
  g_signal_connect (G_OBJECT (bin->src_elem), "source-setup",
      G_CALLBACK (cb_sourcesetup), bin);
  bin->cap_filter = gst_element_factory_make (NVDS_ELEM_QUEUE, "queue");
  if (!bin->cap_filter) {
    NVGSTDS_ERR_MSG_V ("Could not create 'queue'");
    goto done;
  }

  if (bin->rtsp_reconnect_interval_sec > 0) {
    NVGSTDS_ELEM_ADD_PROBE(bin->rtspsrc_monitor_probe, bin->cap_filter, 
    "sink", rtspsrc_monitor_probe_func, 
    GST_PAD_PROBE_TYPE_BUFFER, bin);
    install_mux_eosmonitor_probe = TRUE;
  } else {
    NVGSTDS_ELEM_ADD_PROBE (bin->rtspsrc_monitor_probe, bin->cap_filter,
        "sink", rtspsrc_monitor_probe_func,
        GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, bin);
  }

  g_snprintf (elem_name, sizeof (elem_name), "dec_que%d", bin->bin_id);
  bin->dec_que = gst_element_factory_make ("queue", elem_name);
  if (!bin->dec_que) {
    NVGSTDS_ERR_MSG_V ("Failed to create '%s'", elem_name);
    goto done;
  }

  bin->nvvidconv =
      gst_element_factory_make (NVDS_ELEM_VIDEO_CONV, "nvvidconv_elem");
  if (!bin->nvvidconv) {
    NVGSTDS_ERR_MSG_V ("Could not create element 'nvvidconv_elem'");
    goto done;
  }

  if (config->video_format) {
    caps = gst_caps_new_simple ("video/x-raw", "format", G_TYPE_STRING, config->video_format, NULL);
  } else {
    caps = gst_caps_new_empty_simple ("video/x-raw");
  }
  feature = gst_caps_features_new ("memory:NVMM", NULL);
  gst_caps_set_features (caps, 0, feature);

  bin->cap_filter1 =
      gst_element_factory_make (NVDS_ELEM_CAPS_FILTER,
      "src_cap_filter_nvvidconv");
  if (!bin->cap_filter1) {
    NVGSTDS_ERR_MSG_V ("Could not create 'queue'");
    goto done;
  }

  g_object_set (G_OBJECT (bin->cap_filter1), "caps", caps, NULL);
  gst_caps_unref (caps);

  g_object_set_data (G_OBJECT (bin->cap_filter), SRC_CONFIG_KEY, config);

  gst_bin_add_many (GST_BIN (bin->bin), bin->src_elem, bin->cap_filter,
      bin->dec_que, bin->nvvidconv, bin->cap_filter1, NULL);

  NVGSTDS_BIN_ADD_GHOST_PAD (bin->bin, bin->cap_filter1, "src");

  bin->fakesink = gst_element_factory_make ("fakesink", "src_fakesink");
  if (!bin->fakesink) {
    NVGSTDS_ERR_MSG_V ("Could not create 'src_fakesink'");
    goto done;
  }

  bin->fakesink_queue = gst_element_factory_make ("queue", "fakequeue");
  if (!bin->fakesink_queue) {
    NVGSTDS_ERR_MSG_V ("Could not create 'fakequeue'");
    goto done;
  }

  bin->tee = gst_element_factory_make ("tee", NULL);
  if (!bin->tee) {
    NVGSTDS_ERR_MSG_V ("Could not create 'tee'");
    goto done;
  }
  gst_bin_add_many (GST_BIN (bin->bin), bin->fakesink, bin->tee,
      bin->fakesink_queue, NULL);

  NVGSTDS_LINK_ELEMENT (bin->fakesink_queue, bin->fakesink);

  if (config->dewarper_config.enable) {
    gst_bin_add_many (GST_BIN (bin->bin), bin->dewarper_bin.bin, NULL);
    NVGSTDS_LINK_ELEMENT (bin->tee, bin->dewarper_bin.bin);
    NVGSTDS_LINK_ELEMENT (bin->dewarper_bin.bin, bin->cap_filter);
  } else {
    link_element_to_tee_src_pad (bin->tee, bin->cap_filter);
  }

  NVGSTDS_LINK_ELEMENT (bin->cap_filter, bin->dec_que);
  NVGSTDS_LINK_ELEMENT (bin->dec_que, bin->nvvidconv);
  NVGSTDS_LINK_ELEMENT (bin->nvvidconv, bin->cap_filter1);

  link_element_to_tee_src_pad (bin->tee, bin->fakesink_queue);

  g_object_set (G_OBJECT (bin->fakesink), "sync", FALSE, "async", FALSE, NULL);
  g_object_set (G_OBJECT (bin->fakesink), "enable-last-sample", FALSE, NULL);

  ret = TRUE;

  g_timeout_add (1000, watch_source_status, bin);

  GST_CAT_DEBUG (NVDS_APP,
      "Decode bin created. Waiting for a new pad from decodebin to link");

done:

  if (!ret) {
    NVGSTDS_ERR_MSG_V ("%s failed", __func__);
  }
  return ret;
}

But now the pipeline doesn’t even start with the second source offline and if I test the reconnect it still doesn’t work, here are the logs:

**PERF:  29.54 (31.66)  30.34 (32.41)
**PERF:  29.50 (30.57)  29.90 (31.15)
**PERF:  29.69 (30.32)  29.89 (30.77)
nvstreammux: Successfully handled EOS for source_id=1
**PERF:  29.61 (30.14)  29.65 (24.88)
**PERF:  29.59 (30.03)  0.00 (19.97)
**PERF:  29.59 (29.96)  0.00 (16.68)
**PERF:  29.57 (29.91)  0.00 (14.32)
**PERF:  29.58 (29.85)  0.00 (12.54)
**PERF:  29.57 (29.82)  0.00 (11.16)
**PERF:  29.58 (29.80)  0.00 (10.05)
**PERF:  29.58 (29.78)  0.00 (9.14)
**PERF:  29.59 (29.76)  0.00 (8.39)
**PERF:  29.59 (29.75)  0.00 (7.74)
**PERF:  29.59 (29.74)  0.00 (7.19)
**PERF:  29.56 (29.73)  0.00 (6.72)
** WARN: <watch_source_status:758>: No data from source 1 since last 60 sec. Trying reconnection
** INFO: <reset_source_pipeline:1746>: Resetting source 1
ERROR from source: Could not establish connection to server.
Debug info: gstsouphttpsrc.c(1376): gst_soup_http_src_parse_status (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin1/GstURIDecodeBin:src_elem/GstSoupHTTPSrc:source:
Could not connect: Connection refused (4), URL: http://192.168.60.236:8000/camera/mjpeg, Redirect to: (NULL)
ERROR from source: Internal data stream error.
Debug info: gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin1/GstURIDecodeBin:src_elem/GstSoupHTTPSrc:source:
streaming stopped, reason error (-5)
ERROR from typefindelement2: Stream doesn't contain enough data.
Debug info: gsttypefindelement.c(986): gst_type_find_element_chain_do_typefinding (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin1/GstURIDecodeBin:src_elem/GstTypeFindElement:typefindelement2:
Can't typefind stream
**PERF:  25.64 (29.47)  0.00 (6.30)
**PERF:  24.60 (29.19)  0.00 (5.93)
nvbufsurftransform.cpp:3424: => Transformation Failed -1

0:01:34.358586630 35209 0x55efadff7860 ERROR         nvvideoconvert gstnvvideoconvert.c:3768:gst_nvvideoconvert_transform: buffer transform failed
ERROR from source: Internal data stream error.
Debug info: gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin0/GstURIDecodeBin:src_elem/GstSoupHTTPSrc:source:
streaming stopped, reason error (-5)
** INFO: <reset_source_pipeline:1746>: Resetting source 0

(deepstream-app:35209): GLib-GObject-WARNING **: 07:47:09.609: g_object_set_is_valid_property: object class 'GstNvJpegDec' has no property named 'DeepStream'
Using GPU 0 (NVIDIA GeForce RTX 3050, 20 SMs, 1536 th/SM max, CC 8.6, ECC off)
**PERF:  23.18 (28.85)  0.00 (5.60)
**PERF:  24.62 (28.63)  0.00 (5.31)

**PERF:  FPS 0 (Avg)    FPS 1 (Avg)
**PERF:  24.78 (28.44)  0.00 (5.04)
nvbufsurftransform.cpp:3424: => Transformation Failed -1

0:01:45.820347237 35209 0x55efadff7860 ERROR         nvvideoconvert gstnvvideoconvert.c:3768:gst_nvvideoconvert_transform: buffer transform failed
ERROR from source: Internal data stream error.
Debug info: gstbasesrc.c(3072): gst_base_src_loop (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin0/GstURIDecodeBin:src_elem/GstSoupHTTPSrc:source:
streaming stopped, reason error (-5)
** INFO: <reset_source_pipeline:1746>: Resetting source 0

(deepstream-app:35209): GLib-GObject-WARNING **: 07:47:21.076: g_object_set_is_valid_property: object class 'GstNvJpegDec' has no property named 'DeepStream'
Using GPU 0 (NVIDIA GeForce RTX 3050, 20 SMs, 1536 th/SM max, CC 8.6, ECC off)
Segmentation fault (core dumped)

No, I mean to remove the uridecodebin, which will cause errors to be incorrectly passed in the pipeline.

Build a source bin similar to the following, Avoid errors passed to bus_callback.
souphttpsrc location=xxxx --> caps --> queue --> nvjpegdec

OK, the following patch is my example, I have tested it and it works .

Add mjpeg-over-http=1 in [sourcex] group.

For apps-common

diff --git a/sources/apps/apps-common/includes/deepstream_config_file_parser.h b/sources/apps/apps-common/includes/deepstream_config_file_parser.h
index e219563..3967b88 100644
--- a/sources/apps/apps-common/includes/deepstream_config_file_parser.h
+++ b/sources/apps/apps-common/includes/deepstream_config_file_parser.h
@@ -112,6 +112,7 @@ extern "C"
 #define CONFIG_GROUP_SOURCE_SMART_RECORD_DEFAULT_DURATION "smart-rec-default-duration"
 #define CONFIG_GROUP_SOURCE_SMART_RECORD_DURATION "smart-rec-duration"
 #define CONFIG_GROUP_SOURCE_SMART_RECORD_INTERVAL "smart-rec-interval"
+#define CONFIG_GROUP_SOURCE_MJPEG_OVER_HTTP "mjpeg-over-http"
 
 /**
  * Function to parse class label file. Parses the labels into a 2D-array of
diff --git a/sources/apps/apps-common/includes/deepstream_sources.h b/sources/apps/apps-common/includes/deepstream_sources.h
index 0416d05..a94d363 100644
--- a/sources/apps/apps-common/includes/deepstream_sources.h
+++ b/sources/apps/apps-common/includes/deepstream_sources.h
@@ -83,6 +83,7 @@ typedef struct
   gchar* alsa_device;
   /** Video format to be applied at nvvideoconvert source pad. */
   gchar* video_format;
+  gboolean mjpeg_over_http;
 } NvDsSourceConfig;
 
 typedef struct NvDsSrcParentBin NvDsSrcParentBin;
diff --git a/sources/apps/apps-common/src/deepstream_config_file_parser.c b/sources/apps/apps-common/src/deepstream_config_file_parser.c
index 5d99503..c20fdff 100644
--- a/sources/apps/apps-common/src/deepstream_config_file_parser.c
+++ b/sources/apps/apps-common/src/deepstream_config_file_parser.c
@@ -402,6 +402,7 @@ parse_source (NvDsSourceConfig * config, GKeyFile * key_file, gchar * group,
   gchar **key = NULL;
   GError *error = NULL;
   static GList *camera_id_list = NULL;
+  config->mjpeg_over_http = false;
 
   if (g_strcmp0 (group, CONFIG_GROUP_SOURCE_ALL)) {
     if (g_key_file_get_integer (key_file, group,
@@ -656,6 +657,11 @@ parse_source (NvDsSourceConfig * config, GKeyFile * key_file, gchar * group,
             g_key_file_get_integer(key_file, CONFIG_GROUP_SOURCE,
             CONFIG_GROUP_SOURCE_EXTRACT_SEI_TYPE5_DATA, &error);
         CHECK_ERROR(error);
+    } else if (!g_strcmp0(*key, CONFIG_GROUP_SOURCE_MJPEG_OVER_HTTP)) {
+        config->mjpeg_over_http =
+            g_key_file_get_integer(key_file, group,
+            CONFIG_GROUP_SOURCE_MJPEG_OVER_HTTP, &error);
+        CHECK_ERROR(error);
     }
     else {
       NVGSTDS_WARN_MSG_V ("Unknown key '%s' for group [%s]", *key, group);
diff --git a/sources/apps/apps-common/src/deepstream_source_bin.c b/sources/apps/apps-common/src/deepstream_source_bin.c
index 002d2ee..8c5dae3 100644
--- a/sources/apps/apps-common/src/deepstream_source_bin.c
+++ b/sources/apps/apps-common/src/deepstream_source_bin.c
@@ -652,7 +652,8 @@ check_rtsp_reconnection_attempts (NvDsSrcBin * src_bin)
   gboolean remove_probe = TRUE;
   guint i = 0;
   for (i = 0; i < src_bin->parent_bin->num_bins; i++) {
-    if (src_bin->parent_bin->sub_bins[i].config->type != NV_DS_SOURCE_RTSP)
+    if (src_bin->parent_bin->sub_bins[i].config->type != NV_DS_SOURCE_RTSP || 
+        src_bin->parent_bin->sub_bins[i].config->type != NV_DS_SOURCE_URI)
       continue;
     if (src_bin->parent_bin->sub_bins[i].have_eos &&
         (src_bin->parent_bin->sub_bins[i].rtsp_reconnect_interval_sec == 0 ||
@@ -1292,42 +1293,87 @@ create_uridecode_src_bin (NvDsSourceConfig * config, NvDsSrcBin * bin)
   GstCaps *caps = NULL;
   GstCapsFeatures *feature = NULL;
   bin->config = config;
+  GstElement *jpegparse = NULL;
+  GstElement *v4l2dec = NULL;
+  GstElement *filter = NULL;
 
-  bin->src_elem = gst_element_factory_make (NVDS_ELEM_SRC_URI, "src_elem");
-  if (!bin->src_elem) {
-    NVGSTDS_ERR_MSG_V ("Could not create element 'src_elem'");
-    goto done;
-  }
+  bin->rtsp_reconnect_interval_sec = config->rtsp_reconnect_interval_sec;
+  bin->rtsp_reconnect_attempts = config->rtsp_reconnect_attempts;
 
-  if (config->dewarper_config.enable) {
-    if (!create_dewarper_bin (&config->dewarper_config, &bin->dewarper_bin)) {
-      g_print ("Creating Dewarper bin failed \n");
+  if (config->mjpeg_over_http) {
+    bin->src_elem = gst_element_factory_make ("souphttpsrc", "src_elem");
+    if (!bin->src_elem) {
+      NVGSTDS_ERR_MSG_V ("Could not create element 'src_elem'");
       goto done;
     }
-  }
-  bin->latency = config->latency;
-  bin->udp_buffer_size = config->udp_buffer_size;
+    g_object_set (G_OBJECT (bin->src_elem), "location", config->uri, NULL);
+    GstCaps *caps = gst_caps_new_simple ("image/jpeg", "framerate", GST_TYPE_FRACTION, 15, 1, NULL);
+    filter = gst_element_factory_make (NVDS_ELEM_CAPS_FILTER, "filter0");
+    if (!filter) {
+      NVGSTDS_ERR_MSG_V ("Could not create 'filter'");
+      goto done;
+    }
+    g_object_set (G_OBJECT (filter), "caps", caps, NULL);
+    gst_caps_unref (caps);
 
-  if (g_strrstr (config->uri, "file:/")) {
-    config->live_source = FALSE;
-  }
-  if (g_strrstr (config->uri, "rtsp://") == config->uri) {
-    configure_source_for_ntp_sync (bin->src_elem);
+    jpegparse = gst_element_factory_make ("jpegparse", "jpegparse");
+    if (!jpegparse) {
+      NVGSTDS_ERR_MSG_V ("Could not create element 'jpegparse'");
+      goto done;
+    }
+    v4l2dec = gst_element_factory_make ("nvv4l2decoder", "nvv4l2decoder");
+    if (!v4l2dec) {
+      NVGSTDS_ERR_MSG_V ("Could not create element 'nvv4l2decoder'");
+      goto done;
+    }
+    g_object_set (G_OBJECT (v4l2dec), "mjpeg", true, NULL);
+  } else {
+    bin->src_elem = gst_element_factory_make (NVDS_ELEM_SRC_URI, "src_elem");
+    if (!bin->src_elem) {
+      NVGSTDS_ERR_MSG_V ("Could not create element 'src_elem'");
+      goto done;
+    }
+
+    if (config->dewarper_config.enable) {
+      if (!create_dewarper_bin (&config->dewarper_config, &bin->dewarper_bin)) {
+        g_print ("Creating Dewarper bin failed \n");
+        goto done;
+      }
+    }
+    bin->latency = config->latency;
+    bin->udp_buffer_size = config->udp_buffer_size;
+
+    if (g_strrstr (config->uri, "file:/")) {
+      config->live_source = FALSE;
+    }
+    if (g_strrstr (config->uri, "rtsp://") == config->uri) {
+      configure_source_for_ntp_sync (bin->src_elem);
+    }
+
+    g_object_set (G_OBJECT (bin->src_elem), "uri", config->uri, NULL);
+    g_signal_connect (G_OBJECT (bin->src_elem), "pad-added",
+        G_CALLBACK (cb_newpad), bin);
+    g_signal_connect (G_OBJECT (bin->src_elem), "child-added",
+        G_CALLBACK (decodebin_child_added), bin);
+    g_signal_connect (G_OBJECT (bin->src_elem), "source-setup",
+        G_CALLBACK (cb_sourcesetup), bin);
   }
 
-  g_object_set (G_OBJECT (bin->src_elem), "uri", config->uri, NULL);
-  g_signal_connect (G_OBJECT (bin->src_elem), "pad-added",
-      G_CALLBACK (cb_newpad), bin);
-  g_signal_connect (G_OBJECT (bin->src_elem), "child-added",
-      G_CALLBACK (decodebin_child_added), bin);
-  g_signal_connect (G_OBJECT (bin->src_elem), "source-setup",
-      G_CALLBACK (cb_sourcesetup), bin);
   bin->cap_filter = gst_element_factory_make (NVDS_ELEM_QUEUE, "queue");
   if (!bin->cap_filter) {
     NVGSTDS_ERR_MSG_V ("Could not create 'queue'");
     goto done;
   }
 
+  if (bin->rtsp_reconnect_interval_sec > 0) {
+    NVGSTDS_ELEM_ADD_PROBE(bin->rtspsrc_monitor_probe, bin->cap_filter, "sink", rtspsrc_monitor_probe_func, GST_PAD_PROBE_TYPE_BUFFER, bin);
+    install_mux_eosmonitor_probe = TRUE;
+  } else {
+    NVGSTDS_ELEM_ADD_PROBE (bin->rtspsrc_monitor_probe, bin->cap_filter,
+        "sink", rtspsrc_monitor_probe_func,
+        GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, bin);
+  }
+
   bin->nvvidconv =
       gst_element_factory_make (NVDS_ELEM_VIDEO_CONV, "nvvidconv_elem");
   if (!bin->nvvidconv) {
@@ -1358,8 +1404,17 @@ create_uridecode_src_bin (NvDsSourceConfig * config, NvDsSrcBin * bin)
 
   g_object_set_data (G_OBJECT (bin->cap_filter), SRC_CONFIG_KEY, config);
 
-  gst_bin_add_many (GST_BIN (bin->bin), bin->src_elem, bin->cap_filter,
-      bin->nvvidconv, bin->cap_filter1, NULL);
+  if (config->mjpeg_over_http) {
+    gst_bin_add_many (GST_BIN (bin->bin), bin->src_elem, filter, jpegparse, v4l2dec, bin->cap_filter,
+        bin->nvvidconv, bin->cap_filter1, NULL);
+    NVGSTDS_LINK_ELEMENT (bin->src_elem, filter);
+    NVGSTDS_LINK_ELEMENT (filter, jpegparse);
+    NVGSTDS_LINK_ELEMENT (jpegparse, v4l2dec);
+    NVGSTDS_LINK_ELEMENT (v4l2dec, bin->cap_filter);
+  } else {
+    gst_bin_add_many (GST_BIN (bin->bin), bin->src_elem, bin->cap_filter,
+        bin->nvvidconv, bin->cap_filter1, NULL);
+  }
 
   NVGSTDS_BIN_ADD_GHOST_PAD (bin->bin, bin->cap_filter1, "src");
 
@@ -1402,6 +1457,8 @@ create_uridecode_src_bin (NvDsSourceConfig * config, NvDsSrcBin * bin)
 
   ret = TRUE;
 
+  g_timeout_add (1000, watch_source_status, bin);
+
   GST_CAT_DEBUG (NVDS_APP,
       "Decode bin created. Waiting for a new pad from decodebin to link");

For deepstream-app.c

diff --git a/sources/apps/sample_apps/deepstream-app/deepstream_app.c b/sources/apps/sample_apps/deepstream-app/deepstream_app.c
index 044cfbc..98a9a83 100644
--- a/sources/apps/sample_apps/deepstream-app/deepstream_app.c
+++ b/sources/apps/sample_apps/deepstream-app/deepstream_app.c
@@ -236,14 +236,15 @@ bus_callback (GstBus * bus, GstMessage * message, gpointer data)
       }
 
       if ((i != bin->num_bins) &&
-          (appCtx->config.multi_source_config[0].type == NV_DS_SOURCE_RTSP)) {
+          ((appCtx->config.multi_source_config[0].type == NV_DS_SOURCE_RTSP) || 
+          (appCtx->config.multi_source_config[0].type == NV_DS_SOURCE_URI))) {
         // Error from one of RTSP source.
         NvDsSrcBin *subBin = &bin->sub_bins[i];
 
         if (!subBin->reconfiguring ||
             g_strrstr (debuginfo, "500 (Internal Server Error)")) {
           subBin->reconfiguring = TRUE;
-          g_timeout_add (0, reset_source_pipeline, subBin);
+          g_timeout_add (10000, reset_source_pipeline, subBin);
         }
         g_error_free (error);
         g_free (debuginfo);

Thank you so much!
Now it does work.

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