/AWS1/IF_TNS=>STARTSTREAMTRANSCRIPTION()¶
About StartStreamTranscription¶
Starts a bidirectional HTTP/2 or WebSocket stream where audio is streamed to Amazon Transcribe and the transcription results are streamed to your application.
The following parameters are required:
-
language-codeoridentify-languageoridentify-multiple-language -
media-encoding -
sample-rate
For more information on streaming with Amazon Transcribe, see Transcribing streaming audio.
Method Signature¶
METHODS /AWS1/IF_TNS~STARTSTREAMTRANSCRIPTION
IMPORTING
!IV_LANGUAGECODE TYPE /AWS1/TNSLANGUAGECODE OPTIONAL
!IV_MEDIASAMPLERATEHERTZ TYPE /AWS1/TNSMEDIASAMPLERATEHERTZ OPTIONAL
!IV_MEDIAENCODING TYPE /AWS1/TNSMEDIAENCODING OPTIONAL
!IV_VOCABULARYNAME TYPE /AWS1/TNSVOCABULARYNAME OPTIONAL
!IV_SESSIONID TYPE /AWS1/TNSSESSIONID OPTIONAL
!IO_AUDIOSTREAM TYPE REF TO /AWS1/IF_TNSAUDIOSTREAM_IS OPTIONAL
!IV_VOCABULARYFILTERNAME TYPE /AWS1/TNSVOCABULARYFILTERNAME OPTIONAL
!IV_VOCABULARYFILTERMETHOD TYPE /AWS1/TNSVOCABULARYFILTERMETH OPTIONAL
!IV_SHOWSPEAKERLABEL TYPE /AWS1/TNSBOOLEAN OPTIONAL
!IV_ENBCHANNELIDENTIFICATION TYPE /AWS1/TNSBOOLEAN OPTIONAL
!IV_NUMBEROFCHANNELS TYPE /AWS1/TNSNUMBEROFCHANNELS OPTIONAL
!IV_ENBPARTIALRSLTSSTABILIZ00 TYPE /AWS1/TNSBOOLEAN OPTIONAL
!IV_PARTIALRESULTSSTABILITY TYPE /AWS1/TNSPARTIALRSLTSSTABILITY OPTIONAL
!IV_CONTENTIDENTIFICATIONTYPE TYPE /AWS1/TNSCONTIDENTIFICATIONT00 OPTIONAL
!IV_CONTENTREDACTIONTYPE TYPE /AWS1/TNSCONTENTREDACTIONTYPE OPTIONAL
!IV_PIIENTITYTYPES TYPE /AWS1/TNSPIIENTITYTYPES OPTIONAL
!IV_LANGUAGEMODELNAME TYPE /AWS1/TNSMODELNAME OPTIONAL
!IV_IDENTIFYLANGUAGE TYPE /AWS1/TNSBOOLEAN OPTIONAL
!IV_LANGUAGEOPTIONS TYPE /AWS1/TNSLANGUAGEOPTIONS OPTIONAL
!IV_PREFERREDLANGUAGE TYPE /AWS1/TNSLANGUAGECODE OPTIONAL
!IV_IDENTIFYMULTIPLELANGUAGES TYPE /AWS1/TNSBOOLEAN OPTIONAL
!IV_VOCABULARYNAMES TYPE /AWS1/TNSVOCABULARYNAMES OPTIONAL
!IV_VOCABULARYFILTERNAMES TYPE /AWS1/TNSVOCABULARYFILTERNAMES OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_tnsstrtstrmtranscri01
RAISING
/AWS1/CX_TNSBADREQUESTEX
/AWS1/CX_TNSCONFLICTEXCEPTION
/AWS1/CX_TNSINTERNALFAILUREEX
/AWS1/CX_TNSLIMITEXCEEDEDEX
/AWS1/CX_TNSSERVICEUNAVAILEX
/AWS1/CX_TNSCLIENTEXC
/AWS1/CX_TNSSERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Required arguments:¶
iv_mediasampleratehertz TYPE /AWS1/TNSMEDIASAMPLERATEHERTZ /AWS1/TNSMEDIASAMPLERATEHERTZ¶
The sample rate of the input audio (in hertz). Low-quality audio, such as telephone audio, is typically around 8,000 Hz. High-quality audio typically ranges from 16,000 Hz to 48,000 Hz. Note that the sample rate you specify must match that of your audio.
iv_mediaencoding TYPE /AWS1/TNSMEDIAENCODING /AWS1/TNSMEDIAENCODING¶
Specify the encoding of your input audio. Supported formats are:
FLAC
OPUS-encoded audio in an Ogg container
PCM (only signed 16-bit little-endian audio formats, which does not include WAV)
For more information, see Media formats.
io_audiostream TYPE REF TO /AWS1/IF_TNSAUDIOSTREAM_IS /AWS1/IF_TNSAUDIOSTREAM_IS¶
An encoded stream of audio blobs. Audio streams are encoded as either HTTP/2 or WebSocket data frames.
For more information, see Transcribing streaming audio.
Optional arguments:¶
iv_languagecode TYPE /AWS1/TNSLANGUAGECODE /AWS1/TNSLANGUAGECODE¶
Specify the language code that represents the language spoken in your audio.
If you're unsure of the language spoken in your audio, consider using
IdentifyLanguageto enable automatic language identification.For a list of languages supported with Amazon Transcribe streaming, refer to the Supported languages table.
iv_vocabularyname TYPE /AWS1/TNSVOCABULARYNAME /AWS1/TNSVOCABULARYNAME¶
Specify the name of the custom vocabulary that you want to use when processing your transcription. Note that vocabulary names are case sensitive.
If the language of the specified custom vocabulary doesn't match the language identified in your media, the custom vocabulary is not applied to your transcription.
This parameter is not intended for use with the
IdentifyLanguageparameter. If you're includingIdentifyLanguagein your request and want to use one or more custom vocabularies with your transcription, use theVocabularyNamesparameter instead.For more information, see Custom vocabularies.
iv_sessionid TYPE /AWS1/TNSSESSIONID /AWS1/TNSSESSIONID¶
Specify a name for your transcription session. If you don't include this parameter in your request, Amazon Transcribe generates an ID and returns it in the response.
iv_vocabularyfiltername TYPE /AWS1/TNSVOCABULARYFILTERNAME /AWS1/TNSVOCABULARYFILTERNAME¶
Specify the name of the custom vocabulary filter that you want to use when processing your transcription. Note that vocabulary filter names are case sensitive.
If the language of the specified custom vocabulary filter doesn't match the language identified in your media, the vocabulary filter is not applied to your transcription.
This parameter is not intended for use with the
IdentifyLanguageparameter. If you're includingIdentifyLanguagein your request and want to use one or more vocabulary filters with your transcription, use theVocabularyFilterNamesparameter instead.For more information, see Using vocabulary filtering with unwanted words.
iv_vocabularyfiltermethod TYPE /AWS1/TNSVOCABULARYFILTERMETH /AWS1/TNSVOCABULARYFILTERMETH¶
Specify how you want your vocabulary filter applied to your transcript.
To replace words with
***, choosemask.To delete words, choose
remove.To flag words without changing them, choose
tag.
iv_showspeakerlabel TYPE /AWS1/TNSBOOLEAN /AWS1/TNSBOOLEAN¶
Enables speaker partitioning (diarization) in your transcription output. Speaker partitioning labels the speech from individual speakers in your media file.
For more information, see Partitioning speakers (diarization).
iv_enbchannelidentification TYPE /AWS1/TNSBOOLEAN /AWS1/TNSBOOLEAN¶
Enables channel identification in multi-channel audio.
Channel identification transcribes the audio on each channel independently, then appends the output for each channel into one transcript.
If you have multi-channel audio and do not enable channel identification, your audio is transcribed in a continuous manner and your transcript is not separated by channel.
If you include
EnableChannelIdentificationin your request, you must also includeNumberOfChannels.For more information, see Transcribing multi-channel audio.
iv_numberofchannels TYPE /AWS1/TNSNUMBEROFCHANNELS /AWS1/TNSNUMBEROFCHANNELS¶
Specify the number of channels in your audio stream. This value must be
2, as only two channels are supported. If your audio doesn't contain multiple channels, do not include this parameter in your request.If you include
NumberOfChannelsin your request, you must also includeEnableChannelIdentification.
iv_enbpartialrsltsstabiliz00 TYPE /AWS1/TNSBOOLEAN /AWS1/TNSBOOLEAN¶
Enables partial result stabilization for your transcription. Partial result stabilization can reduce latency in your output, but may impact accuracy. For more information, see Partial-result stabilization.
iv_partialresultsstability TYPE /AWS1/TNSPARTIALRSLTSSTABILITY /AWS1/TNSPARTIALRSLTSSTABILITY¶
Specify the level of stability to use when you enable partial results stabilization (
EnablePartialResultsStabilization).Low stability provides the highest accuracy. High stability transcribes faster, but with slightly lower accuracy.
For more information, see Partial-result stabilization.
iv_contentidentificationtype TYPE /AWS1/TNSCONTIDENTIFICATIONT00 /AWS1/TNSCONTIDENTIFICATIONT00¶
Labels all personally identifiable information (PII) identified in your transcript.
Content identification is performed at the segment level; PII specified in
PiiEntityTypesis flagged upon complete transcription of an audio segment. If you don't includePiiEntityTypesin your request, all PII is identified.You can’t set
ContentIdentificationTypeandContentRedactionTypein the same request. If you set both, your request returns aBadRequestException.For more information, see Redacting or identifying personally identifiable information.
iv_contentredactiontype TYPE /AWS1/TNSCONTENTREDACTIONTYPE /AWS1/TNSCONTENTREDACTIONTYPE¶
Redacts all personally identifiable information (PII) identified in your transcript.
Content redaction is performed at the segment level; PII specified in
PiiEntityTypesis redacted upon complete transcription of an audio segment. If you don't includePiiEntityTypesin your request, all PII is redacted.You can’t set
ContentRedactionTypeandContentIdentificationTypein the same request. If you set both, your request returns aBadRequestException.For more information, see Redacting or identifying personally identifiable information.
iv_piientitytypes TYPE /AWS1/TNSPIIENTITYTYPES /AWS1/TNSPIIENTITYTYPES¶
Specify which types of personally identifiable information (PII) you want to redact in your transcript. You can include as many types as you'd like, or you can select
ALL.Values must be comma-separated and can include:
ADDRESS,BANK_ACCOUNT_NUMBER,BANK_ROUTING,CREDIT_DEBIT_CVV,CREDIT_DEBIT_EXPIRY,CREDIT_DEBIT_NUMBER,NAME,PHONE,PIN,SSN, orALL.Note that if you include
PiiEntityTypesin your request, you must also includeContentIdentificationTypeorContentRedactionType.If you include
ContentRedactionTypeorContentIdentificationTypein your request, but do not includePiiEntityTypes, all PII is redacted or identified.
iv_languagemodelname TYPE /AWS1/TNSMODELNAME /AWS1/TNSMODELNAME¶
Specify the name of the custom language model that you want to use when processing your transcription. Note that language model names are case sensitive.
The language of the specified language model must match the language code you specify in your transcription request. If the languages don't match, the custom language model isn't applied. There are no errors or warnings associated with a language mismatch.
For more information, see Custom language models.
iv_identifylanguage TYPE /AWS1/TNSBOOLEAN /AWS1/TNSBOOLEAN¶
Enables automatic language identification for your transcription.
If you include
IdentifyLanguage, you must include a list of language codes, usingLanguageOptions, that you think may be present in your audio stream.You can also include a preferred language using
PreferredLanguage. Adding a preferred language can help Amazon Transcribe identify the language faster than if you omit this parameter.If you have multi-channel audio that contains different languages on each channel, and you've enabled channel identification, automatic language identification identifies the dominant language on each audio channel.
Note that you must include either
LanguageCodeorIdentifyLanguageorIdentifyMultipleLanguagesin your request. If you include more than one of these parameters, your transcription job fails.Streaming language identification can't be combined with custom language models or redaction.
iv_languageoptions TYPE /AWS1/TNSLANGUAGEOPTIONS /AWS1/TNSLANGUAGEOPTIONS¶
Specify two or more language codes that represent the languages you think may be present in your media; including more than five is not recommended.
Including language options can improve the accuracy of language identification.
If you include
LanguageOptionsin your request, you must also includeIdentifyLanguageorIdentifyMultipleLanguages.For a list of languages supported with Amazon Transcribe streaming, refer to the Supported languages table.
You can only include one language dialect per language per stream. For example, you cannot include
en-USanden-AUin the same request.
iv_preferredlanguage TYPE /AWS1/TNSLANGUAGECODE /AWS1/TNSLANGUAGECODE¶
Specify a preferred language from the subset of languages codes you specified in
LanguageOptions.You can only use this parameter if you've included
IdentifyLanguageandLanguageOptionsin your request.
iv_identifymultiplelanguages TYPE /AWS1/TNSBOOLEAN /AWS1/TNSBOOLEAN¶
Enables automatic multi-language identification in your transcription job request. Use this parameter if your stream contains more than one language. If your stream contains only one language, use IdentifyLanguage instead.
If you include
IdentifyMultipleLanguages, you must include a list of language codes, usingLanguageOptions, that you think may be present in your stream.If you want to apply a custom vocabulary or a custom vocabulary filter to your automatic multiple language identification request, include
VocabularyNamesorVocabularyFilterNames.Note that you must include one of
LanguageCode,IdentifyLanguage, orIdentifyMultipleLanguagesin your request. If you include more than one of these parameters, your transcription job fails.
iv_vocabularynames TYPE /AWS1/TNSVOCABULARYNAMES /AWS1/TNSVOCABULARYNAMES¶
Specify the names of the custom vocabularies that you want to use when processing your transcription. Note that vocabulary names are case sensitive.
If none of the languages of the specified custom vocabularies match the language identified in your media, your job fails.
This parameter is only intended for use with the
IdentifyLanguageparameter. If you're not includingIdentifyLanguagein your request and want to use a custom vocabulary with your transcription, use theVocabularyNameparameter instead.For more information, see Custom vocabularies.
iv_vocabularyfilternames TYPE /AWS1/TNSVOCABULARYFILTERNAMES /AWS1/TNSVOCABULARYFILTERNAMES¶
Specify the names of the custom vocabulary filters that you want to use when processing your transcription. Note that vocabulary filter names are case sensitive.
If none of the languages of the specified custom vocabulary filters match the language identified in your media, your job fails.
This parameter is only intended for use with the
IdentifyLanguageparameter. If you're not includingIdentifyLanguagein your request and want to use a custom vocabulary filter with your transcription, use theVocabularyFilterNameparameter instead.For more information, see Using vocabulary filtering with unwanted words.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_tnsstrtstrmtranscri01 /AWS1/CL_TNSSTRTSTRMTRANSCRI01¶
Domain /AWS1/RT_ACCOUNT_ID Primitive Type NUMC
Examples¶
Syntax Example¶
This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.
DATA(lo_result) = lo_client->startstreamtranscription(
io_audiostream = lo_stream
iv_contentidentificationtype = |string|
iv_contentredactiontype = |string|
iv_enbchannelidentification = ABAP_TRUE
iv_enbpartialrsltsstabiliz00 = ABAP_TRUE
iv_identifylanguage = ABAP_TRUE
iv_identifymultiplelanguages = ABAP_TRUE
iv_languagecode = |string|
iv_languagemodelname = |string|
iv_languageoptions = |string|
iv_mediaencoding = |string|
iv_mediasampleratehertz = 123
iv_numberofchannels = 123
iv_partialresultsstability = |string|
iv_piientitytypes = |string|
iv_preferredlanguage = |string|
iv_sessionid = |string|
iv_showspeakerlabel = ABAP_TRUE
iv_vocabularyfiltermethod = |string|
iv_vocabularyfiltername = |string|
iv_vocabularyfilternames = |string|
iv_vocabularyname = |string|
iv_vocabularynames = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
lv_requestid = lo_result->get_requestid( ).
lv_languagecode = lo_result->get_languagecode( ).
lv_mediasampleratehertz = lo_result->get_mediasampleratehertz( ).
lv_mediaencoding = lo_result->get_mediaencoding( ).
lv_vocabularyname = lo_result->get_vocabularyname( ).
lv_sessionid = lo_result->get_sessionid( ).
TRY.
WHILE lo_result->get_transcriptresultstream( )->/aws1/if_rt_stream_reader~data_available( ) = ABAP_TRUE.
lo_event = lo_result->get_transcriptresultstream( )->READ( ).
IF lo_event->get_transcriptevent( ) IS NOT INITIAL.
" process this kind of event
ENDIF.
ENDWHILE.
CATCH /aws1/cx_tnsinternalfailureex.
" handle error in stream
CATCH /aws1/cx_tnsconflictexception.
" handle error in stream
CATCH /aws1/cx_tnsbadrequestex.
" handle error in stream
CATCH /aws1/cx_tnslimitexceededex.
" handle error in stream
CATCH /aws1/cx_tnsserviceunavailex.
" handle error in stream
ENDTRY.
lv_vocabularyfiltername = lo_result->get_vocabularyfiltername( ).
lv_vocabularyfiltermethod = lo_result->get_vocabularyfiltermethod( ).
lv_boolean = lo_result->get_showspeakerlabel( ).
lv_boolean = lo_result->get_enbchannelidentification( ).
lv_numberofchannels = lo_result->get_numberofchannels( ).
lv_boolean = lo_result->get_enbpartialrsltsstabili00( ).
lv_partialresultsstability = lo_result->get_partialresultsstability( ).
lv_contentidentificationty = lo_result->get_contidentificationtype( ).
lv_contentredactiontype = lo_result->get_contentredactiontype( ).
lv_piientitytypes = lo_result->get_piientitytypes( ).
lv_modelname = lo_result->get_languagemodelname( ).
lv_boolean = lo_result->get_identifylanguage( ).
lv_languageoptions = lo_result->get_languageoptions( ).
lv_languagecode = lo_result->get_preferredlanguage( ).
lv_boolean = lo_result->get_identifymultiplelangua00( ).
lv_vocabularynames = lo_result->get_vocabularynames( ).
lv_vocabularyfilternames = lo_result->get_vocabularyfilternames( ).
ENDIF.