How to run H265 RTSP IP camera in deepstream_app

Greetings,

Below i have mentioned details of camera that I am using,

  • HikVision Camera
  • H.265+ encodings
  • model: DS-2CD202WF-I

When I play the url in VSPlayer I am able to view the stream.

If I run this command

gst-launch-1.0 uridecodebin rtsp://<admin>:<password>@192.168.0.175:554/Stream/Channels/101 ! nvoverlaysink

I get

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://<admin>:<password>@192.168.0.175:554/Stream/Channels/101
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
ERROR: from element /GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0/GstRTSPSrc:source: Unauthorized
Additional debug info:
gstrtspsrc.c(6116): gst_rtspsrc_send (): /GstPipeline:pipeline0/GstURIDecodeBin:uridecodebin0/GstRTSPSrc:source:
Unauthorized (401)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

I tried https://devtalk.nvidia.com/default/topic/1058086/deepstream-sdk/how-to-run-rtp-camera-in-deepstream-on-nano/post/5369243/#5369243 as suggested by DaneLLL but I get a blank screen.

I have also tried https://devtalk.nvidia.com/default/topic/1058086/deepstream-sdk/how-to-run-rtp-camera-in-deepstream-on-nano/post/5367474/#5367474

and I get the blankscreen again

deepstream-app -c /home/botjet/PD_Wrk/deepstream_sdk_v4.0.1_jetson/samples/configs/deepstream-app/source8_1080p_dec_infer-resnet_tracker_tiled_display_fp16_tx1.txt
Creating LL OSD context new
cb_sourcesetup set 100 latency
cb_sourcesetup set 100 latency

Runtime commands:
	h: Print this help
	q: Quit

	p: Pause
	r: Resume

NOTE: To expand a source in the 2D tiled display and view object details, left-click on the source.
      To go back to the tiled display, right-click anywhere on the window.

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

** INFO: <bus_callback:175>: Pipeline running

**PERF: FPS 0 (Avg)	FPS 1 (Avg)	
**PERF: 0.00 (0.00)	0.00 (0.00)	
**PERF: 0.00 (0.00)	0.00 (0.00)	
**PERF: 0.00 (0.00)	0.00 (0.00)	
**PERF: 0.00 (0.00)	0.00 (0.00)	
**PERF: 0.00 (0.00)	0.00 (0.00)	
ERROR from source: Could not read from resource.
Debug info: gstrtspsrc.c(5917): gst_rtsp_src_receive_response (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin0/GstURIDecodeBin:src_elem/GstRTSPSrc:source:
Could not receive message. (Timeout while waiting for server response)
Quitting
ERROR from source: Could not read from resource.
Debug info: gstrtspsrc.c(5917): gst_rtsp_src_receive_response (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin1/GstURIDecodeBin:src_elem/GstRTSPSrc:source:
Could not receive message. (Timeout while waiting for server response)
App run failed

Thank you.

Hi,
Please check if you can run

$ export RTSP_PATH=rtsp://admin:int123$%^@192.168.0.175:554/Stream/Channels/101
$ gst-launch-1.0 rtspsrc location="$RTSP_PATH" ! rtph265depay ! h265parse ! omxh265dec ! nvoverlaysink
$ gst-launch-1.0 rtspsrc location="$RTSP_PATH" ! rtph265depay ! h265parse ! nvv4l2decoder ! nvoverlaysink

Let’s firstly confirm the URI is valid.

2 Likes

Hello @DaneLLL,

Thank you for your quick reply.

I applied your method in my Jetson nano and the stream is unavailable. So this means my uri is wrong?

Setting pipeline to PAUSED ...
Opening in BLOCKING MODE 
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://<admin>:<password>@192.168.0.175:554/live2.sdp
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Unauthorized
Additional debug info:
gstrtspsrc.c(6116): gst_rtspsrc_send (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
Unauthorized (401)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

I checked these uri in VLC and I get good results,

  • rtsp://:@192.168.0.175:554/Stream/Channels/101
  • rtsp://:@192.168.0.175:554/live2.sdp

I also tried


<ol>
<li>./test-mp4 /home/botjet/PD_Wrk/deepstream_sdk_v4.0.1_jetson/samples/streams/sample_1080p_h265.mp4
stream ready at rtsp://127.0.0.1:8554/test</li>
<li>export RTSP_PATH=rtsp://127.0.0.1:8554/test</li>
<li>gst-launch-1.0 rtspsrc location="$RTSP_PATH" ! rtph265depay ! h265parse ! nvv4l2decoder ! nvoverlaysink</li>
</ol>

and this too gave error

Setting pipeline to PAUSED ...
Opening in BLOCKING MODE 
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://127.0.0.1:8554/test
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not read from resource.
Additional debug info:
gstrtspsrc.c(5917): gst_rtsp_src_receive_response (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
Could not receive message. (Timeout while waiting for server response)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

I will look into my uri and then get back

Thank you.

My mistake,

I have set the camera to H.264 hence it currently works with

gst-launch-1.0 rtspsrc location="$RTSP_PATH" ! rtph264depay ! h264parse ! omxh264dec ! nvoverlaysink

Thank you DaneLLL for setting me in the right path.

gst-launch-1.0 rtspsrc location="$RTSP_PATH" ! rtph264depay ! h264parse ! omxh264dec ! nvoverlaysink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://<admin>:<password>@192.168.0.175:554/live2.sdp
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
Progress: (request) SETUP stream 0
Progress: (open) Opened Stream
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Progress: (request) Sending PLAY request
Progress: (request) Sending PLAY request
Progress: (request) Sent PLAY request

(gst-launch-1.0:15161): GStreamer-CRITICAL **: 12:05:55.340: gst_caps_is_empty: assertion 'GST_IS_CAPS (caps)' failed

(gst-launch-1.0:15161): GStreamer-CRITICAL **: 12:05:55.340: gst_caps_truncate: assertion 'GST_IS_CAPS (caps)' failed

(gst-launch-1.0:15161): GStreamer-CRITICAL **: 12:05:55.340: gst_caps_fixate: assertion 'GST_IS_CAPS (caps)' failed

(gst-launch-1.0:15161): GStreamer-CRITICAL **: 12:05:55.341: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed

(gst-launch-1.0:15161): GStreamer-CRITICAL **: 12:05:55.341: gst_structure_get_string: assertion 'structure != NULL' failed

(gst-launch-1.0:15161): GStreamer-CRITICAL **: 12:05:55.341: gst_mini_object_unref: assertion 'mini_object != NULL' failed
NvMMLiteOpen : Block : BlockType = 261 
NVMEDIA: Reading vendor.tegra.display-size : status: 6 
NvMMLiteBlockCreate : Block : BlockType = 261 
Allocating new output: 1920x1088 (x 12), ThumbnailMode = 0
OPENMAX: HandleNewStreamFormat: 3605: Send OMX_EventPortSettingsChanged: nFrameWidth = 1920, nFrameHeight = 1080 
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:01:38.549964059
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

But I tried it in deepstream app and there is some problem while output since the video gives some pixel error in video (looks like the output from different bin is played together, since I saw same action performed by us repeats like 3 times when we move)

by error in video i meant: If I move my hand to one direction the output window shows I moved it three times in that directon with pixel errors. So is this usual case when you shift from web cam to rtsp or do we have solution?

Thank You

Hi,
You may attach config file for reference. Would be great if you can also share brand and model ID of the IP camera.

@DaneLLL

I got the same result as @akshaypd156 when using the omxh264dec (which I presume is going to be depreciated). I tried the nvv4ldecoder and got the following error messages ( GStreamer- CRITICAL **: 12:06:27.523: gst_mini_object_unref: assertion ‘mini_object != NULL’ failed) :

$ gst-launch-1.0 rtspsrc location="$RTSP_PATH" ! rtph264depay ! h264parse ! nvv4l2decoder ! nvoverlaysink

Setting pipeline to PAUSED …

Opening in BLOCKING MODE

Pipeline is live and does not need PREROLL …

Progress: (open) Opening Stream

Progress: (connect) Connecting to rtsp://192.168.1.168:8554/0

Progress: (open) Retrieving server options

Progress: (open) Retrieving media info

Progress: (request) SETUP stream 0

Progress: (request) SETUP stream 1

Progress: (open) Opened Stream

Setting pipeline to PLAYING …

New clock: GstSystemClock

Progress: (request) Sending PLAY request

Progress: (request) Sending PLAY request

Progress: (request) Sent PLAY request

NvMMLiteOpen : Block : BlockType = 261

NVMEDIA: Reading vendor.tegra.display-size : status: 6

NvMMLiteBlockCreate : Block : BlockType = 261

(gst-launch-1.0:12314): GStreamer- CRITICAL **: 12:06:27.523: gst_mini_object_unref: assertion ‘mini_object != NULL’ failed

^Chandling interrupt.

Interrupt: Stopping pipeline …

Execution ended after 0:00:08.783611470

Setting pipeline to PAUSED …

Setting pipeline to READY …

Hi james1122,

Please help to open a new topic for your issue. Thanks

2 Likes

Hello,

In vlc, you can check the video at the following address.
rtsp://root:root@10.10.221.37:554/cam0_2

But when I run it with gst-launch, I can’t check the video.
Can you tell me what the problem is by looking at the following log?

nvidia@nvidia-desktop:/opt/nvidia/deepstream/deepstream-5.1/samples/configs/deepstream-app$ export RTSP_PATH=rtsp://root:root@10.10.221.37:554/cam0_2
nvidia@nvidia-desktop:/opt/nvidia/deepstream/deepstream-5.1/samples/configs/deepstream-app$ gst-launch-1.0 rtspsrc location="$RTSP_PATH" ! rtph265depay ! h265parse ! omxh265dec ! nvoverlaysink
Setting pipeline to PAUSED …
Pipeline is live and does not need PREROLL …
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://root:root@10.10.221.37:554/cam0_2
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
Progress: (request) SETUP stream 0
Progress: (request) SETUP stream 1
Progress: (open) Opened Stream
Setting pipeline to PLAYING …
New clock: GstSystemClock
Progress: (request) Sending PLAY request
Progress: (request) Sending PLAY request
Progress: (request) Sent PLAY request
WARNING: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Delayed linking failed.
Additional debug info:
./grammar.y(510): gst_parse_no_more_pads (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
failed delayed linking some pad of GstRTSPSrc named rtspsrc0 to some pad of GstRtpH265Depay named rtph265depay0
^Chandling interrupt.
Interrupt: Stopping pipeline …
Execution ended after 0:00:50.260977370
Setting pipeline to PAUSED …
Setting pipeline to READY …
Setting pipeline to NULL …
Freeing pipeline …
nvidia@nvidia-desktop:/opt/nvidia/deepstream/deepstream-5.1/samples/configs/deepstream-app$ gst-launch-1.0 rtspsrc location="$RTSP_PATH" ! rtph265depay ! h265parse ! nvv4l2decoder ! nvoverlaysink
Setting pipeline to PAUSED …
Opening in BLOCKING MODE
Opening in BLOCKING MODE
Pipeline is live and does not need PREROLL …
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://root:root@10.10.221.37:554/cam0_2
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
Progress: (request) SETUP stream 0
Progress: (request) SETUP stream 1
Progress: (open) Opened Stream
Setting pipeline to PLAYING …
New clock: GstSystemClock
Progress: (request) Sending PLAY request
Progress: (request) Sending PLAY request
Progress: (request) Sent PLAY request
WARNING: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Delayed linking failed.
Additional debug info:
./grammar.y(510): gst_parse_no_more_pads (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
failed delayed linking some pad of GstRTSPSrc named rtspsrc0 to some pad of GstRtpH265Depay named rtph265depay0

Thank you.