Error received from element source: Could not open resource for reading and writing


I'm trying to stream a CCTV camera with RTSP URL using Amazon Kinesis Video Streams. I've tested the URL in VLC Player and it works fine there. Have also tested the same using ffplay.

The command that I'm using is this.

AWS_ACCESS_KEY_ID=myAccessKey AWS_SECRET_ACCESS_KEY=MySecretKey ./kvs_gstreamer_sample CCTVStream rtsp://myrtspUrl

But upon running this command I am getting this error in my terminal.

And I am failing to understand why exactly is this happening. Can anyone help me understand what am I doing wrong here? Thanks for any help

[INFO ] [29-08-2022 19:42:42:126.828 GMT] Using aws credentials for Kinesis Video Streams [INFO ] [29-08-2022 19:42:42:126.847 GMT] No session token was detected. [INFO ] [29-08-2022 19:42:42:128.475 GMT] createKinesisVideoClient(): Creating Kinesis Video Client [INFO ] [29-08-2022 19:42:42:128.573 GMT] heapInitialize(): Initializing native heap with limit size 134217728, spill ratio 0% and flags 0x00000001 [INFO ] [29-08-2022 19:42:42:128.593 GMT] heapInitialize(): Creating AIV heap. [INFO ] [29-08-2022 19:42:42:128.660 GMT] heapInitialize(): Heap is initialized OK [DEBUG] [29-08-2022 19:42:42:128.880 GMT] getSecurityTokenHandler invoked [DEBUG] [29-08-2022 19:42:42:128.993 GMT] Refreshing credentials. Force refreshing: 0 Now time is: 1661802162128949048 Expiration: 0 [INFO ] [29-08-2022 19:42:42:129.030 GMT] New credentials expiration is 1661805762 [INFO ] [29-08-2022 19:42:42:129.095 GMT] createDeviceResultEvent(): Create device result event. [DEBUG] [29-08-2022 19:42:42:129.137 GMT] clientReadyHandler invoked [DEBUG] [29-08-2022 19:42:42:129.221 GMT] Client is ready [INFO ] [29-08-2022 19:42:42:129.391 GMT] Creating Kinesis Video Stream CCTVStream [INFO ] [29-08-2022 19:42:42:129.473 GMT] createKinesisVideoStream(): Creating Kinesis Video Stream. [INFO ] [29-08-2022 19:42:42:129.508 GMT] logStreamInfo(): SDK version: 70f74f14cf27b09f71dc1889f36eb6e04cdd90a8 [DEBUG] [29-08-2022 19:42:42:129.533 GMT] logStreamInfo(): Kinesis Video Stream Info [DEBUG] [29-08-2022 19:42:42:129.557 GMT] logStreamInfo(): Stream name: CCTVStream [DEBUG] [29-08-2022 19:42:42:129.581 GMT] logStreamInfo(): Streaming type: STREAMING_TYPE_REALTIME [DEBUG] [29-08-2022 19:42:42:129.605 GMT] logStreamInfo(): Content type: video/h264 [DEBUG] [29-08-2022 19:42:42:129.631 GMT] logStreamInfo(): Max latency (100ns): 600000000 [DEBUG] [29-08-2022 19:42:42:129.657 GMT] logStreamInfo(): Fragment duration (100ns): 20000000 [DEBUG] [29-08-2022 19:42:42:129.682 GMT] logStreamInfo(): Key frame fragmentation: Yes [DEBUG] [29-08-2022 19:42:42:129.706 GMT] logStreamInfo(): Use frame timecode: Yes [DEBUG] [29-08-2022 19:42:42:129.730 GMT] logStreamInfo(): Absolute frame timecode: Yes [DEBUG] [29-08-2022 19:42:42:129.755 GMT] logStreamInfo(): Nal adaptation flags: 0 [DEBUG] [29-08-2022 19:42:42:129.853 GMT] logStreamInfo(): Average bandwith (bps): 4194304 [DEBUG] [29-08-2022 19:42:42:129.880 GMT] logStreamInfo(): Framerate: 25 [DEBUG] [29-08-2022 19:42:42:129.903 GMT] logStreamInfo(): Buffer duration (100ns): 1200000000 [DEBUG] [29-08-2022 19:42:42:129.926 GMT] logStreamInfo(): Replay duration (100ns): 400000000 [DEBUG] [29-08-2022 19:42:42:129.950 GMT] logStreamInfo(): Connection Staleness duration (100ns): 600000000 [DEBUG] [29-08-2022 19:42:42:129.984 GMT] logStreamInfo(): Store Pressure Policy: 1 [DEBUG] [29-08-2022 19:42:42:130.007 GMT] logStreamInfo(): View Overflow Policy: 1 [DEBUG] [29-08-2022 19:42:42:130.030 GMT] logStreamInfo(): Segment UUID: NULL [DEBUG] [29-08-2022 19:42:42:130.053 GMT] logStreamInfo(): Frame ordering mode: 0 [DEBUG] [29-08-2022 19:42:42:130.076 GMT] logStreamInfo(): Track list [DEBUG] [29-08-2022 19:42:42:130.098 GMT] logStreamInfo(): Track id: 1 [DEBUG] [29-08-2022 19:42:42:130.120 GMT] logStreamInfo(): Track name: kinesis_video [DEBUG] [29-08-2022 19:42:42:130.144 GMT] logStreamInfo(): Codec id: V_MPEG4/ISO/AVC [DEBUG] [29-08-2022 19:42:42:130.167 GMT] logStreamInfo(): Track type: TRACK_INFO_TYPE_VIDEO [DEBUG] [29-08-2022 19:42:42:130.190 GMT] logStreamInfo(): Track cpd: NULL [INFO ] [29-08-2022 19:42:42:284.250 GMT] writeHeaderCallback(): RequestId: fdfda324-a980-4b67-aa36-5b7566c28c45 [DEBUG] [29-08-2022 19:42:42:284.421 GMT] describeStreamCurlHandler(): DescribeStream API response: {"StreamInfo":{"CreationTime":1.661188397273E9,"DataRetentionInHours":2,"DeviceName":"Kinesis_Video_Device","IngestionConfiguration":null,"KmsKeyId":"arn:aws:kms:ap-south-1:610891839088:alias/aws/kinesisvideo","MediaType":"video/h264","Status":"ACTIVE","StreamARN":"arn:aws:kinesisvideo:ap-south-1:610891839088:stream/CCTVStream/1661188397273","StreamName":"CCTVStream","Version":"KDDt86hr6jaUJ514hMDd"}} [INFO ] [29-08-2022 19:42:42:286.022 GMT] describeStreamResultEvent(): Describe stream result event. [INFO ] [29-08-2022 19:42:42:330.474 GMT] writeHeaderCallback(): RequestId: abb59a91-e0b1-48c6-b1f3-60b307ef9187 [DEBUG] [29-08-2022 19:42:42:330.612 GMT] getStreamingEndpointCurlHandler(): GetStreamingEndpoint API response: {"DataEndpoint":""} [INFO ] [29-08-2022 19:42:42:332.244 GMT] getStreamingEndpointResultEvent(): Get streaming endpoint result event. [DEBUG] [29-08-2022 19:42:42:332.326 GMT] getStreamingTokenHandler invoked [DEBUG] [29-08-2022 19:42:42:332.362 GMT] Refreshing credentials. Force refreshing: 1 Now time is: 1661802162332355752 Expiration: 1661805762 [INFO ] [29-08-2022 19:42:42:332.387 GMT] New credentials expiration is 1661805762 [INFO ] [29-08-2022 19:42:42:332.433 GMT] getStreamingTokenResultEvent(): Get streaming token result event. [DEBUG] [29-08-2022 19:42:42:332.476 GMT] streamReadyHandler invoked [DEBUG] [29-08-2022 19:42:42:332.708 GMT] Stream is ready [INFO ] [29-08-2022 19:42:42:352.499 GMT] Streaming from rtsp source Error received from element source: Not found Debugging information: gstrtspsrc.c(6536): gst_rtspsrc_send (): /GstPipeline:rtsp-kinesis-pipeline/GstRTSPSrc:source: Not Found (404) [INFO ] [29-08-2022 19:42:42:636.131 GMT] stopKinesisVideoStreamSync(): Synchronously stopping Kinesis Video Stream 000055e59cb8f5c0. [DEBUG] [29-08-2022 19:42:42:636.241 GMT] streamClosedHandler invoked for upload handle: 18446744073709551615 [INFO ] [29-08-2022 19:42:42:636.285 GMT] Freeing Kinesis Video Stream CCTVStream [INFO ] [29-08-2022 19:42:42:636.331 GMT] freeKinesisVideoStream(): Freeing Kinesis Video stream. [DEBUG] [29-08-2022 19:42:42:636.358 GMT] curlApiCallbacksShutdownActiveRequests(): pActiveRequests hashtable is empty [INFO ] [29-08-2022 19:42:43:037.946 GMT] Freeing Kinesis Video Stream CCTVStream [INFO ] [29-08-2022 19:42:43:038.100 GMT] freeKinesisVideoClient(): Freeing Kinesis Video Client [DEBUG] [29-08-2022 19:42:43:038.132 GMT] curlApiCallbacksShutdownActiveRequests(): pActiveRequests hashtable is empty [DEBUG] [29-08-2022 19:42:43:439.995 GMT] freeKinesisVideoClientInternal(): Total allocated memory 0 [WARN ] [29-08-2022 19:42:43:440.118 GMT] curlApiCallbacksShutdown(): curlApiCallbacksShutdown called when already in progress of shutting down

1 Answer

There is an error in obtaining the RTSP source as seen in the logs you shared:

Streaming from rtsp source Error received from element source

When you test via VLC, are you testing from the actual device that you are attempting to run the kvs_gstreamer_sample from?

One other question: does your RTSP URL contain credentials and special characters? If so you might want to try to use the KVS gstreamer plugin. Here is an example that I am currently working with to push a video stream from an Amcrest camera to KVS from a Raspberry Pi on the same network as the Amcrest camera:

export AWS_DEFAULT_REGION=us-east-1
export AWS_ACCESS_KEY_ID=mysecret
export AWS_SECRET_ACCESS_KEY=myaccesskey


gst-launch-1.0 -v rtspsrc location=$RTSP_URL short-header=TRUE \
    ! rtph264depay \
    ! h264parse \
    ! kvssink stream-name=$STREAM_NAME storage-size=128
profile picture
answered 3 months ago
  • Yes, I am testing from a remote device whose RTSP URL was provided to me.

    The URL contains credentials but no special character.

    The problem is, I don't know much about the device. I only have the remote RTSP URL. So, using AWS IoT is also not going to help me. I tried using H265 depayer encoding but that didn't work either.

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