awslabs / amazon-kinesis-video-streams-producer-sdk-cpp

Amazon Kinesis Video Streams Producer SDK for C++ is for developers to install and customize for their connected camera and other devices to securely stream video, audio, and time-encoded data to Kinesis Video Streams.
Apache License 2.0
379 stars 334 forks source link

kvs_gstreamer_sample fails to run on Raspberry Pi bookworm #1194

Open vmalan opened 4 months ago

vmalan commented 4 months ago

Logging ./kvs_gstreamer_sample buoy_van -w 640 -h 480 [INFO ] [08-07-2024 17:13:44:269.765 GMT] Using region: us-west-2 [INFO ] [08-07-2024 17:13:44:270.073 GMT] Using aws credentials for Kinesis Video Streams [INFO ] [08-07-2024 17:13:44:270.152 GMT] No session token was detected. [INFO ] [08-07-2024 17:13:44:275.888 GMT] createKinesisVideoClient(): Creating Kinesis Video Client [WARN ] [08-07-2024 17:13:44:276.209 GMT] fixupClientInfo(): Connection timeout is invalid...setting to default [WARN ] [08-07-2024 17:13:44:276.288 GMT] fixupClientInfo(): Completion timeout is invalid...setting to default [INFO ] [08-07-2024 17:13:44:276.428 GMT] heapInitialize(): Initializing native heap with limit size 134217728, spill ratio 0% and flags 0x00000001 [INFO ] [08-07-2024 17:13:44:276.500 GMT] heapInitialize(): Creating AIV heap. [INFO ] [08-07-2024 17:13:44:276.640 GMT] heapInitialize(): Heap is initialized OK [DEBUG] [08-07-2024 17:13:44:277.122 GMT] getSecurityTokenHandler invoked [DEBUG] [08-07-2024 17:13:44:277.319 GMT] Refreshing credentials. Force refreshing: 0 Now time is: 1720458824277275649 Expiration: 0 [INFO ] [08-07-2024 17:13:44:277.460 GMT] New credentials expiration is 1720462424 [INFO ] [08-07-2024 17:13:44:277.632 GMT] createDeviceResultEvent(): Create device result event. [DEBUG] [08-07-2024 17:13:44:277.766 GMT] clientReadyHandler invoked [DEBUG] [08-07-2024 17:13:44:277.880 GMT] Client is ready [INFO ] [08-07-2024 17:13:44:278.068 GMT] Creating Kinesis Video Stream buoy_van [INFO ] [08-07-2024 17:13:44:278.201 GMT] createKinesisVideoStream(): Creating Kinesis Video Stream. [INFO ] [08-07-2024 17:13:44:278.322 GMT] logStreamInfo(): SDK version: 0b5c45b0c304c91ccce98c1e3ddf71ff5bc7af75 [DEBUG] [08-07-2024 17:13:44:278.432 GMT] logStreamInfo(): Kinesis Video Stream Info [DEBUG] [08-07-2024 17:13:44:278.540 GMT] logStreamInfo(): Stream name: buoy_van [DEBUG] [08-07-2024 17:13:44:278.674 GMT] logStreamInfo(): Streaming type: STREAMING_TYPE_REALTIME [DEBUG] [08-07-2024 17:13:44:278.810 GMT] logStreamInfo(): Content type: video/h264 [DEBUG] [08-07-2024 17:13:44:278.947 GMT] logStreamInfo(): Max latency (100ns): 600000000 [DEBUG] [08-07-2024 17:13:44:279.083 GMT] logStreamInfo(): Fragment duration (100ns): 20000000 [DEBUG] [08-07-2024 17:13:44:279.217 GMT] logStreamInfo(): Key frame fragmentation: Yes [DEBUG] [08-07-2024 17:13:44:279.407 GMT] logStreamInfo(): Use frame timecodes: Yes [DEBUG] [08-07-2024 17:13:44:279.576 GMT] logStreamInfo(): Absolute frame timecodes: Yes [DEBUG] [08-07-2024 17:13:44:279.720 GMT] logStreamInfo(): Nal adaptation flags: 0 [DEBUG] [08-07-2024 17:13:44:279.853 GMT] logStreamInfo(): Average bandwidth (bps): 4194304 [DEBUG] [08-07-2024 17:13:44:279.986 GMT] logStreamInfo(): Framerate: 25 [DEBUG] [08-07-2024 17:13:44:280.120 GMT] logStreamInfo(): Buffer duration (100ns): 1200000000 [DEBUG] [08-07-2024 17:13:44:280.254 GMT] logStreamInfo(): Replay duration (100ns): 400000000 [DEBUG] [08-07-2024 17:13:44:280.390 GMT] logStreamInfo(): Connection Staleness duration (100ns): 600000000 [DEBUG] [08-07-2024 17:13:44:280.523 GMT] logStreamInfo(): Store Pressure Policy: 1 [DEBUG] [08-07-2024 17:13:44:280.658 GMT] logStreamInfo(): View Overflow Policy: 1 [DEBUG] [08-07-2024 17:13:44:280.794 GMT] logStreamInfo(): Allow stream creation: Yes [DEBUG] [08-07-2024 17:13:44:280.935 GMT] logStreamInfo(): Segment UUID: NULL [DEBUG] [08-07-2024 17:13:44:281.068 GMT] logStreamInfo(): Frame ordering mode: 0 [DEBUG] [08-07-2024 17:13:44:281.200 GMT] logStreamInfo(): Track list [DEBUG] [08-07-2024 17:13:44:281.302 GMT] logStreamInfo(): Track id: 1 [DEBUG] [08-07-2024 17:13:44:281.436 GMT] logStreamInfo(): Track name: kinesis_video [DEBUG] [08-07-2024 17:13:44:281.571 GMT] logStreamInfo(): Codec id: V_MPEG4/ISO/AVC [DEBUG] [08-07-2024 17:13:44:281.708 GMT] logStreamInfo(): Track type: TRACK_INFO_TYPE_VIDEO [DEBUG] [08-07-2024 17:13:44:281.840 GMT] logStreamInfo(): Track cpd: NULL [DEBUG] [08-07-2024 17:13:44:282.522 GMT] setRequestHeader(): Appending header to request: user-agent -> AWS-SDK-KVS/1.5.1 GCC/12.2.0 Linux/6.6.31+rpt-rpi-v8 aarch64 CPPSDK [DEBUG] [08-07-2024 17:13:44:283.213 GMT] setRequestHeader(): Appending header to request: host -> kinesisvideo.us-west-2.amazonaws.com/describeStream [DEBUG] [08-07-2024 17:13:44:283.515 GMT] setRequestHeader(): Appending header to request: X-Amz-Date -> 20240708T171344Z [DEBUG] [08-07-2024 17:13:44:283.653 GMT] setRequestHeader(): Appending header to request: content-type -> application/json [DEBUG] [08-07-2024 17:13:44:283.779 GMT] setRequestHeader(): Appending header to request: content-length -> 29 [DEBUG] [08-07-2024 17:13:44:288.946 GMT] setRequestHeader(): Appending header to request: Authorization -> AWS4-HMAC-SHA256 Credential=AKIAU6GDYDZT3Z74A6PU/20240708/us-west-2/kinesisvideo/aws4_request, SignedHeaders=host;user-agent;x-amz-date, Signature=efad111ca92c6b70a0a1f7adc3fb01fe9c92b4b0c2cf9daf40668d6bb2d24d35 [INFO ] [08-07-2024 17:13:44:569.187 GMT] writeHeaderCallback(): RequestId: 5cd6b6f2-89ab-44dd-8003-04e4bf37cb08 [DEBUG] [08-07-2024 17:13:44:569.422 GMT] describeStreamCurlHandler(): [buoy_van] DescribeStream API response: {"StreamInfo":{"CreationTime":1.720113870427E9,"DataRetentionInHours":24,"DeviceName":null,"IngestionConfiguration":null,"KmsKeyId":"arn:aws:kms:us-west-2:339712941671:alias/aws/kinesisvideo","MediaType":null,"Status":"ACTIVE","StreamARN":"arn:aws:kinesisvideo:us-west-2:339712941671:stream/buoy_van/1720113870427","StreamName":"buoy_van","Version":"Uv2FEnOAdn8ZUhNk5R5u"}} [INFO ] [08-07-2024 17:13:44:571.670 GMT] describeStreamResultEvent(): Describe stream result event. [WARN ] [08-07-2024 17:13:44:571.848 GMT] describeStreamResult(): Retention period returned from the DescribeStream call doesn't match the one specified in the StreamInfo [WARN ] [08-07-2024 17:13:44:571.898 GMT] describeStreamResult(): Content type returned from the DescribeStream(null) call doesn't match the one specified in the StreamInfo(video/h264) [WARN ] [08-07-2024 17:13:44:571.939 GMT] describeStreamResult(): [buoy_van] Retention period returned from the DescribeStream call doesn't match the one specified in the StreamInfo [WARN ] [08-07-2024 17:13:44:571.978 GMT] describeStreamResult(): [buoy_van] Content type returned from the DescribeStream call doesn't match the one specified in the StreamInfo [DEBUG] [08-07-2024 17:13:44:572.731 GMT] setRequestHeader(): Appending header to request: user-agent -> AWS-SDK-KVS/1.5.1 GCC/12.2.0 Linux/6.6.31+rpt-rpi-v8 aarch64 CPPSDK [DEBUG] [08-07-2024 17:13:44:573.060 GMT] setRequestHeader(): Appending header to request: host -> kinesisvideo.us-west-2.amazonaws.com/getDataEndpoint [DEBUG] [08-07-2024 17:13:44:573.133 GMT] setRequestHeader(): Appending header to request: X-Amz-Date -> 20240708T171344Z [DEBUG] [08-07-2024 17:13:44:573.161 GMT] setRequestHeader(): Appending header to request: content-type -> application/json [DEBUG] [08-07-2024 17:13:44:573.193 GMT] setRequestHeader(): Appending header to request: content-length -> 54 [DEBUG] [08-07-2024 17:13:44:573.379 GMT] setRequestHeader(): Appending header to request: Authorization -> AWS4-HMAC-SHA256 Credential=AKIAU6GDYDZT3Z74A6PU/20240708/us-west-2/kinesisvideo/aws4_request, SignedHeaders=host;user-agent;x-amz-date, Signature=613dba891cb8c6672a30aae19b7205545b169aad7018419179cd7ee217e909c8 [INFO ] [08-07-2024 17:13:44:847.270 GMT] writeHeaderCallback(): RequestId: a09ea95e-4124-4dc9-b413-73c8a47d06e2 [DEBUG] [08-07-2024 17:13:44:847.453 GMT] getStreamingEndpointCurlHandler(): [buoy_van] GetStreamingEndpoint API response: {"DataEndpoint":"https://s-8451b5cd.kinesisvideo.us-west-2.amazonaws.com"} [INFO ] [08-07-2024 17:13:44:849.628 GMT] getStreamingEndpointResultEvent(): Get streaming endpoint result event. [DEBUG] [08-07-2024 17:13:44:849.761 GMT] getStreamingTokenHandler invoked [DEBUG] [08-07-2024 17:13:44:849.800 GMT] Refreshing credentials. Force refreshing: 1 Now time is: 1720458824849791779 Expiration: 1720462424 [INFO ] [08-07-2024 17:13:44:849.825 GMT] New credentials expiration is 1720462424 [INFO ] [08-07-2024 17:13:44:849.875 GMT] getStreamingTokenResultEvent(): Get streaming token result event. [DEBUG] [08-07-2024 17:13:44:849.916 GMT] streamReadyHandler invoked [DEBUG] [08-07-2024 17:13:44:850.087 GMT] Stream is ready 0:00:00.002293408 1131 0x790280 WARN GST_PERFORMANCE gstbuffer.c:501:_priv_gst_buffer_initialize: No 64-bit atomic int defined for this platform/toolchain! [INFO ] [08-07-2024 17:13:44:916.311 GMT] Streaming from live source [DEBUG] [08-07-2024 17:13:44:916.667 GMT] Streaming with live source and width: 640, height: 480, fps: 25, bitrateInKBPS512 0:00:00.072434667 1131 0x790280 WARN GST_ELEMENT_FACTORY gstelementfactory.c:765:gst_element_factory_make_valist: no such element factory "vtenc_h264_hw"! 0:00:00.072533593 1131 0x790280 WARN GST_ELEMENT_FACTORY gstelementfactory.c:765:gst_element_factory_make_valist: no such element factory "omxh264enc"! [DEBUG] [08-07-2024 17:13:44:924.973 GMT] Using x264enc [DEBUG] [08-07-2024 17:13:44:949.279 GMT] Using v4l2src [DEBUG] [08-07-2024 17:13:44:950.174 GMT] src supports raw [DEBUG] [08-07-2024 17:13:44:951.837 GMT] Constructing pipeline with encoding element 0:00:00.111601871 1131 0x9bc048 WARN v4l2 gstv4l2object.c:4491:gst_v4l2_object_get_crop_rect: VIDIOC_CROPCAP failed 0:00:00.128060982 1131 0x9bc048 WARN v4l2 gstv4l2object.c:4491:gst_v4l2_object_get_crop_rect: VIDIOC_CROPCAP failed 0:00:00.129938056 1131 0x9bc048 WARN v4l2bufferpool gstv4l2bufferpool.c:848:gst_v4l2_buffer_pool_start: Uncertain or not enough buffers, enabling copy threshold 0:00:00.130364963 1131 0x9bc048 ERROR v4l2bufferpool gstv4l2bufferpool.c:712:gst_v4l2_buffer_pool_streamon: error with STREAMON 22 (Invalid argument) 0:00:00.130404982 1131 0x9bc048 ERROR bufferpool gstbufferpool.c:572:gst_buffer_pool_set_active: start failed 0:00:00.130439630 1131 0x9bc048 WARN v4l2src gstv4l2src.c:976:gst_v4l2src_decide_allocation: error: Failed to allocate required memory. 0:00:00.130473945 1131 0x9bc048 WARN v4l2src gstv4l2src.c:976:gst_v4l2src_decide_allocation: error: Buffer pool activation failed 0:00:00.130598482 1131 0x9bc048 WARN basesrc gstbasesrc.c:3352:gst_base_src_prepare_allocation: Subclass failed to decide allocation Error received from element source: Failed to allocate required memory. 0:00:00.130666296 1131 0x9bc048 WARN basesrc gstbasesrc.c:3132:gst_base_src_loop: error: Internal data stream error. Debugging information: ../sys/v4l2/gstv4l2src.c(976): gst_v4l2src_decide_allocation (): /GstPipeline:live-kinesis-pipeline/GstV4l2Src:source: Buffer pool activation failed 0:00:00.130732482 1131 0x9bc048 WARN basesrc gstbasesrc.c:3132:gst_base_src_loop: error: streaming stopped, reason not-negotiated (-4) [INFO ] [08-07-2024 17:13:44:983.040 GMT] stopKinesisVideoStreamSync(): [buoy_van] Synchronously stopping Kinesis Video Stream [DEBUG] [08-07-2024 17:13:44:983.210 GMT] streamClosedHandler invoked for upload handle: 18446744073709551615 [INFO ] [08-07-2024 17:13:44:983.277 GMT] Freeing Kinesis Video Stream for buoy_van [INFO ] [08-07-2024 17:13:44:983.329 GMT] freeKinesisVideoStream(): Freeing Kinesis Video stream. [DEBUG] [08-07-2024 17:13:44:983.412 GMT] freeStream(): [buoy_van] Freeing stream [DEBUG] [08-07-2024 17:13:44:983.461 GMT] curlApiCallbacksShutdownActiveRequests(): pActiveRequests hashtable is empty [DEBUG] [08-07-2024 17:13:45:383.716 GMT] freeStream(): [buoy_van] Completed freeing stream [INFO ] [08-07-2024 17:13:45:383.852 GMT] Freeing Kinesis Video Stream for buoy_van [INFO ] [08-07-2024 17:13:45:383.904 GMT] freeKinesisVideoClient(): Freeing Kinesis Video Client [DEBUG] [08-07-2024 17:13:45:383.957 GMT] curlApiCallbacksShutdownActiveRequests(): pActiveRequests hashtable is empty [DEBUG] [08-07-2024 17:13:45:784.209 GMT] freeKinesisVideoClientInternal(): Total allocated memory 0 [INFO ] [08-07-2024 17:13:45:784.295 GMT] Completed freeing client [WARN ] [08-07-2024 17:13:45:784.361 GMT] curlApiCallbacksShutdown(): curlApiCallbacksShutdown called when already in progress of shutting down

Describe the bug following the Raspberry Pi tutorial, I cannot get past the buffer allocation, which fails.

To Reproduce Steps to reproduce the behavior:

  1. export AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
  2. execute kvs_gstreamer_sample -w -h
  3. see sad results

Expected behavior after step 2 above, hope to see video being collected at AWS. is this possible v4l2src vs libcamerasrc ???

SDK version number Include the SDK version you are running. If it is a specific commit on master branch, include that branches master and develop as of 7/5/2024

Platform (please complete the following information):

sirknightj commented 2 days ago

It appears that you're using the raspberry pi camera and not a USB webcam?

Please try the instructions here: https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-cpp/discussions/1130#discussioncomment-11378187 and see if it resolves your issue.