DEV Community

Cover image for Get Started with Amazon Transcribe in Easy Steps

Get Started with Amazon Transcribe in Easy Steps

INTRODUCTION

Amazon Transcribe is a fully managed, automatic speech recognition (ASR) service that makes it easy for developers to add speech to text capabilities to their applications. [AWS]

Key Features of Amazon Transcribe

  • Batch transcription and Realtime Transcription are Both Available
  • Supports Multiple Languages
  • Speaker Identification
  • Custom Language Model
  • Custom Vocabulary

There are various other features as well. You can go through their website for more information about Amazon Transcribe features and use cases.

Pre Requisite

The only prerequisite is that you should have an AWS Account with sufficient permissions to access Transcribe and S3. You can use Transcribe from the AWS Console or through AWS SDKs available for multiple languages. For this demo, I'll be utilizing a Lambda function with the Python 3.10 runtime to call the Transcribe API.

Creating Transcribe Job

Step 1: Prepare an S3 Bucket

Before creating the Lambda function, ensure you have an S3 bucket set up to store the media file you want to transcribe.

Step 2: Create a Lambda Function

  • Create a Lambda function and attach an IAM role with the following permissions:
    • AmazonTranscribeFullAccess (AWS Managed Policy)
    • S3:GetObject permission (or a fine-grained custom policy if needed).
  • Refer to this article for guidance on setting up a Lambda function.
  • Copy the code from this GitHub repository and paste it into the Lambda function editor.

Step 3: Create a Test Event

Create a test event with the following parameters:

{
  "MediaFileUri": "s3://your-bucket-name/media-file.mp4"
}
Enter fullscreen mode Exit fullscreen mode

Step 4: Deploy and Test the Code

Deploy the Lambda function.
Execute the test event. You will receive a response similar to the following:

Image description

Step 5: Verify the Transcription

Navigate to the AWS Transcribe service in the AWS Management Console to verify and download the transcription output.

Image description

Creating Transcription Downloading Job

Step 1: Create another Lambda Function

  • Create another Lambda function and attach an IAM role with the following permissions:
    • AmazonTranscribeFullAccess (AWS Managed Policy)
    • Copy the code from this GitHub repository and paste it into the Lambda function editor.

Step 2: Create a Test Event

Create a test event with the following parameters:

{
  "TranscriptionJobName": "your-jobname-here"
}
Enter fullscreen mode Exit fullscreen mode

Step 3: Deploy and Test the Code

Deploy the Lambda function.
Execute the test event. You will receive a response similar to the following:

Image description

Conclusion

We have learned how to use Amazon Transcribe for generating transcription of media files.
We have setup two lambda functions for creating transcription job of a media file stored in S3 and downloading transcription.

Hope you have learned something new.
If you liked this article make sure you give it a heart and comment down your suggestions/feedback.

References

Top comments (0)