Pipeline Cannot Parse RTMP Stream

• Ubuntu 18.04
• Jetson NX (not the devkit)
• DeepStream 6.0, JetPack 4.6, TensorRT 8.0.1.6
• Ffmpeg version 3.4.11-ubuntu0.1

Good day,

My colleague and I are trying to run our GStreamer pipeline (compiled in C++) using rtmp feeds. It works properly when the source is an rtsp URI, but not so well when it is an rtmp URI.

We first list down some ffmpeg commands in a .Json file, each pertaining to a different video source. The rtmp URIs are then re-published using an rtmp server similar to nginx’s rtmp.

This is how we generate the ffmpeg command in the JSON:

{
  "apps": [
     {
       "name": "test", 
       "script": "ffmpeg -r 30 -f lavfi -re -i \"movie=test.mp4\" -vf scale=704:480 -vcodec libx264 -profile:v baseline -pix_fmt yuv420p -f flv rtmp://localhost:1936/test",
       "namespace": "camera"
     }

     {
       "... "
     }
}

We have a catch in our code to indicate that the pipeline cannot bring the uridecode bin, that is created using that rtmp feed, into the PLAYING state. Also, the GStreamer pipeline throws the following error in the terminal output on receiving and attempting to play the rtmp feed:

WARNING from elementsrc_0 : Could not parse RTMP URI
Error details: gsturidecodebin.c(1415) gen_source_element… No element accepted URI ‘rtmp://…’

Aside from this, we previously generated the same rtmp stream using a short ffmpeg program, that is, without the rtmp server, and it ran in our pipeline without challenges.

We aren’t sure whether the issue here is to do with the encoding/decoding and were hoping you could shed some light on it. If my question is missing some pertinent info, do raise this and I’ll try improve it.

Thank you for any help you can provide.

Can the rtmp stream be played by other players such as VLC player, ffmpeg player,… in the same device?

Strangely, yes
It plays on both those players

Is there complete error log for the failure?

Well, the gst_debug.log shows the following:

0:00:09.233189383 e[335m22816e[00m 0x55a3914890 e[36mINFO e[00m e[00m nvinfer gstnvinfer.cpp:638:gst_nvinfer_logger:e[00m NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::deserializeEngineAndBackend() <nvdsinfer_context_impl.cpp:1900> [UID = 1]: deserialized trt engine from :/our/inference/folder/path/inference/resnet/resnet10.caffemodel_b30_gpu0_int8.engine

0:00:09.233507463 e[335m22816e[00m 0x55a3914890 e[36mINFO e[00m e[00m nvinfer gstnvinfer.cpp:638:gst_nvinfer_logger:e[00m NvDsInferContext[UID 1]: Info from NvDsInferContextImpl::generateBackendContext() <nvdsinfer_context_impl.cpp:2004> [UID = 1]: Use deserialized engine model: /our/inference/folder/path/inference/resnet/resnet10.caffemodel_b30_gpu0_int8.engine

0:00:09.312833677 e[335m22816e[00m 0x55a3914890 e[36mINFO e[00m e[00m nvinfer gstnvinfer_impl.cpp:313:notifyLoadModelStatus:e[00m [UID 1]: Load new model:…/…/our/config/folder/path/config/config_resnet.txt sucessfully

0:00:10.367560875 e[335m22816e[00m 0x55a38fc300 e[31;01mERROR e[00m e[00m rtmpsrc gstrtmpsrc.c:243:gst_rtmp_src_uri_set_uri:e[00m Failed to parse URI rtmp://127.0.0.1:1936/xxxx

0:00:15.706740475 e[335m22816e[00m 0x55a38fc300 e[31;01mERROR e[00m e[00m rtmpsrc gstrtmpsrc.c:243:gst_rtmp_src_uri_set_uri:e[00m Failed to parse URI rtmp://127.0.0.1:1936/xxxx

It is coherent with the error message printed from terminal:

2022-12-30T14:25:06 Creating uridecodebin src_0

(Analytics:22816): GStreamer-CRITICAL **: 14:25:06.544: gst_element_get_state: assertion ‘GST_IS_ELEMENT (element)’ failed

(Analytics:22816): GStreamer-CRITICAL **: 14:25:06.545: gst_element_get_state: assertion ‘GST_IS_ELEMENT (element)’ failed

(Analytics:22816): GStreamer-CRITICAL **: 14:25:06.545: gst_element_get_state: assertion ‘GST_IS_ELEMENT (element)’ failed

(Analytics:22816): GStreamer-CRITICAL **: 14:25:06.545: gst_element_get_state: assertion ‘GST_IS_ELEMENT (element)’ failed
2022-12-30T14:25:06 State change failed
2022-12-30T14:25:06 WARNING from elementsrc_0 : Could not parse RTMP URI
2022-12-30T14:25:06 Error details: gsturidecodebin.c(1415): gen_source_element (): /GstPipeline:main-pipeline/GstURIDecodeBin:src_0:
No element accepted URI ‘rtmp://127.0.0.1:1936/xxxx’
2022-12-30T14:25:06 Sent create_feed_status to Logic
2022-12-30T14:25:06 Number of feeds: 0
Listening…
[NvMultiObjectTracker] De-initialized
2022-12-30T14:25:06 Deleting pipelines

(Analytics:22816): GStreamer-CRITICAL **: 14:25:06.670: gst_element_get_state: assertion ‘GST_IS_ELEMENT (element)’ failed

Hello again @Fiona.Chen
Are there any other things that can render the rtmp URI incapable of being parsed? Perhaps you and your team can advise some other things for us to investigate

I tried the rtmp source with uridecodebin pipeline on DeepStream 6.1.1, it failed. We will check this issue.

@Fiona.Chen Thank you!

Hey @Fiona.Chen, just checking in so the thread doesn’t get closed

Can I confirm with you the result of running the following pipeline?
gst-launch-1.0 uridecodebin uri=rtmp://xxxxxxx ! nvvideoconvert ! fakesink

I believe this would require me generating the ffmpeg rtmp stream first.

So I run:

ffmpeg -stream_loop -1 -r 30 -f lavfi -re -i “movie=xxxx.mp4” -an -c:v libx264 -profile:v baseline -pix_fmt yuv420p -strict -2 -f flv rtmp://localhost:2023/xxxx

Then after it begins streaming, I launch:

gst-launch-1.0 uridecodebin uri=rtmp://localhost:2023/xxxx ! nvvideoconvert ! fakesink

Setting pipeline to PAUSED …
ERROR: Pipeline doesn’t want to pause.
ERROR: from element /GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0: Could not parse RTMP URI
Additional debug info:
gsturidecodebin.c(1415): gen_source_element (): /GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0:
No element accepted URI ‘rtmp://localhost:2023/xxxx’
Setting pipeline to NULL …
Freeing pipeline …

After which it terminates, even as the ffmpeg rtmp stream is still streaming.

Although I should mention that when I use the test rtmp address I found on StackOverflow: rtmp://localhost/live/test, the command you sent works without issue for different videos we try to stream.

Running:

ffmpeg -r 30 -f lavfi -i “movie=xxxx.mp4” -vf scale=704:480 -vcodec libx264 -profile:v baseline -pix_fmt yuv420p -f flv rtmp://localhost/live/test

Then:

$ gst-launch-1.0 uridecodebin uri=rtmp://localhost/live/test ! nvvideoconvert ! fakesink

Setting pipeline to PAUSED …
Pipeline is PREROLLING …
Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
Prerolled, waiting for buffering to finish…
Pipeline is PREROLLED …
Setting pipeline to PLAYING …
New clock: GstSystemClock
Buffering, setting pipeline to PAUSED …
Done buffering, setting pipeline to PLAYING …
Buffering, setting pipeline to PAUSED …
buffering… 33%

I believe it is meant for testing, and we would of course prefer to use our own rtmp address, so this solution isn’t optimal for our use case.

So it is your rtmp server issue. You need to set up your rtmp server correctly. It has nothing to do with DeepStream, DeepStream app is just a client.

1 Like

Thank you for the much-needed help you’ve afforded me. Though I thought this, I did not have the data to confirm it without doubt. I’ve relayed your message to the relevant team. We’re grateful @Fiona.Chen

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