Closed NilaySheth closed 8 years ago
What do you mean by "long audio"? Did you edit the code?
I am trying to transcribe a video with length of more than 2 minutes. But after sometime, I am getting following error and audio transcribing suddenly gets stopped. I am getting this error in onError of ApiFragment.
I am just using the As Is code uploaded here.
The API cannot process very long audio, for example more than 30 seconds, in a single API call.
The sample tries to find silence while recording (see VoiceRecorder.java). This should work fine for most use cases unless you can keep on talking for a very long time with a single breath.
If you are directly feeding audio streaming of the video to the API, please add some logic to separate them into smaller segments just like VoiceRecorder.java does.
So if I keep SPEECH_TIMEOUT_MILLIS as low as possible, then will it work ?
It might work. It really depends on the input, though.
SPEECH_TIMEOUT_MILLIS is a constant used to detect silence. If the level of audio is below AMPLITUDE_THRESHOLD for more than SPEECH_TIMEOUT_MILLIS milliseconds, VoiceRecorder determines that as silence.
Probably I should just forcibly cut the input when the audio is recorded longer than 30 seconds or so.
Great. Thanks a lot. I think I can implement that too.
But does this error say the same thing:
io.grpc.StatusRuntimeException: OUT_OF_RANGE: Operation was attempted past the valid range. at io.grpc.Status.asRuntimeException(Status.java:545) at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:370) at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:458) at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$500(ClientCallImpl.java:385) at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$3.runInContext(ClientCallImpl.java:486) at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:52) at io.grpc.internal.SerializingExecutor$TaskRunner.run(SerializingExecutor.java:154) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818)
OK, reading the deep parts of original error, it seems like a different issue. It is complaining about the access token expiration. I didn't add logic to refresh access tokens in this sample, so you will get the error when you have the app open for too long, such as over an hour.
The second error you posted does seem like the one about audio too long. Do you constantly get the error or only sometimes?
Only sometimes. I can say that I am getting it once every 5 to 6 times.
I suppose it is about audio too long. I can't be sure as I cannot take a look at the app screen and what's going on, but I guess that VoiceRecorder.java sometimes detects silence, sometimes not, thus resulting in an inconsistent error pattern. I'll improve the class, but it will take some time. Thank you for reporting the issue.
Sure. thanks a lot for the support. I will be waiting for the update.
For streaming, we only support up to 60 seconds at a time.
If you get an error while streaming less than 60 seconds please let us know, we would love to work with you on resolving.
The streaming stops and start based silence detection. So by going that logic, streaming is always less then 60 seconds. But if I continue this demo for more than 60 seconds (with start and stop included) then it should work.
Hi Guys,
Any updates on this ?
Uploaded a pull request for VoiceRecorder.
Hi, I am getting below errors during calling cloud speech API in this demo, and the outcomes are like
Case 1:
09-03 12:40:13.945 13676-14146//SpeechService: Error calling the API.
io.grpc.StatusRuntimeException: UNAVAILABLE
at io.grpc.Status.asRuntimeException(Status.java:543)
at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:395)
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:426)
at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:76)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:512)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$700(ClientCallImpl.java:429)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:544)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:52)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:117)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
Caused by: javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x7bbeca98: Failure in SSL library, usually a protocol error
error:140740B5:SSL routines:SSL23_CLIENT_HELLO:no ciphers available (external/openssl/ssl/s23_clnt.c:486 0x72dccd74:0x00000000)
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:449)
at io.grpc.okhttp.OkHttpProtocolNegotiator.negotiate(OkHttpProtocolNegotiator.java:103)
at io.grpc.okhttp.OkHttpProtocolNegotiator$AndroidNegotiator.negotiate(OkHttpProtocolNegotiator.java:169)
at io.grpc.okhttp.OkHttpTlsUpgrader.upgrade(OkHttpTlsUpgrader.java:76)
at io.grpc.okhttp.OkHttpClientTransport$1.run(OkHttpClientTransport.java:433)
... 4 more
Caused by: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x7bbeca98: Failure in SSL library, usually a protocol error
error:140740B5:SSL routines:SSL23_CLIENT_HELLO:no ciphers available (external/openssl/ssl/s23_clnt.c:486 0x72dccd74:0x00000000)
at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:406)
Case 2:
09-05 17:08:54.795 18401-19870/com.google.cloud.android.speech E/SpeechService: Error calling the API.
io.grpc.StatusRuntimeException: UNAVAILABLE: Transport stopped
at io.grpc.Status.asRuntimeException(Status.java:543)
at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:395)
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:426)
at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:76)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:512)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$700(ClientCallImpl.java:429)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:544)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:52)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:117)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Case 3:
08-30 16:20:21.575 10494-10970/ E/SpeechService: Error calling the API.
io.grpc.StatusRuntimeException: OUT_OF_RANGE: Audio data is being streamed too slow. Please stream audio data approximately at real time.
at io.grpc.Status.asRuntimeException(Status.java:543)
at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:395)
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:426)
at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:76)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:512)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$700(ClientCallImpl.java:429)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:544)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:52)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:117)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Kindly help us out for smooth operation in Speech api.
io.grpc.StatusRuntimeException: OUT_OF_RANGE: Audio Timeout Error: Long duration elapsed without audio. Audio should be sent close to real time. at io.grpc.Status.asRuntimeException(Status.java:543) at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:395) at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:426) at io.grpc.internal.ClientCallImpl.access$100(ClientCallImpl.java:76) at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:512) at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$700(ClientCallImpl.java:429) at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:544) at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:52) at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:117) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764)
Unable to solve this issue. Whats the cause and solution for this issue?
Hi,
I am getting following error while transcribing long audio:
I cannot find out the reason for this issue.