awslabs / amazon-kinesis-video-streams-webrtc-sdk-c

Amazon Kinesis Video Streams Webrtc SDK is for developers to install and customize realtime communication between devices and enable secure streaming of video, audio to Kinesis Video Streams.
https://awslabs.github.io/amazon-kinesis-video-streams-webrtc-sdk-c/group__PublicMemberFunctions.html
Apache License 2.0
1.04k stars 317 forks source link

How to control bitrate in AWS Kinesis? #2048

Closed Tonyinfo-dev closed 2 months ago

Tonyinfo-dev commented 3 months ago

Hi all, I am trying to use kvsWebrtcclientmaster and stream.

We had applied patch to the source code so that, instead of reading from Files we are taking encoded buffers from our Embedded development SDK, and this buffer is actually encoded using H.264 encoder, now we could able to stream this in Kinesis, but problem is, we could able to see streaming in distortion at 5 Mbps, but simultaneously it streams fine in RTSP, so we don't doubt on the encoder we use.

But when we change the bitrate to 500KBytes instead of 5MBytes, we could able to see streaming without any issues.

So I doubt that AWS has issue in processing bitrate and GOP, can we know how to solve this issue by controlling bitrate in AWS side

Regards, Tony

stefankiesz commented 3 months ago

Hi Tony, this could be due to the bitrate of media coming from the encoder being too high for your connection. Can you do the following to see whether you're exceeding the recommended bitrate:

  1. Uncomment this line from CMakeLists.txt to enable very verbose logging.
  2. Run cmake and make again.
  3. Set verbose log level: export AWS_KVS_LOG_LEVEL=1
  4. Run either the master or master-GStreamer sample
  5. Look for log lines with sampleSenderBandwidthEstimationHandler(): received sender bitrate estimation: suggested bitrate

After some time, the outputted numbers will be adjusted to the suggested bitrate for your network in KBps, based on a starting point of 1024 KBps. If the value remains at 1024, then you can try to modify this line to be UINT32 bitrate = 5120;, and see if the suggested bitrate ends up being lower than this.

stefankiesz commented 3 months ago

Also, please share the SDK version you are using and a video clip of the distorted media if possible.

niyatim23 commented 2 months ago

Closing due to staleness