【问题标题】:how to create subtitles from aws transcribe如何从 aws transcribe 创建字幕
【发布时间】:2022-02-18 16:35:19
【问题描述】:

我正在使用 AWS SDK for python (boto3) 并想设置字幕输出格式(即SRT)。当我使用此代码时,我收到以下错误,其中提到的参数 Subtitle 不是有效参数,但根据 AWS 文档,我应该能够在此参数中传递一些值。

    s3 = boto3.client('s3', aws_access_key_id=ACCESS_KEY,aws_secret_access_key=SECRET_KEY)
    transcribe = boto3.client('transcribe',aws_access_key_id=ACCESS_KEY, 
    aws_secret_access_key=SECRET_KEY, region_name=region_name)
    job_name = "kateri1234"
    job_uri = "s3://transcribe-upload12/english.mp4"
    transcribe.start_transcription_job(TranscriptionJobName=job_name,Media{'MediaFileUri':job_uri},
    MediaFormat='mp4',
    LanguageCode='en-US', 
    Subtitles={'Formats': ['vtt']},
    OutputBucketName = "transcribe-output12"
    )
    while True:
        status = transcribe.get_transcription_job(TranscriptionJobName=job_name)
        if status['TranscriptionJob']['TranscriptionJobStatus'] in ['COMPLETED', 'FAILED']:
            break
            print("Not ready yet...")
            time.sleep(5)
            print(status)

我得到的错误是输入中的未知参数:“字幕”,必须是以下之一:TranscriptionJobName、LanguageCode、MediaSampleRateHertz、MediaFormat、Media、OutputBucketName、OutputEncryptionKMSKeyId、设置

refered the aws documentation

【问题讨论】:

    标签: python-3.x amazon-web-services aws-transcribe


    【解决方案1】:

    我遇到过类似的问题,经过一番研究,我发现这是因为我的 boto3 和 botocore 版本。

    我已经升级了这两个包,它工作正常。我对这两个包的 requirements.txt:

    boto3==1.20.0
    botocore==1.23.54
    

    P.S: 请记住检查这两个新版本是否与您的其他 python 包兼容。特别是如果您使用其他 AWS 库,例如 awsebcli。为确保一切正常运行,请在升级这两个库后尝试运行此命令以检查错误:

    pip check
    

    【讨论】:

      猜你喜欢
      • 2021-08-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多