https://github.com/m-nathani/speech_to_text
how to use the Google Cloud Speech API to transcribe audio/video files.
https://github.com/m-nathani/speech_to_text
audio composer ffmpeg google-cloud google-cloud-speech google-speech-recognition googlespeechapi php speech speech-api speech-quickstart speech-recognition speech-samples speech-to-text speechphrase transcribe-audio-files transcriber
Last synced: 11 months ago
JSON representation
how to use the Google Cloud Speech API to transcribe audio/video files.
- Host: GitHub
- URL: https://github.com/m-nathani/speech_to_text
- Owner: m-nathani
- License: agpl-3.0
- Created: 2019-01-24T20:59:31.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-18T20:02:35.000Z (about 7 years ago)
- Last Synced: 2025-04-07T03:41:24.849Z (12 months ago)
- Topics: audio, composer, ffmpeg, google-cloud, google-cloud-speech, google-speech-recognition, googlespeechapi, php, speech, speech-api, speech-quickstart, speech-recognition, speech-samples, speech-to-text, speechphrase, transcribe-audio-files, transcriber
- Language: PHP
- Homepage:
- Size: 1.73 MB
- Stars: 34
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Google Cloud Speech
These samples show how to use the [Google Cloud Speech API][speech-api]
to transcribe audio files.
1. It takes mp4 files as argument
2. Converts it to audio in FLAC encoding (lossless encoding ) and Breaks the audio file into 10 secs clips
3. transcribes each 10 sec audio file and prints the speech to text result on console.
## Pre-requisite
0. Setup Google Cloud [Speech Project][speech-quickstart]
1. Install ffmpeg on your machine (linux)
## Installation
Install the dependencies for this library via [composer](https://getcomposer.org)
$ cd /path/to/speech_to_text
$ composer install
Configure your project using [Application Default Credentials]
$ export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
## Usage
To run the Speech Samples:
$ php speech.php
Cloud Speech
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Available commands:
help Displays help for a command
list Lists commands
transcribe Transcribe an video file using Google Cloud Speech API
## Help
$ php speech.php transcribe --help
Usage:
transcribe [options] [--]
Arguments:
video-file The video file to transcribe
Options:
-l, --language=LANGUAGE The language to transcribe [default: "en-US"]
-e, --encoding=ENCODING The encoding of the audio file. This is required if the encoding is unable to be determined. [default: 2]
-b, --brand-file=BRAND-FILE The brand names for speech context to transcribe [default: "brands"]
-r, --rate-hertz=RATE-HERTZ The sample rate (in Hertz) of the supplied video [default: 48000]
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
Help:
Transcribe an video file using Google Cloud Speech API
The transcribe command transcribes video from a file using the
Google Cloud Speech API.
php speech.php transcribe video_file.mp4
Just send the speech sample, send it through the speech
API using the transcribe command:
```sh
php speech.php transcribe [path to audio/video file]
```
[speech-api]: http://cloud.google.com/speech
[speech-quickstart]: https://cloud.google.com/speech-to-text/docs/quickstart-client-libraries
[google-cloud-php]: https://googlecloudplatform.github.io/google-cloud-php/
[choose-encoding]: https://cloud.google.com/speech/docs/best-practices#choosing_an_audio_encoding