amazon-kinesis-video-streams-producer-sdk-cpp: Internal data stream error when streaming from RTSP source.

I’m using the producer library in a Docker container to stream from RTSP source. The RTSP source is Amcrest cameras (model # AMNV20M8-4B-B).

I’m using the following startup script to trigger the stream.

#!/bin/bash

AWS_ACCESS_KEY_ID=$1 AWS_SECRET_ACCESS_KEY=$2 AWS_DEFAULT_REGION="us-east-1" gst-launch-1.0 rtspsrc location=rtsp://$3 short-header=TRUE ! rtph264depay ! video/x-h264, format=avc,alignment=au ! kvssink stream-name=$4 storage-size=512

There are 2 issues. It tries to receive UDP packets for 5 seconds and then switches to TCP. On my Mac, I have switched off firewall to ensure that’s not a problem.

After it switches to TCP it gives warnings about could not transform video/x-h264 and eventually fails with internal data stream error.

Below are the logs after the pipeline starts playing.

Progress: (open) Retrieving server options

Progress: (open) Retrieving media info

Progress: (request) SETUP stream 0

Progress: (open) Opened Stream

Setting pipeline to PLAYING ...

0:00:00.373601700   267      0x1baaef0 WARN                     bin gstbin.c:2772:gst_bin_do_latency_func:<pipeline0> did not really configure latency of 0:00:00.000000000

New clock: GstSystemClock

Progress: (request) Sending PLAY request

Progress: (request) Sending PLAY request

0:00:00.375093800   267 0x7f416803e450 FIXME                default gstutils.c:3902:gst_pad_create_stream_id_internal:<fakesrc0:src> Creating random stream-id, consider implementing a deterministic way of creating a stream-id

Progress: (request) Sent PLAY request

0:00:05.572830600   267      0x1bab450 WARN                 rtspsrc gstrtspsrc.c:4936:gst_rtspsrc_reconnect:<rtspsrc0> warning: Could not receive any UDP packets for 5.0000 seconds, maybe your firewall is blocking it. Retrying using a tcp connection.

WARNING: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not read from resource.

Additional debug info:

gstrtspsrc.c(4936): gst_rtspsrc_reconnect (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
Could not receive any UDP packets for 5.0000 seconds, maybe your firewall is blocking it. Retrying using a tcp connection.

0:00:08.287093000   267 0x7f416803cb70 WARN           basetransform gstbasetransform.c:1346:gst_base_transform_setcaps:<capsfilter0> transform could not transform video/x-h264, stream-format=(string)avc, alignment=(string)au, codec_data=(buffer)01640028ffe1000d27640028ac1ad00f0044bca80001000628ee0462c000, level=(string)4, profile=(string)high in anything we support

0:00:08.288605800   267 0x7f416803cb70 WARN           basetransform gstbasetransform.c:1346:gst_base_transform_setcaps:<capsfilter0> transform could not transform video/x-h264, stream-format=(string)avc, alignment=(string)au, codec_data=(buffer)01640028ffe1000d27640028ac1ad00f0044bca80001000628ee0462c000, level=(string)4, profile=(string)high in anything we support

0:00:08.288699500   267 0x7f416803cb70 WARN           basetransform gstbasetransform.c:1346:gst_base_transform_setcaps:<capsfilter0> transform could not transform video/x-h264, stream-format=(string)avc, alignment=(string)au, codec_data=(buffer)01640028ffe1000d27640028ac1ad00f0044bca80001000628ee0462c000, level=(string)4, profile=(string)high in anything we support

0:00:08.388455700   267      0x1bab450 WARN                 rtspsrc gstrtspsrc.c:5162:gst_rtspsrc_loop:<rtspsrc0> error: Internal data stream error.

0:00:08.388699000   267      0x1bab450 WARN                 rtspsrc gstrtspsrc.c:5162:gst_rtspsrc_loop:<rtspsrc0> error: streaming stopped, reason not-negotiated (-4)

ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Internal data stream error.

Additional debug info:

gstrtspsrc.c(5162): gst_rtspsrc_loop (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
streaming stopped, reason not-negotiated (-4)

Execution ended after 0:00:08.015984100

Setting pipeline to PAUSED ...

Setting pipeline to READY ...

Setting pipeline to NULL ...

0:00:08.391575500   267      0x1bab450 WARN                 rtspsrc gstrtspsrc.c:5466:gst_rtspsrc_try_send:<rtspsrc0> receive interrupted

0:00:08.391630000   267      0x1bab450 WARN                 rtspsrc gstrtspsrc.c:6974:gst_rtspsrc_close:<rtspsrc0> TEARDOWN interrupted

Freeing pipeline ...

INFO - Freeing Kinesis Video Stream rtspdockertest

2019-03-13 17:34:51 [139919806072640] INFO -
freeKinesisVideoStream(): Freeing Kinesis Video stream.

2019-03-13 17:34:51 [139919806072640] DEBUG - streamClosedHandler invoked for upload handle: 18446744073709551615

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 33 (15 by maintainers)

Commits related to this issue

Most upvoted comments

can you try this pipeline?

AWS_ACCESS_KEY_ID=$1 AWS_SECRET_ACCESS_KEY=$2 AWS_DEFAULT_REGION="us-east-1" gst-launch-1.0 rtspsrc location=rtsp://$3 ! rtph264depay ! h264parse ! kvssink stream-name=$4 storage-size=512

@chehefen

The following command worked.

GST_DEBUG=3 GST_DEBUG_NO_COLOR=1 AWS_ACCESS_KEY_ID=$1 AWS_SECRET_ACCESS_KEY=$2 AWS_DEFAULT_REGION="us-east-1" gst-launch-1.0 rtspsrc location=rtsp://user:password@192.168.1.197:554 short-header=TRUE ! rtph264depay ! video/x-h264,framerate=25/1 ! h264parse ! kvssink stream-name=rtspdockertest storage-size=512

However, it did not stabilize the frame rate. Below are the sample metrics.

getKinesisVideoMetrics(): Get the memory metrics size.
2019-03-21 19:46:34 [140141360314112] DEBUG - Kinesis Video client and stream metrics
	>> Overall storage byte size: 536870912
	>> Available storage byte size: 535596807
	>> Allocated storage byte size: 1274105
	>> Total view allocation byte size: 144072
	>> Total streams frame rate (fps): 407
	>> Total streams transfer rate (bps): 6124976 (5981 Kbps)
	>> Current view duration (ms): 400
	>> Overall view duration (ms): 6000
	>> Current view byte size: 340697
	>> Overall view byte size: 1271686
	>> Current frame rate (fps): 407.17
	>> Current transfer rate (bps): 6124976 (5981 Kbps)

It varies a lot but always in hundreds.