【问题标题】:How to achieve Amazon Connect -> AWS Kinesis Video Stream -> Lambda -> save audible .wav in S3 (Live Streaming)如何实现 Amazon Connect -> AWS Kinesis Video Stream -> Lambda -> 在 S3 中保存可听的 .wav(直播)
【发布时间】:2019-04-09 09:25:11
【问题描述】:

尝试将 Amazon Connect 配置为将对话实时流式传输到 AWS Kinesis Video Streams,然后触发 Lambda 函数 (Python),该函数使用 GetMedia API 对该记录进行采样并将其发送到特定 S3 存储桶。

在这种将原始流转换为 .wav 的过程中几乎停滞不前 -> 甚至可以用 python 实现吗? 找到了类似的实现,但总是偶然发现 Java (https://github.com/aws-samples/amazon-connect-realtime-transcription)。

例如,我只需将此流转换为 .wav 格式,以便稍后可由普通音频播放器播放并用作语音邮件和类似用例。

import json
import boto3
import time

bucket='kinesis-video-streams-random'
key = 'streams/latest.raw'

def lambda_handler(event, context):
    try:
        s3_client = boto3.client('s3',region_name='us-east-1')
        kinesis_client = boto3.client('kinesisvideo',region_name='us-east-1')

        get_ep = kinesis_client.get_data_endpoint(StreamARN='arn:aws:kinesisvideo:us-east-1:xxxxxxxxx:stream/xxxxxxxx',APIName='GET_MEDIA')

        t = get_ep['DataEndpoint']
        video_client = boto3.client('kinesis-video-media', endpoint_url=t, region_name='us-east-1')
        stream = video_client.get_media(StreamARN='arn:aws:kinesisvideo:us-east-1:xxxxxxxxx:stream/xxxxxxxx',StartSelector={'StartSelectorType': 'EARLIEST'})

        s3_client.put_object(Bucket=bucket, Key=key, Body=stream['Payload'].read())
        print("Specific Kinesis Stream stored in the S3 bucket " + bucket)
    except Exception as e:
        return e

【问题讨论】:

  • 你搞定了吗?

标签: amazon-web-services amazon-s3 lambda amazon-kinesis amazon-connect


【解决方案1】:

有一个名为wave 的python 模块,它可能很有用。您可以简单地打开原始文件并将其与模块一起写入 .wav 文件。这也是 Java Lambda 中发生的事情。

还有 abernert 的回答,example

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-03
    • 2019-11-05
    • 2023-03-13
    • 1970-01-01
    相关资源
    最近更新 更多