Output rtmp stream can not reconnect rtmp stream after modifying the deepstream-app code according to rtmp.patch

Continuing the discussion from Rtmp sink creation in deepstream test5 application:

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU)
• DeepStream Version: deepstream 6.1
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only):525.116.04
• Issue Type( questions, new requirements, bugs):question

We use the rtmp.batch code, and then it can be successful to output rtmp video stream. However, when input rtmp stream is stopped and then resume video stream, termial always show :**PERF: 0.00 (15) , which can not output rtmp stream and deepstream-app still running.

According to the article stops-on-rtsp-streams-eos, solving the problem is set value of type,rtsp-reconnect-interval-sec and rtsp-reconnect-attempts.

We set type=3 in source0, which supporting input rtmp stream,
but reconnect stream in rtspstream by type = 4 can work.
(rtsp-reconnect-interval-sec:Timeout in seconds to wait since last data was received from an RTSP source before forcing a reconnection. Setting it to 0 will disable the reconnection. Valid when type (type of source) is 4)

How can we reconnect input rtmp stream?

my config file:

[source0]
enable=1
type=3
uri=TEMPLATE_PULL_URL
num-sources=1
gpu-id=0
cudadec-memtype=0
drop-frame-interval=2
rtsp-reconnect-interval-sec=60
rtsp-reconnect-attempts=10
udp-buffer-size=2000000

[sink0]
enable=1
type=3
#1=mp4 2=mkv 3=flv for rtmp
container=3
#1=h264 2=h265
codec=1
encoder type 0=Hardware 1=Software
enc-type=0
sync=0
bitrate=2000000
#H264 Profile - 0=Baseline 2=Main 4=High
#H265 Profile - 0=Main 1=Main10
profile=0
#output-file=rtsp_out.mp4
output-uri=TEMPLATE_PUSH_URL
source-id=0

• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

In fact, If input stream is stoped, sink is paused.the pipeline can’t output empty stream.

Let’s ignore rtmpsink for the moment. It’s just for output.

Do you mean that if you input rtmp stream, you cannot reconnect after disconnecting?

If you want reconnect rtmp stream, you can refer function watch_source_status in create_rtsp_src_bin.

RTMP stream reconnection is not supported at the moment.

yes, we need to reconnect rtmp stream after disconnecting. We think the problem of failure of reconnect after disconnecting is type=3([source0]) , which is not able to reconnect stream in rtsp.
how can we get reconnect rtmp stream after disconnecting through altering the config. Just like we change the value rtsp-reconnect-interval-sec and rtsp-reconnect-attempts in rtsp stream. But it is difficult for us to modify rtsp source code of pipeline to connect disconneting rtmp stream.
or are there any patch code for supporting reconnect rtmp stream?

Not currently, the code is open source, you can modify it by yourself

Another problem is that, ERROR from sink_sub_bin_sink1: Could not write to resource (output rtmp stream will stop), when input rtsp stream become unstable or stop and it can not resume after a period of time.
we use rtsp input stream and output rtmp stream by the rtmp patch.

Error message like this:

**PERF: FPS 0 (Avg)
**PERF: 0.00 (0.00)
** INFO: <bus_callback:223>: Pipeline ready

** ERROR: <cb_newpad3:500>: Failed to link depay loader to rtsp src
** INFO: <bus_callback:206>: Pipeline running

I20231019 08:25:48.569587 42521 deepstream_app.cpp:207] Sending notice now…
**PERF: 0.00 (0.00)
**PERF: 0.00 (0.00)
**PERF: 0.00 (0.00)
**PERF: 0.00 (0.00)
**PERF: 0.00 (0.00)
**PERF: 0.00 (0.00)
**PERF: 0.00 (0.00)
**PERF: 0.00 (0.00)
**PERF: 14.87 (14.24)
**PERF: 14.96 (14.67)
**PERF: 14.93 (14.78)
**PERF: 14.98 (14.84)
I20231019 08:26:00.330163 42531 deepstream_app.cpp:575] send alarm obj
**PERF: 14.97 (14.87)
**PERF: 14.99 (14.89)
**PERF: 15.23 (14.91)
**PERF: 14.95 (14.92)
**PERF: 15.21 (14.93)
**PERF: 15.05 (14.93)
**PERF: 14.97 (14.94)

**PERF: FPS 0 (Avg)
**PERF: 14.96 (14.94)
**PERF: 14.96 (14.95)
**PERF: 14.95 (14.95)
I20231019 08:26:10.556072 42531 deepstream_app.cpp:575] send alarm obj
**PERF: 15.02 (14.95)
**PERF: 15.03 (14.96)
**PERF: 14.54 (14.96)
**PERF: 15.28 (14.96)
I20231019 08:26:14.377491 42531 deepstream_app.cpp:575] send alarm obj
**PERF: 14.97 (14.96)
I20231019 08:26:15.484994 42531 deepstream_app.cpp:575] send alarm obj
WARNING from src_elem0: Could not read from resource.
Debug info: gstrtspsrc.c(5623): gst_rtspsrc_loop_udp (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin0/GstRTSPSrc:src_elem0:
The server closed the connection.
**PERF: 15.57 (14.36)
**PERF: 0.00 (13.66)
**PERF: 0.00 (13.04)
**PERF: 0.00 (12.46)
**PERF: 0.00 (11.94)
**PERF: 0.00 (11.46)
**PERF: 0.00 (11.01)
**PERF: 0.00 (10.60)
**PERF: 0.00 (10.22)
**PERF: 0.00 (9.87)
**PERF: 0.00 (9.53)
**PERF: 0.00 (9.22)

**PERF: FPS 0 (Avg)
**PERF: 0.00 (8.93)
**PERF: 0.00 (8.66)
**PERF: 0.00 (8.40)
**PERF: 0.00 (8.16)
**PERF: 0.00 (7.93)
WARNING from src_elem0: Could not read from resource.
Debug info: gstrtspsrc.c(5623): gst_rtspsrc_loop_udp (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin0/GstRTSPSrc:src_elem0:
The server closed the connection.
**PERF: 0.00 (7.72)
**PERF: 0.00 (7.51)
**PERF: 0.00 (7.32)
**PERF: 0.00 (7.14)
**PERF: 0.00 (6.96)
**PERF: 0.00 (6.80)
**PERF: 0.00 (6.64)
**PERF: 0.00 (6.48)
**PERF: 0.00 (6.34)
**PERF: 0.00 (6.20)
**PERF: 0.00 (6.07)
I20231019 08:26:43.441974 42531 deepstream_app.cpp:575] send alarm obj
**PERF: 0.11 (6.00)
**PERF: 0.00 (5.88)
**PERF: 0.00 (5.76)
**PERF: 0.00 (5.65)

**PERF: FPS 0 (Avg)
**PERF: 0.00 (5.54)
WARNING from src_elem0: Could not read from resource.
Debug info: gstrtspsrc.c(5623): gst_rtspsrc_loop_udp (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin0/GstRTSPSrc:src_elem0:
The server closed the connection.
**PERF: 0.00 (5.44)
**PERF: 0.00 (5.33)
**PERF: 0.00 (5.24)
**PERF: 0.00 (5.14)
**PERF: 0.00 (5.05)
**PERF: 0.00 (4.96)
**PERF: 0.00 (4.88)
**PERF: 0.00 (4.80)
**PERF: 0.00 (4.72)
**PERF: 0.00 (4.64)
**PERF: 0.00 (4.57)
**PERF: 0.00 (4.50)
**PERF: 0.00 (4.43)
**PERF: 0.00 (4.36)
**PERF: 0.00 (4.30)
**PERF: 0.00 (4.23)
WARNING from src_elem0: Could not read from resource.
Debug info: gstrtspsrc.c(5623): gst_rtspsrc_loop_udp (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin0/GstRTSPSrc:src_elem0:
The server closed the connection.
**PERF: 0.00 (4.17)
**PERF: 0.00 (4.11)
**PERF: 0.00 (4.05)

**PERF: FPS 0 (Avg)
**PERF: 0.00 (4.00)
**PERF: 0.00 (3.94)
**PERF: 0.00 (3.89)
**PERF: 0.00 (3.84)
**PERF: 0.00 (3.79)
**PERF: 0.00 (3.74)
**PERF: 0.00 (3.69)
** WARN: <watch_source_status:739>: No data from source 0 since last 60 sec. Trying reconnection
** INFO: <reset_source_pipeline:1572>: Resetting source 0
**PERF: 0.00 (3.64)
** ERROR: <cb_newpad3:500>: Failed to link depay loader to rtsp src
** INFO: <bus_callback:206>: Pipeline running

I20231019 08:27:15.610008 42521 deepstream_app.cpp:207] Sending notice now…
ERROR from sink_sub_bin_sink1: Could not write to resource.
Debug info: gstrtmpsink.c(283): gst_rtmp_sink_render (): /GstPipeline:pipeline/GstBin:processing_bin_0/GstBin:sink_bin/GstBin:sink_sub_bin1/GstRTMPSink:sink_sub_bin_sink1:
Failed to write data
** INFO: <bus_callback:246>: Received EOS. Exiting …

ERROR from sink_bin_queue: Internal data stream error.
Debug info: gstqueue.c(988): gst_queue_handle_sink_event (): /GstPipeline:pipeline/GstBin:processing_bin_0/GstBin:sink_bin/GstQueue:sink_bin_queue:
streaming stopped, reason error (-5)
[NvMultiObjectTracker] De-initialized
App run failed
end!

how to solve this problem?

note: we use rtsp input stream for testing reconnect input stream in unstable input video stream ,rather than rtmp stream .

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

Do you configure rtsp-reconnect-attempts value to 10 ? It means number of reconnection.

If the number of reconnections reaches 10, reconnection will exit.

-1 means unlimited times, you can try it.

If you have more questions, can you give me detail log like GST_DEBUG=3 ./deepstream-app ?

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