The ML.TRANSCRIBE function

Note: This feature is automatically available in theEnterprise and Enterprise Plus editions. Ifyou use the Standard edition oron-demand pricing and would like to usethis feature, send an email to bqml-feedback@google.com.

This document describes theML.TRANSCRIBE function, which lets youtranscribe audio files from anobject table by using theSpeech-to-Text API.

Syntax

ML.TRANSCRIBE(  MODEL `PROJECT_ID.DATASET.MODEL_NAME`,  TABLE `PROJECT_ID.DATASET.OBJECT_TABLE`,  [RECOGNITION_CONFIG => ( JSON 'RECOGNITION_CONFIG')])

Arguments

ML.TRANSCRIBE takes the following arguments:

  • PROJECT_ID: the project thatcontains the resource.

  • DATASET: the BigQuery dataset thatcontains the resource.

  • MODEL_NAME: the name of aremote modelwith aREMOTE_SERVICE_TYPE ofCLOUD_AI_SPEECH_TO_TEXT_V2.

  • OBJECT_TABLE: the name of theobject tablethat contains URIs of the audio files.

    The audio files in the object table must be of asupported type. An erroris returned for any row that contains an audio files of an unsupported type.

  • RECOGNITION_CONFIG: aSTRING value that contains aRecognitionConfig resourcein JSON format.

    If a recognizer has been specified for the remote model by using theSPEECH_RECOGNIZER option, you can'tspecify aRECOGNITION_CONFIG value.

    If no recognizer has been specified for the remote model by using theSPEECH_RECOGNIZER option, you must specify aRECOGNITION_CONFIG value.This value is used to provide a configuration for the defaultrecognizer. You can only use thechirptranscription modelin the speech recognizer orRECOGNITION_CONFIG value that you provide.

Output

ML.TRANSCRIBE returns the following columns:

  • transcripts: aSTRING value that contains the transcripts from processingthe audio files.
  • ml_transcribe_result: aJSON value that contains the result from the Speech-to-Text API.
  • ml_transcribe_status: aSTRING value that contains the APIresponse status for the corresponding row. This value is empty if theoperation was successful.
  • The object table columns.

Quotas

SeeCloud AI service functions quotas and limits.

Known issues

This section contains information about known issues.

Resource exhausted errors

Sometimes after a query job that uses this function finishes successfully,some returned rows contain the following error message:

Aretryableerroroccurred:RESOURCEEXHAUSTEDerrorfrom<remoteendpoint>

This issue occurs because BigQuery query jobs finish successfullyeven if the function fails for some of the rows. The function fails when thevolume of API calls to the remote endpoint exceeds the quota limits for thatservice. This issue occurs most often when you are running multiple parallelbatch queries. BigQuery retries these calls, but if the retriesfail, theresource exhausted error message is returned.

To iterate through inference calls until all rows are successfully processed,you can use theBigQuery remote inference SQL scriptsor theBigQuery remote inference pipeline Dataform package.

Invalid argument errors

Sometimes after a query job that uses this function finishes successfully,some returned rows contain the following error message:

INVALID_ARGUMENT:Theaudiofilecannotbeprocessedintime.

This issue occurs because one of the audio files being processed is too long.Check your input audio files to make sure they are all 30 minutes or less.

Locations

You can run theML.TRANSCRIBE function in the followinglocations:

  • asia-southeast1
  • europe-west4
  • us-central1
  • US
  • EU

ML.TRANSCRIBE must run in the same region as the remote model that thefunction references.

Limitations

The function can't process audio files that are longer than 30 minutes. Any rowthat contains such a file returns an error.

Example

The following example transcribes the audio files represented by theaudio table:

Create the model:

#CreatemodelCREATEORREPLACEMODEL`myproject.mydataset.transcribe_model`REMOTEWITHCONNECTION`myproject.myregion.myconnection`OPTIONS(remote_service_type='CLOUD_AI_SPEECH_TO_TEXT_V2',speech_recognizer='projects/project_number/locations/recognizer_location/recognizer/recognizer_id');

Transcribe the audio files without overriding the recognizer's defaultconfiguration:

SELECT*FROMML.TRANSCRIBE(MODEL`myproject.mydataset.transcribe_model`,TABLE`myproject.mydataset.audio`);

Transcribe the audio files and override the recognizer's default configuration:

SELECT*FROMML.TRANSCRIBE(MODEL`myproject.mydataset.transcribe_model`,TABLE`myproject.mydataset.audio`,recognition_config=>(JSON'{"language_codes": ["en-US" ],"model": "chirp","auto_decoding_config": {}}'));

The result is similar to the following:

transcripts|ml_transcribe_result|ml_transcribe_status|uri|...|-------|--------|--------|--------|--------|--------|--------|--------|--------OKGooglestreamstrangerthingsfromNetflixtomyTV.Okay,strangerthingsfromNetflixplayingontvsmarthomeandit'sjust...|{"metadata":{"total_billed_duration":{"seconds":56}},"results":[{"alternatives":[{"confidence":0.738729,"transcript"...||gs://mybucket/audio_files|

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-15 UTC.