Skip to content

aws python examples for kinesis on raspberry pi

0

I am trying to get this code working on a raspberry pi zero 2 https://github.com/aws-samples/python-samples-for-amazon-kinesis-video-streams-with-webrtc One of the requirements is pycairo, which is not supported on the raspberry pi os with Bullseye. Can I get around it?

asked a year ago96 views
1 Answer
0

While the specific example you're trying to run may have some challenges on a Raspberry Pi Zero 2, there are alternative approaches you can consider for working with Kinesis on a Raspberry Pi using Python.

For Kinesis Data Streams, you can use the Boto3 library to interact with the service. Here's a basic example of how you might set up a Kinesis Data Stream reader:

  1. Install Boto3 if you haven't already: pip install boto3

  2. Use code similar to this to read from a Kinesis Data Stream:

import boto3

kinesis_client = boto3.client('kinesis', region_name='your-region')

response = kinesis_client.describe_stream(StreamName='your-stream-name')
shard_id = response['StreamDescription']['Shards'][0]['ShardId']

shard_iterator = kinesis_client.get_shard_iterator(
    StreamName='your-stream-name',
    ShardId=shard_id,
    ShardIteratorType='LATEST'
)

shard_iterator = shard_iterator['ShardIterator']

while True:
    records = kinesis_client.get_records(ShardIterator=shard_iterator, Limit=100)
    for record in records['Records']:
        print(record['Data'])
    shard_iterator = records['NextShardIterator']

For Kinesis Video Streams, the situation is more complex. The example you're trying to use involves WebRTC, which has specific requirements that may be challenging on a Raspberry Pi Zero 2. The pycairo dependency issue you're encountering is one such challenge.

Unfortunately, there isn't a simple way to "get around" the pycairo requirement if it's a core dependency of the WebRTC implementation. Your options might include:

  1. Try using an older version of pycairo that might be compatible with your Raspberry Pi OS.
  2. Look for alternative WebRTC implementations that don't require pycairo.
  3. Consider using a different approach for video streaming that doesn't rely on WebRTC.

For simpler video streaming scenarios, you might be able to use the Kinesis Video Streams Producer SDK for C++, which has been known to work on Raspberry Pi devices. However, this would require compiling the SDK on your device and potentially writing some custom Python bindings.

Given the limitations of the Raspberry Pi Zero 2, you may need to reconsider your approach or potentially use a more powerful Raspberry Pi model that can better support the required dependencies for WebRTC and Kinesis Video Streams.
Sources
Kinesis Video Streams Python Support | AWS re:Post
Kinesis examples using SDK for Python (Boto3) - AWS SDK Code Examples

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.