Kinesis Video Service API request putMedia times out with no HTTP code depending on camera

0

Hi, we're having some issues with sending up an RTSP stream to KVS.

  • We have a few cameras on site: One camera (model AXIS M3206-LVE) works and the other (model AXIS P1448-LE) does not. Both of them are updated to latest LTM firmware. Cameras are on timezone GMT+1.
  • Both are on the same network and under the same firewall rules, the RTSP link is the same.
  • I am using the example kvs_gstreamer_sample from the CPP producer SDK with no modifications.
  • Running this sample application on an EC2 instance of type t2.micro on us-east-1.
  • Streaming to a KVS instance on us-west-2.
  • This application setup works with a public RTSP test stream (rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4).
  • The RTSP stream works on VLC no matter what camera.

The core problem appears to be the API request putMedia which times out after 30 seconds with HTTP code 0.

I've tried lowering factors like resolution and bitrate to minimums but get the same behavior everytime.

Could we be hitting a KVS limit of some kind? Is there a significant camera setting that may be different between the two?

[INFO ] [01-03-2023 00:21:03:643.863 GMT] Using region: us-west-2
[INFO ] [01-03-2023 00:21:03:643.903 GMT] Using aws credentials for Kinesis Video Streams
[INFO ] [01-03-2023 00:21:03:643.911 GMT] Session token detected.
[INFO ] [01-03-2023 00:21:03:645.027 GMT] createKinesisVideoClient(): Creating Kinesis Video Client
[INFO ] [01-03-2023 00:21:03:645.081 GMT] heapInitialize(): Initializing native heap with limit size 134217728, spill ratio 0% and flags 0x00000001
[INFO ] [01-03-2023 00:21:03:645.091 GMT] heapInitialize(): Creating AIV heap.
[INFO ] [01-03-2023 00:21:03:645.109 GMT] heapInitialize(): Heap is initialized OK
[DEBUG] [01-03-2023 00:21:03:645.260 GMT] getSecurityTokenHandler invoked
[DEBUG] [01-03-2023 00:21:03:645.294 GMT] Refreshing credentials. Force refreshing: 0 Now time is: 1677630063645278575 Expiration: 0
[INFO ] [01-03-2023 00:21:03:645.308 GMT] New credentials expiration is 1677633663
[INFO ] [01-03-2023 00:21:03:645.329 GMT] createDeviceResultEvent(): Create device result event.
[DEBUG] [01-03-2023 00:21:03:645.342 GMT] clientReadyHandler invoked
[DEBUG] [01-03-2023 00:21:03:645.370 GMT] Client is ready
[INFO ] [01-03-2023 00:21:03:645.426 GMT] Creating Kinesis Video Stream KVS_Test
[INFO ] [01-03-2023 00:21:03:645.452 GMT] createKinesisVideoStream(): Creating Kinesis Video Stream.
[INFO ] [01-03-2023 00:21:03:645.461 GMT] logStreamInfo(): SDK version: 8867047d8d8f56645009ed73788a57f0a6107772
[DEBUG] [01-03-2023 00:21:03:645.477 GMT] logStreamInfo(): Kinesis Video Stream Info
[DEBUG] [01-03-2023 00:21:03:645.483 GMT] logStreamInfo():      Stream name: KVS_Test
[DEBUG] [01-03-2023 00:21:03:645.488 GMT] logStreamInfo():      Streaming type: STREAMING_TYPE_REALTIME
[DEBUG] [01-03-2023 00:21:03:645.494 GMT] logStreamInfo():      Content type: video/h264
[DEBUG] [01-03-2023 00:21:03:645.499 GMT] logStreamInfo():      Max latency (100ns): 600000000
[DEBUG] [01-03-2023 00:21:03:645.505 GMT] logStreamInfo():      Fragment duration (100ns): 20000000
[DEBUG] [01-03-2023 00:21:03:645.510 GMT] logStreamInfo():      Key frame fragmentation: Yes
[DEBUG] [01-03-2023 00:21:03:645.515 GMT] logStreamInfo():      Use frame timecode: Yes
[DEBUG] [01-03-2023 00:21:03:645.520 GMT] logStreamInfo():      Absolute frame timecode: Yes
[DEBUG] [01-03-2023 00:21:03:645.525 GMT] logStreamInfo():      Nal adaptation flags: 0
[DEBUG] [01-03-2023 00:21:03:645.531 GMT] logStreamInfo():      Average bandwith (bps): 4194304
[DEBUG] [01-03-2023 00:21:03:645.536 GMT] logStreamInfo():      Framerate: 25
[DEBUG] [01-03-2023 00:21:03:645.541 GMT] logStreamInfo():      Buffer duration (100ns): 1200000000
[DEBUG] [01-03-2023 00:21:03:645.546 GMT] logStreamInfo():      Replay duration (100ns): 400000000
[DEBUG] [01-03-2023 00:21:03:645.552 GMT] logStreamInfo():      Connection Staleness duration (100ns): 600000000
[DEBUG] [01-03-2023 00:21:03:645.557 GMT] logStreamInfo():      Store Pressure Policy: 1
[DEBUG] [01-03-2023 00:21:03:645.562 GMT] logStreamInfo():      View Overflow Policy: 1
[DEBUG] [01-03-2023 00:21:03:645.567 GMT] logStreamInfo():      Segment UUID: NULL
[DEBUG] [01-03-2023 00:21:03:645.572 GMT] logStreamInfo():      Frame ordering mode: 0
[DEBUG] [01-03-2023 00:21:03:645.578 GMT] logStreamInfo(): Track list
[DEBUG] [01-03-2023 00:21:03:645.583 GMT] logStreamInfo():      Track id: 1
[DEBUG] [01-03-2023 00:21:03:645.588 GMT] logStreamInfo():      Track name: kinesis_video
[DEBUG] [01-03-2023 00:21:03:645.593 GMT] logStreamInfo():      Codec id: V_MPEG4/ISO/AVC
[DEBUG] [01-03-2023 00:21:03:645.598 GMT] logStreamInfo():      Track type: TRACK_INFO_TYPE_VIDEO
[DEBUG] [01-03-2023 00:21:03:645.603 GMT] logStreamInfo():      Track cpd: NULL
[INFO ] [01-03-2023 00:21:03:971.626 GMT] writeHeaderCallback(): RequestId: e3964ea7-515e-44d0-bd35-d1e512013200
[DEBUG] [01-03-2023 00:21:03:971.705 GMT] describeStreamCurlHandler(): DescribeStream API response: {"StreamInfo":{"CreationTime":1.xxx,"DataRetentionInHours":2,"DeviceName":null,"IngestionConfiguration":null,"KmsKeyId":"arn:aws:kms:us-west-2:xxx:alias/aws/kinesisvideo","MediaType":null,"Status":"ACTIVE","StreamARN":"arn:aws:kinesisvideo:us-west-2:xxx:stream/KVS_Test/xxx","StreamName":"KVS_Test","Version":"gUDmvDqhXD2UvN2LfaKg"}}
[INFO ] [01-03-2023 00:21:03:972.581 GMT] describeStreamResultEvent(): Describe stream result event.
[WARN ] [01-03-2023 00:21:03:972.606 GMT] describeStreamResult(): Content type returned from the DescribeStream call doesn't match the one specified in the StreamInfo
[INFO ] [01-03-2023 00:21:04:268.965 GMT] writeHeaderCallback(): RequestId: ---
[DEBUG] [01-03-2023 00:21:04:269.035 GMT] getStreamingEndpointCurlHandler(): GetStreamingEndpoint API response: {"DataEndpoint":"https://s-xxx.kinesisvideo.us-west-2.amazonaws.com"}
[INFO ] [01-03-2023 00:21:04:269.873 GMT] getStreamingEndpointResultEvent(): Get streaming endpoint result event.
[DEBUG] [01-03-2023 00:21:04:269.905 GMT] getStreamingTokenHandler invoked
[DEBUG] [01-03-2023 00:21:04:269.920 GMT] Refreshing credentials. Force refreshing: 1 Now time is: 1677630064269916059 Expiration: 1677633663
[INFO ] [01-03-2023 00:21:04:269.930 GMT] New credentials expiration is 1677633664
[INFO ] [01-03-2023 00:21:04:270.137 GMT] getStreamingTokenResultEvent(): Get streaming token result event.
[DEBUG] [01-03-2023 00:21:04:270.168 GMT] streamReadyHandler invoked
[DEBUG] [01-03-2023 00:21:04:270.253 GMT] Stream is ready
[INFO ] [01-03-2023 00:21:04:279.121 GMT] Streaming from rtsp source
New pad found: recv_rtp_src_0_2969680287_96
[INFO ] [01-03-2023 00:21:06:109.477 GMT] Pad link successful
[INFO ] [01-03-2023 00:21:06:121.515 GMT] kinesisVideoStreamFormatChanged(): Stream format changed.
[INFO ] [01-03-2023 00:21:06:142.011 GMT] putStreamResultEvent(): Put stream result event. New upload handle 0
[INFO ] [01-03-2023 00:21:06:498.228 GMT] writeHeaderCallback(): RequestId: ---
[DEBUG] [01-03-2023 00:21:07:118.992 GMT] postReadCallback(): Pausing CURL read for upload handle: 0
[WARN ] [01-03-2023 00:21:36:499.120 GMT] curlCompleteSync(): curl perform failed for url https://s-xxx.kinesisvideo.us-west-2.amazonaws.com/putMedia with result Timeout was reached: Operation too slow. Less than 30 bytes/sec transferred the last 30 seconds
[WARN ] [01-03-2023 00:21:36:499.363 GMT] curlCompleteSync(): HTTP Error 0 : Response: (null)
Request URL: https://s-xxx.kinesisvideo.us-west-2.amazonaws.com/putMedia
Request Headers:
    Authorization: AWS4-HMAC-SHA256 Credential=99999999999999999999/99999999/us-west-2/kinesisvideo/aws4_request, SignedHeaders=connection;host;transfer-encoding;user-agent;x-amz-date;x-amzn-fragment-acknowledgment-required;x-amzn-fragment-timecode-type;x-amzn-producer-start-timestamp;x-amzn-stream-name, Signature=xxx
[DEBUG] [01-03-2023 00:21:36:499.376 GMT] putStreamCurlHandler(): Network thread for Kinesis Video stream: KVS_Test with upload handle: 0 exited. http status: 0
[WARN ] [01-03-2023 00:21:36:499.480 GMT] putStreamCurlHandler(): Stream with streamHandle 94552842981056 uploadHandle 0 has exited without triggering end-of-stream. Service call result: 599
[INFO ] [01-03-2023 00:21:36:499.495 GMT] kinesisVideoStreamTerminated(): Stream 0x55fecc9e4ec0 terminated upload handle 0 with service call result 599.
[DEBUG] [01-03-2023 00:21:36:499.514 GMT] defaultStreamStateTransitionHook(): Stream state machine retry count: 0
[DEBUG] [01-03-2023 00:21:36:499.520 GMT] defaultStreamStateTransitionHook():
 KinesisVideoStream base result is [599]. Executing KVS retry handler of retry strategy type [1]
[DEBUG] [01-03-2023 00:21:36:502.335 GMT] defaultStreamStateTransitionHook(): Stream state machine retry count: 1
[DEBUG] [01-03-2023 00:21:36:502.355 GMT] defaultStreamStateTransitionHook():
 KinesisVideoStream base result is [599]. Executing KVS retry handler of retry strategy type [1]
[DEBUG] [01-03-2023 00:21:36:502.367 GMT] streamReadyHandler invoked
[DEBUG] [01-03-2023 00:21:36:502.378 GMT] defaultStreamStateTransitionHook(): Stream state machine retry count: 2
[DEBUG] [01-03-2023 00:21:36:502.384 GMT] defaultStreamStateTransitionHook():
 KinesisVideoStream base result is [599]. Executing KVS retry handler of retry strategy type [1]
[INFO ] [01-03-2023 00:21:36:502.453 GMT] putStreamResultEvent(): Put stream result event. New upload handle 1
[INFO ] [01-03-2023 00:21:37:443.049 GMT] writeHeaderCallback(): RequestId: ---
[DEBUG] [01-03-2023 00:21:38:063.675 GMT] postReadCallback(): Pausing CURL read for upload handle: 1
[WARN ] [01-03-2023 00:22:07:443.940 GMT] curlCompleteSync(): curl perform failed for url https://s-99999999.kinesisvideo.us-west-2.amazonaws.com/putMedia with result Timeout was reached: Operation too slow. Less than 30 bytes/sec transferred the last 30 seconds
[WARN ] [01-03-2023 00:22:07:444.182 GMT] curlCompleteSync(): HTTP Error 0 : Response: (null)
Request URL: https://s-99999999.kinesisvideo.us-west-2.amazonaws.com/putMedia
Request Headers:
    Authorization: AWS4-HMAC-SHA256 Credential=99999999999999999999/99999999/us-west-2/kinesisvideo/aws4_request, SignedHeaders=connection;host;transfer-encoding;user-agent;x-amz-date;x-amzn-fragment-acknowledgment-required;x-amzn-fragment-timecode-type;x-amzn-producer-start-timestamp;x-amzn-stream-name, Signature=67977716665ec43998572003f4e7a07c3bae43c95b1fd4a
[DEBUG] [01-03-2023 00:22:07:444.195 GMT] putStreamCurlHandler(): Network thread for Kinesis Video stream: KVS_Test with upload handle: 1 exited. http status: 0
[WARN ] [01-03-2023 00:22:07:444.291 GMT] putStreamCurlHandler(): Stream with streamHandle 94552842981056 uploadHandle 1 has exited without triggering end-of-stream. Service call result: 599
2 Answers
0

Hi, The video track of each fragment must contain codec private data in the Advanced Video Coding (AVC) for H.264 format or HEVC for H.265 format (MPEG-4 specification ISO/IEC 14496-15). For information about adapting stream data to a given format, see NAL Adaptation Flags. I would start with extracting the camera settings that work and make a comparison with the setting of the camera which does not work (in the encoding section). you are using two different models and each might very well use a different encoder. Then I will look into the networking: your second camera is connected to the same circuit? You might have networking issues - did you try to use the nonworking camera on the same port instead of the working one? If identical, you might have issues with fragmentation; check the gstreamer. You might have to modify gstreamer parameters to get it working with your rtsp camera

profile pictureAWS
answered a year ago
0

To answer your question, we require details that are non-public information. Please open a support case with AWS using the following https://console.aws.amazon.com/support/home#/case/create

AWS
SUPPORT ENGINEER
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions