Tono Nam
Tono Nam

Reputation: 36058

AWS Transcribe through AWS CLI

I am able to use AWS S3 service through the AWS CLI like so:

aws s3 cp FileToUpload.txt s3://MyBucketName/file.txt

How can I make use of AWS transcribe service? Looking through google takes me to:

https://docs.aws.amazon.com/cli/latest/reference/transcribe/index.html

But I find no examples on how to use AWS Transcribe using the CLI. I am looking for something like:

aws transcribe createJob s3://MyBucketName/audioToTranscribe.mp3

This does not work but I am assuming there should exists something similar.

I was able to find an example on how to use aws transcribe through c# and it is like this:

MediaFormat mediaFormat;

if (s3BucketNameFollowedByFullPathToAudio.EndsWith(".mp3"))
{
    mediaFormat = MediaFormat.Mp3;
}
else if (s3BucketNameFollowedByFullPathToAudio.EndsWith(".wav"))
{
    mediaFormat = MediaFormat.Wav;
}
else
{

    throw new Exception();
}

var test = transcribeClient.StartTranscriptionJob(new StartTranscriptionJobRequest()
{
    LanguageCode = LanguageCode.EnUS,
    TranscriptionJobName = jobId,
    Media = new Media()
    {


        MediaFileUri = "https://s3.us-east-2.amazonaws.com/" + s3BucketNameFollowedByFullPathToAudio

    },
    MediaFormat = mediaFormat, // MediaFormat.Wav,
});

How can I do this through the aws CLI ?

Upvotes: 1

Views: 782

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269520

From AWS Transcribe start-transcription-job — AWS CLI Command Reference:

  start-transcription-job
--transcription-job-name <value>
--language-code <value>
[--media-sample-rate-hertz <value>]
--media-format <value>
--media <value>
[--output-bucket-name <value>]
[--settings <value>]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]

There is a walkthrough available at: Getting Started (AWS Command Line Interface) - Amazon Transcribe

Upvotes: 2

Related Questions