GuruCharan94
GuruCharan94

Reputation: 932

Azure Cognitive Services - Batch Transcription API responds with error message "The recording URI is invalid."

Steps Followed:

  1. I created a speech services instance in West US.
  2. I have the right headers(Content-Type and Ocp-Apim-Subscription-Key)
  3. I make a POST request to https://westus.cris.ai/api/speechtotext/v2.0/transcriptions/ with below request payload
{
  "recordingsUrl": "https://transcribehm97c1.blob.core.windows.net/audio-files/2019-04-04_Blockchain%20explained%20with%20TruStory%27s%20Preethi%20Kasireddy.mp3?st=2019-05-27T12%3A19%3A27Z&se=2019-12-31T12%3A19%3A00Z&sp=rl&sv=2018-03-28&sr=b&sig=HFBvGl1pmCM95MNU9U3yniMNXrUMT6RmPb36F32cxrY%3D",
  "models": [],
  "locale": "en-US",
  "name": "I dont know why this is not working",
  "description": "Someone please send help",
  "properties": {
    "ProfanityFilterMode": "Masked",
    "PunctuationMode": "DictatedAndAutomatic"
  }
}
  1. I get a “202 Accepted” response with below headers. This confirms that the request body is valid.
location: https://westus.cris.ai/api/speechtotext/v2.0/transcriptions/69b7abf4-6383-4490-88a9-9fd42a77e470
  1. When I make a GET Request to the above location, I see this
{
  "recordingsUrl": "https://transcribehm97c1.blob.core.windows.net/audio-files/2019-04-04_Blockchain explained with TruStory's Preethi Kasireddy.mp3?st=2019-05-27T12:19:27Z&se=2019-12-31T12:19:00Z&sp=rl&sv=2018-03-28&sr=b&sig=HFBvGl1pmCM95MNU9U3yniMNXrUMT6RmPb36F32cxrY%3D",
  "resultsUrls": {},
  "models": [“I have removed this for brevity”],
  "statusMessage": "The recordings URI is invalid.",
  "id": "69b7abf4-6383-4490-88a9-9fd42a77e470",
  "createdDateTime": "2019-05-27T12:43:39Z",
  "lastActionDateTime": "2019-05-27T12:43:50Z",
  "status": "Failed",
  "locale": "en-US",
  "name": "I dont know why this is not working",
  "description": "Someone please send help",
  "properties": {
    "ProfanityFilterMode": "Masked",
    "PunctuationMode": "DictatedAndAutomatic"
  }
}
  1. The transcriptions fails for some URL's while passing for others for blobs in the same storage although they are all valid URL’s. The SAS URI in the request is valid till end of the year.
  2. I have re-tried the same request multiple times via code and Postman and it fails.

Link to Swagger Page : https://westus.cris.ai/swagger/ui/index

Upvotes: 2

Views: 1712

Answers (2)

Olivier Simard-Hanley
Olivier Simard-Hanley

Reputation: 37

Here are two things that helped me create a SAS URL to feed into the Azure Speech Batch transcription service. I was frustratingly getting the "Authentication failed for recordings URI." message.

  • When you navigate to a file through the storage interface, extra spaces will be hidden. For example, my file was named Weekly standup.mp4 (two spaces) but in the storage interface it appeared as Weekly standup.mp4 (one space). It is best to fetch your blob name programmatically to then feed it to your downstream task rather than to copy it from the interface.
  • When generating a SAS URL, also feed it a start date along with the expiry date :
    from azure.storage.blob import generate_blob_sas, BlobSasPermissions
    from datetime import datetime, timezone, timedelta

    sas_token = generate_blob_sas(
        account_name=account_name,
        account_key=account_key,
        container_name = container_name,
        blob_name = blob_name,
        permission=BlobSasPermissions(read=True),
        start=datetime.now(timezone.utc) - timedelta(hours=8),
        expiry=datetime.now(timezone.utc) + timedelta(hours=8)
    )

Upvotes: 0

Ram
Ram

Reputation: 2754

The issue may be due to the audio file size. Please refer the core features for REST API as the REST support only short Audio.

Upvotes: 0

Related Questions