transcribe_audio
async
¶
transcribe_audio(
media: SyncMedia,
*,
config_overrides: Optional[AsyncTranscribeClientConfig] = None,
language: Optional[SyncLanguage] = None,
language_detection_mode: Optional[LanguageDetectionMode] = None,
language_options: Optional[SyncLanguageOptions] = None,
channel_identification: Optional[Boolean] = None,
show_speaker_labels: Optional[Boolean] = None,
max_speaker_labels: Optional[MaxSpeakers] = None,
vocabulary_settings: Optional[VocabularySettingsList] = None,
vocabulary_filter_settings: Optional[VocabularyFilterSettings] = None,
content_redaction: Optional[ContentRedaction] = None,
output_configuration: Optional[SyncOutputConfiguration] = None,
) -> TranscribeAudioResponse
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 .
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
LanguageorLanguageDetectionMode: 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.
Parameters:
-
media(SyncMedia) –The audio to transcribe. Specify exactly one of
MediaBytesorMediaFileUri.Audio sent in the request (
MediaBytes) can be up to 25 MB. Audio in Amazon S3 (MediaFileUri) can be up to 500 MB. -
language(Optional[SyncLanguage], default:None) –The language spoken in your audio, as a base language code (for example,
enores).Include either
LanguageorLanguageDetectionModein your request, but not both. -
language_detection_mode(Optional[LanguageDetectionMode], default:None) –Enables automatic language identification. Use
IDENTIFY_LANGUAGEif your audio contains a single language that you don't know in advance.You can optionally include
LanguageOptionsto 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
LanguageorLanguageDetectionModein your request, but not both. -
language_options(Optional[SyncLanguageOptions], default:None) –A list of two or more languages that you think may be present in your audio, as base language codes (for example,
enandes). Each language can appear only once. A list with only one language returns aBadRequestException.You can use
LanguageOptionsonly withLanguageDetectionMode. -
channel_identification(Optional[Boolean], default:None) –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.
-
show_speaker_labels(Optional[Boolean], default:None) –Enables speaker partitioning (diarization) in your transcript. Speaker partitioning labels the speech from individual speakers in your media file.
If you set
ShowSpeakerLabelstotrue, you must also includeMaxSpeakerLabels.For more information, see Partitioning speakers (diarization).
-
max_speaker_labels(Optional[MaxSpeakers], default:None) –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
MaxSpeakerLabelsonly ifShowSpeakerLabelsistrue. -
vocabulary_settings(Optional[VocabularySettingsList], default:None) –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 itsLanguagemust match. If you useLanguageDetectionMode, you can include one entry for each language inLanguageOptions. -
vocabulary_filter_settings(Optional[VocabularyFilterSettings], default:None) –Custom vocabulary filters to apply to your transcript, and how to apply them.
-
content_redaction(Optional[ContentRedaction], default:None) –Redacts personally identifiable information (PII) from your transcript. Amazon Transcribe returns the redacted transcript in
RedactedResults.If you set
RedactionOutputtoredacted_and_unredacted, Amazon Transcribe also returns the unredacted transcript inResults.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 includeLanguageOptions, and every language in it must be one of the languages above. A request that has noLanguageOptions, or that lists a language that isn't supported, returns aBadRequestException. -
Regions: Content redaction isn't available in the South America (São Paulo) Region (
sa-east-1). It's available in the other Amazon Web Services Regions where Sync is available.
-
-
output_configuration(Optional[SyncOutputConfiguration], default:None) –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.
Raises:
-
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. -
InternalFailureException–There was an internal error. Check the error message, correct the issue, and try your request again.
-
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.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_transcribe/_services/async_transcribe.py
3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 | |