Skip to content

Reduce the noise from Kinesis Video Stream

0

Hi guys, I had problem when get the data from Kinesis video stream. Basically I had config media stream from AWS Connect and can get the data from Kinesis Video Stream. When I write a script to get the data and listen the voice I hear a lot of noise in there. How can I reduce that noise ?

1 Answer
0
Accepted Answer

Can you post the code you’re using? More than likely the issue is in the decoding/format of the audio file.

answered 2 years ago
  • def get_audio_track(stream_arn, start_fragment_number): # Create Kinesis Video client kinesis_video = boto3.client('kinesisvideo') # Get Data Endpoint for the stream response = kinesis_video.get_data_endpoint( StreamARN=stream_arn, APIName='GET_MEDIA' ) data_endpoint = response['DataEndpoint']

    # Create Kinesis Video Streams client with the endpoint
    kinesis_video_media = boto3.client('kinesis-video-media', endpoint_url=data_endpoint)
    
    # Get media for fragment list
    response = kinesis_video_media.get_media(
        StreamARN=stream_arn,
        StartSelector={
            'StartSelectorType': 'FRAGMENT_NUMBER',
            'AfterFragmentNumber': start_fragment_number
        }
    )
    
    # Read audio data from response payload
    audio_data = response['Payload'].read()
    # Decode or process audio data (depending on the format)
    # Example: Saving the data as a WAV file
    with wave.open('audio.wav', 'wb') as wf:
        wf.setnchannels(1)  # mono
        wf.setsampwidth(2)  # 16-bit
        wf.setframerate(8000)  # 8000 Hz (adjust as per your audio format)
        wf.writeframes(audio_data)
    
    print("Audio saved as audio.wav")
    

    Example usage

    stream_arn = 'arn:aws:kinesisvideo:us-west-2:884189903498:stream/prsv24-stream-connect-minhbear-prsv-contact-f801d3cf-6cf9-48e9-8407-8794c0a3a916/1719457808385' start_fragment_number = '91343852333181437344442219805238413847071028315' get_audio_track(stream_arn, start_fragment

  • Above is the code I get the voice store in kinesis video stream and the store in the wav file in local computer, can you check that am I wrong in some where

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.