Troubleshooting of Google cloud speech to text: Difference between revisions
Jump to navigation
Jump to search
m
Troubleshooting of Google cloud speech to text (edit)
Revision as of 10:52, 10 July 2020
, 10 July 2020→For audio longer than 1 min use LongRunningRecognize with a 'uri' parameter
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Template:Speech to text}} | |||
Troubleshooting of Google [https://cloud.google.com/speech-to-text/ Cloud Speech-to-Text - 語音辨識] | Troubleshooting of Google [https://cloud.google.com/speech-to-text/ Cloud Speech-to-Text - 語音辨識] | ||
== Brief instruction == | |||
* If the audio file's duration is '''longer''' than 1 minute, (1) Use the uri: {{kbd | key=<nowiki>speech:longrunningrecognize</nowiki>}} NOT {{kbd | key=<nowiki>speech:recognize</nowiki>}} (2) Upload files to [https://console.cloud.google.com/storage/ Google cloud storage] (gcs) | |||
* If the audio file's duration is '''shorter''' than 1 minute, (1) Use the uri: {{kbd | key=<nowiki>speech:longrunningrecognize</nowiki>}}. Or choose to use {{kbd | key=<nowiki>speech:recognize</nowiki>}} (2) Use the files are located on the computer. Or choose to upload files to [https://console.cloud.google.com/storage/ Google cloud storage] (gcs) | |||
== ERROR: (gcloud.auth.application-default.print-access-token) The Application Default Credentials are not available == | == ERROR: (gcloud.auth.application-default.print-access-token) The Application Default Credentials are not available == | ||
Line 42: | Line 47: | ||
Solution: Specify the encoding of audio file. For details, see [https://cloud.google.com/speech-to-text/docs/encoding Introduction to Audio Encoding | Cloud Speech-to-Text API | Google Cloud] & [https://cloud.google.com/speech-to-text/docs/reference/rest/v1/RecognitionConfig#AudioEncoding RecognitionConfig | Cloud Speech-to-Text API | Google Cloud]. You may use VLC player to view the encoding of audio file<ref>[https://forum.videolan.org/viewtopic.php?t=95136#p315198 How to view audio bitrate in VLC - The VideoLAN Forums]</ref>. If the codec (encoding) of audio file is not in the allowed list on [https://cloud.google.com/speech-to-text/docs/reference/rest/v1/RecognitionConfig#AudioEncoding page], the codec (encoding) of audio file should be converted by [[Audio converter | audio converter]]. | Solution: Specify the encoding of audio file. For details, see [https://cloud.google.com/speech-to-text/docs/encoding Introduction to Audio Encoding | Cloud Speech-to-Text API | Google Cloud] & [https://cloud.google.com/speech-to-text/docs/reference/rest/v1/RecognitionConfig#AudioEncoding RecognitionConfig | Cloud Speech-to-Text API | Google Cloud]. You may use VLC player to view the encoding of audio file<ref>[https://forum.videolan.org/viewtopic.php?t=95136#p315198 How to view audio bitrate in VLC - The VideoLAN Forums]</ref>. If the codec (encoding) of audio file is not in the allowed list on [https://cloud.google.com/speech-to-text/docs/reference/rest/v1/RecognitionConfig#AudioEncoding page], the codec (encoding) of audio file should be converted by [[Audio converter | audio converter]]. | ||
== | == If the audio file's duration is longer than 1 minute use LongRunningRecognize with a 'uri' parameter == | ||
input | input | ||
<pre> | <pre> | ||
Line 79: | Line 84: | ||
</pre> | </pre> | ||
Solution: (1) | Solution: (1) If the audio file's duration is shorter than 1 min, use the uri: {{kbd | key=<nowiki>speech:recognize</nowiki>}}. (2) If the audio file's duration is longer than 1 min. Upload files to [https://console.cloud.google.com/storage/ Google cloud storage] (gcs). Modify the uri from {{kbd | key=<nowiki>speech:recognize</nowiki>}} to {{kbd | key=<nowiki>speech:longrunningrecognize</nowiki>}}. | ||
<pre> | <pre> | ||
$ curl -s -H "Content-Type: application/json" \ | $ curl -s -H "Content-Type: application/json" \ | ||
Line 165: | Line 170: | ||
{{Template:Troubleshooting}} | {{Template:Troubleshooting}} | ||
[[Category:Google]] | [[Category:Google]] [[Category:NLP]] [[Category:Tool]] |