View a markdown version of this page

TranscribeAudio - Amazon Transcribe

TranscribeAudio

Transcribes a media file and returns the transcript in the same response. There is no job to start and no status to poll.

Use TranscribeAudio when you already have a complete media file and want the transcript right away. For large files, long audio, or bulk processing, use StartTranscriptionJob.

You must include the following parameters in your TranscribeAudio request:

  • Media: Your audio, either as inline bytes (MediaBytes) or as the Amazon S3 location of a media file (MediaFileUri).

  • One of Language or LanguageDetectionMode: Specify the language of your audio, or have Amazon Transcribe identify it.

Your audio must be between 0.5 seconds and 1 hour long. Supported formats are WAV, MP3, FLAC, M4A, MP4, Ogg, WebM, and AMR.

If you send your audio in the request (MediaBytes), the file can be up to 25 MB. If you provide an Amazon S3 location (MediaFileUri), the file can be up to 500 MB.

Amazon Transcribe always turns on smart formatting, also known as inverse text normalization (ITN). It writes numbers, dates, currency, and similar items in their usual written form. For example, "one hundred" becomes "100". You can't turn smart formatting off.

By default, Amazon Transcribe returns the transcript in TranscriptResponse. If you include OutputConfiguration, Amazon Transcribe writes the transcript to the Amazon S3 location you specify instead, and the response contains only that location.

Request Syntax

{ "ChannelIdentification": boolean, "ContentRedaction": { "PiiEntityTypes": [ "string" ], "RedactionOutput": "string", "RedactionType": "string" }, "Language": "string", "LanguageDetectionMode": "string", "LanguageOptions": [ "string" ], "MaxSpeakerLabels": number, "Media": { ... }, "OutputConfiguration": { "OutputMediaFileUri": "string" }, "ShowSpeakerLabels": boolean, "VocabularyFilterSettings": { "Filters": [ { "Language": "string", "VocabularyFilterName": "string", "Words": [ "string" ] } ], "VocabularyFilterMethod": "string" }, "VocabularySettings": [ { "Language": "string", "Phrases": [ { "DisplayAs": "string", "Text": "string" } ], "VocabularyName": "string" } ] }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

ChannelIdentification

Enables channel identification in multi-channel audio. Each channel is transcribed independently, and each item in the transcript is labeled with its channel.

Channel identification supports up to two channels.

Type: Boolean

Required: No

ContentRedaction

Redacts personally identifiable information (PII) from your transcript. Amazon Transcribe returns the redacted transcript in RedactedResults.

If you set RedactionOutput to redacted_and_unredacted, Amazon Transcribe also returns the unredacted transcript in Results.

In Sync, content redaction has these limits:

  • Languages: English (en), Spanish (es), French (fr), Italian (it), German (de), and Portuguese (pt).

  • Language identification: If you use LanguageDetectionMode, you must also include LanguageOptions, and every language in it must be one of the languages above. A request that has no LanguageOptions, or that lists a language that isn't supported, returns a BadRequestException.

  • Regions: Content redaction isn't available in the South America (São Paulo) Region (sa-east-1). It's available in the other AWS Regions where Sync is available.

Type: ContentRedaction object

Required: No

Language

The language spoken in your audio, as a base language code (for example, en or es).

Include either Language or LanguageDetectionMode in your request, but not both.

Type: String

Valid Values: en | es | fr | it | de | ja | pt | ko | zh-CN | zh-TW | zh-HK

Required: No

LanguageDetectionMode

Enables automatic language identification. Use IDENTIFY_LANGUAGE if your audio contains a single language that you don't know in advance.

You can optionally include LanguageOptions to limit identification to languages you think may be present, which can improve accuracy.

Amazon Transcribe returns the identified language, as a locale (for example, en-US), in the response metadata.

Include either Language or LanguageDetectionMode in your request, but not both.

Type: String

Valid Values: IDENTIFY_LANGUAGE

Required: No

LanguageOptions

A list of two or more languages that you think may be present in your audio, as base language codes (for example, en and es). Each language can appear only once. A list with only one language returns a BadRequestException.

You can use LanguageOptions only with LanguageDetectionMode.

Type: Array of strings

Array Members: Minimum number of 1 item.

Valid Values: en | es | fr | it | de | ja | pt | ko | zh-CN | zh-TW | zh-HK

Required: No

MaxSpeakerLabels

Specify the maximum number of speakers you want to partition in your media.

Note that if your media contains more speakers than the specified number, Amazon Transcribe treats multiple speakers as a single speaker.

You can set MaxSpeakerLabels only if ShowSpeakerLabels is true.

Type: Integer

Valid Range: Minimum value of 2. Maximum value of 30.

Required: No

Media

The audio to transcribe. Specify exactly one of MediaBytes or MediaFileUri.

Audio sent in the request (MediaBytes) can be up to 25 MB. Audio in Amazon S3 (MediaFileUri) can be up to 500 MB.

Type: SyncMedia object

Note: This object is a Union. Only one member of this object can be specified or returned.

Required: Yes

OutputConfiguration

Writes the transcript to an Amazon S3 location instead of returning it in the response. If you include OutputConfiguration, the response contains only the output location.

You must have write permission for the location you specify.

Type: SyncOutputConfiguration object

Required: No

ShowSpeakerLabels

Enables speaker partitioning (diarization) in your transcript. Speaker partitioning labels the speech from individual speakers in your media file.

If you set ShowSpeakerLabels to true, you must also include MaxSpeakerLabels.

For more information, see Partitioning speakers (diarization).

Type: Boolean

Required: No

VocabularyFilterSettings

Custom vocabulary filters to apply to your transcript, and how to apply them.

Type: VocabularyFilterSettings object

Required: No

VocabularySettings

Custom vocabularies to apply to your transcript, with one entry per language. In each entry, you can reference a custom vocabulary you created or provide phrases inline. All entries must use the same type, either all by name or all inline.

If you specify Language, include exactly one entry, and its Language must match. If you use LanguageDetectionMode, you can include one entry for each language in LanguageOptions.

Type: Array of VocabularySettingsEntry objects

Array Members: Minimum number of 1 item. Maximum number of 5 items.

Required: No

Response Syntax

{ "OutputConfiguration": { "OutputMediaFileUri": "string" }, "TranscriptResponse": { "Metadata": { "LanguageCode": "string", "LanguageCodes": [ { "DurationInSeconds": number, "LanguageCode": "string" } ], "MediaFormat": "string", "MediaSampleRateHertz": number, "NumberOfChannels": number, "SpeakersCount": number }, "RedactedResults": { "Items": [ { "ChannelLabel": "string", "Content": "string", "EndTime": number, "Id": number, "LanguageCode": "string", "Redactions": [ { "Type": "string" } ], "SpeakerLabel": "string", "StartTime": number, "VocabularyFilterMatch": boolean } ], "Transcript": "string" }, "Results": { "Items": [ { "ChannelLabel": "string", "Content": "string", "EndTime": number, "Id": number, "LanguageCode": "string", "Redactions": [ { "Type": "string" } ], "SpeakerLabel": "string", "StartTime": number, "VocabularyFilterMatch": boolean } ], "Transcript": "string" } } }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

OutputConfiguration

The Amazon S3 location where your transcript was written. Present only if you included OutputConfiguration in your request. In that case, TranscriptResponse isn't returned.

Type: SyncOutputConfiguration object

TranscriptResponse

Your transcript and information about your audio. Present only if you didn't include OutputConfiguration in your request.

Type: TranscriptResponse object

Errors

For information about the errors that are common to all actions, see Common Error Types.

BadRequestException

Your request didn't pass one or more validation tests. This can occur when a parameter has an invalid value, when you combine parameters in a way that isn't supported, when the entity you're trying to delete doesn't exist, or if it's in a non-terminal state (such as IN PROGRESS). See the exception message field for more information.

Reason

A code that identifies why the audio in your request was rejected. Currently, TranscribeAudio returns this field, and only for problems with your audio. It isn't returned for other validation errors.

Possible values:

  • audioTooLong: The audio is longer than the maximum duration of 1 hour.

  • audioTooShort: The audio is shorter than 0.5 seconds.

  • audioFileTooLarge: The audio is larger than the maximum size.

  • unsupportedAudioFormat: The media format isn't supported.

  • unsupportedChannelCount: You enabled ChannelIdentification and the audio has more than two channels.

  • invalidAudio: Amazon Transcribe couldn't decode the audio.

  • mediaDownloadFailed: Amazon Transcribe couldn't download the audio at your MediaFileUri.

HTTP Status Code: 400

InternalFailureException

There was an internal error. Check the error message, correct the issue, and try your request again.

HTTP Status Code: 500

LimitExceededException

You've either sent too many requests or your input file is too long. Wait before retrying your request, or use a smaller file and try your request again.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: