ebarnouflant icon indicating copy to clipboard operation
ebarnouflant copied to clipboard

Automating Google Speech to Text

Open crohr opened this issue 3 years ago • 0 comments

Clone and install the sample speech to text node repository:

git clone https://github.com/googleapis/nodejs-speech.git
cd nodejs-speech/samples && npm install && cd ..

Create service account key credential file in Google Cloud Console (don't forget to enable Speech to Text API as well).

Iterate over your files (they must be stored in a google storage bucket):

for file in $(cat podcasts-list.txt); do
  echo $file
  echo $file >> podcasts-transcripts.txt
  time GOOGLE_APPLICATION_CREDENTIALS=/path/to/speech-to-text-service-account-key.json node samples/recognize.js \
    async-gcs gs://google-storage-bucket/$file -l fr-FR -e WEBM_OPUS >> podcasts-transcripts.txt
  echo "DONE" >> podcasts-transcripts.txt
done

For the choice of encoding, refer to https://cloud.google.com/speech-to-text/docs/encoding (might be worth verifying the encoding of your audio files first).

crohr avatar Nov 11 '22 08:11 crohr