Timeout issue with Google Speech to text - google-cloud-speech

I have successfully used the asynchronous file conversion tool with both python and the gcloud tool. However, when I try and use either option with different audio files of my own i have in different formats, I get error messages. For example, I have been using a 45 second mp3 and trying this command:
python long.py gs://audio_001/pt2.mp3
The error message, I get back is below.
"Waiting for operation to complete...
Traceback (most recent call last):
File "long.py", line 99, in <module>
transcribe_gcs(args.path)
File "long.py", line 80, in transcribe_gcs
response = operation.result(timeout=300)
File "C:\Python27\lib\site-packages\google\api_core\future\polling.py", line
120, in result
raise self._exception
google.api_core.exceptions.GoogleAPICallError: None Unexpected state: Long-
running operation had neither response nor error set."
I changed the name of the asynchronous script and increased the timeouts to 300 seconds.
Please suggest.

It’s likely the audio file type you’re using isn’t encoded in a supported format [1]. I’ve tried to process MP3 files myself but it always returns no results, or returns an index error (in both standard and long transcription methods). I’d recommend converting the file to FLAC or WAV - this works for me.
[1] https://cloud.google.com/speech-to-text/docs/encoding#audio-encodings

Related

Delay occouring when skipping to another mp3

I am recording incoming stream to mp3 file into 20 seconds parts in sender device. After that i am uploading this files to Google Drive(using RCLONE). Then i am downloading this files to receiver device. I am waiting about a while time (buffering) in the receiver side. Then i start to play this file using VLC-player from command line and listening this song. Having a problem when skipping to another m3 file in media-player occurring an silence about 0.1 seconds. I tried to concatenate those mp3 files into one file, but same problem had occurred again.
How can i handle this problem ?
Here is the part of code;
def Sound(self):
t1=threading.Thread(target=self.read_playlist) # update playlist file continuously
t1.start()
vlc_instance = vlc.Instance()
player = vlc_instance.media_player_new()
i=0
while 1:
media = vlc_instance.media_new(self.playlist[i].strip())
player.set_media(media)
duration=self.len_mp3(self.playlist[i].strip())
player.play()
time.sleep(duration)
i=i+1
Mr. Brad, i am so late for feedback sorry about that. Problem solved with your advice, here what i do:
First i am creating an HLS segment with this command;
ffmpeg -f alsa -i plughw:1,0 -c:a libmp3lame -f segment -strftime 1 -segment_time 1 -segment_format mpegts path/%Y%m%d%H%M%S.ts
This creates a ".ts" files which is the length of 1 second according to timestamp
In the receiver side, i am downloading this ".ts" files to my device. While downloading these ".ts" files, i am waiting to create a ".m3u8" file for example let's say,
buffer time is 3 minutes, then i am starting the download process and waiting for 3 minutes to create ".m3u8" file.
After 3 minutes, i am starting to create ".m3u8" file manually and i am starting mpv-player(python interface) to play the ".m3u8" file. I am updating ".m3u8" file every one second in the receiver side

Uploading Program to OpenMPI gives initialization error, on IntelMPI memory leak

I am a graduate student (master's) and use an in-house code for running my simulations that use MPI. Earlier, I used OpenMPI on a supercomputer we used to access and since it shut down I've been trying to switch to another supercomputer that has Intel MPI installed on it. The problem is, the same code that was working perfectly fine earlier now gives memory leaks after a set number of iterations (time steps). Since the code is relatively large and my knowledge of MPI is very basic, it is proving very difficult to debug it.
So I installed OpenMPI onto this new supercomputer I am using, but it gives the following error message upon execution and then terminates:
Invalid number of PE
Please check partitioning pattern or number of PE
NOTE: The error message is repeated for as many numbers of nodes I used to run the case (here, 8). Compiled using mpif90 with -fopenmp for thread parallelisation.
There is in fact no guarantee that running it on OpenMPI won't give the memory leak, but it is worth a shot I feel, as it was running perfectly fine earlier.
PS: On Intel MPI, this is the error I got (compiled with mpiifort with -qopenmp)
Abort(941211497) on node 16 (rank 16 in comm 0): Fatal error in PMPI_Isend: >Unknown error class, error stack:
PMPI_Isend(152)...........: MPI_Isend(buf=0x2aba1cbc8060, count=4900, dtype=0x4c000829, dest=20, tag=0, MPI_COMM_WORLD, request=0x7ffec8586e5c) failed
MPID_Isend(662)...........:
MPID_isend_unsafe(282)....:
MPIDI_OFI_send_normal(305): failure occurred while allocating memory for a request object
Abort(203013993) on node 17 (rank 17 in comm 0): Fatal error in PMPI_Isend: >Unknown error class, error stack:
PMPI_Isend(152)...........: MPI_Isend(buf=0x2b38c479c060, count=4900, dtype=0x4c000829, dest=21, tag=0, MPI_COMM_WORLD, request=0x7fffc20097dc) failed
MPID_Isend(662)...........:
MPID_isend_unsafe(282)....:
MPIDI_OFI_send_normal(305): failure occurred while allocating memory for a request object
[mpiexec#cx0321.obcx] HYD_sock_write (../../../../../src/pm/i_hydra/libhydra/sock/hydra_sock_intel.c:357): write error (Bad file descriptor)
[mpiexec#cx0321.obcx] cmd_bcast_root (../../../../../src/pm/i_hydra/mpiexec/mpiexec.c:164): error sending cmd 15 to proxy
[mpiexec#cx0321.obcx] send_abort_rank_downstream (../../../../../src/pm/i_hydra/mpiexec/intel/i_mpiexec.c:557): unable to send response downstream
[mpiexec#cx0321.obcx] control_cb (../../../../../src/pm/i_hydra/mpiexec/mpiexec.c:1576): unable to send abort rank to downstreams
[mpiexec#cx0321.obcx] HYDI_dmx_poll_wait_for_event (../../../../../src/pm/i_hydra/libhydra/demux/hydra_demux_poll.c:79): callback returned error status
[mpiexec#cx0321.obcx] main (../../../../../src/pm/i_hydra/mpiexec/mpiexec.c:1962): error waiting for event"
I will be happy to provide the code in case somebody is willing to take a look at it. It is written using Fortran with some of the functions written in C. My research progress has been completely halted due to this problem and nobody at my lab has enough experience with MPI to resolve this.

Scrubbing does not work on playing a network stream video vlcj

We are having the same issue that is descibed here https://trac.videolan.org/vlc/ticket/4888
When we try to scrubbing the video, it does not work, vlcj is buffering every time we scrubbing and we are getting the errors logs below
[163bdd44] core input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 101 ms)
[163bdd44] core input error: ES_OUT_RESET_PCR called
[2403dc04] core vout display error: Failed to set on top
[164a8284] http access error: error: HTTP/1.1 500 Object not found
[5:56]
[15c5f1d4] core input error: input control fifo overflow, trashing type=3
Does anyone know if using a convention of VLC Configuration we can fix it ?
Thanks
Francisco

Exception handling for writedata to file for swift 1.2

I am creating csv file and writing a data to that file using writeData method of NSFileHandle. Apple mention method raises exception if no free space is left. My question is that how would i handle exception in swift 1.2. And what best possible way to handle memory limit issue check before writing to file?
Swift doesn't offer exception handling. Yes, you can 'install' your own exception handler, but you are still not able to recover from an exception. What Swift 2 provides for you is error handling (not exception handling), see apple docs about do / try / catch
func writeData(_ data: NSData)
If the receiver is a file, writing takes place at the file pointer’s current position. After it writes the data, the method advances the file pointer by the number of bytes written. This method raises an exception if the file descriptor is closed or is not valid, if the receiver represents an unconnected pipe or socket endpoint, if no free space is left on the file system, or if any other writing error occurs.

Can a Google App Engine App get blocked from accessing the Google Docs API

I have implemented a Google App Engine application which uploads documents to specific folders in Google Docs. A month ago I started having response time issues (deadline exceeded on GdataClient.GetDocList, fetch-url call, in Gdata Client)when querying for a specific folder in Google Docs. This caused a lot of tasks to queue-up in the Task Queue.
When I saw this, I paused the queues for a while - about 24 hours. When I restarted the queue nearly all of the where uploaded again, except 10 of the the files / tasks.
When I implemented the GetDocList call, I implemented a retry / sleep functionality to avoid the sometimes intermittent "DeadLineExceeded" which I got during my .GetNextLink().href-loop. I know that this is not a good "Cloud" design. But I was forced to do this to get it stable enough for production. For every sleep I extend the wait time and I only retry 5 times. The last time I wait for about 25 sec before retrying.
What I think is that all the tasks in the queues retried so many times (even though I have limited the tasks to running in serial-mode , one at a time. Maximum 5 a minute) that the App Engine App where black-listed from the Google Docs Api.
Can this happen?
What do I need to do to be able to query Google Docs Api from the same App Engine instance again?
Do I need to migrate the App Engine app to a new Application ID?
When I try this from my development environment, the code works, it queries the folder structure and returns a result within the time-limit.
The folder-structure I'm querying is rather big, which means that I need to fetch them via the .GetNextLink().href. In my development environment, the folderstructure contains of much less folders.
Anyway, this have been working very good for about a year in the production AppEngine instance. But stopped working around the 4th - 5th of March.
The user-account which is queried is currently using 7000 MB (3%) of the available 205824 MB.
When I use the code from dev-env but with completely different Google Apps domain / app-id / google account I can not reproduce the error.
When I changed the max-results to 1 (instead of 100 or 50 or 20) I succeed intermittently. But as the max-result is 1 I need to query many 1000 times, and since I only succeed with max 3 in a row, until my exponential back-off quits I never get my whole resultset. The resultset (the folder I query consist of between 300 to 400 folders (which in turn consists of at least 2 - 6 subfolders with pdf-files in)
I have tried with max-result 2, then the fetch fails on every occasion. If I change back to max-result 1 , then it succeeds on one or two fetches in a row, but this is not suffient. Since I need the whole folder-structure to be able to find a the correct folder to store the file in.
I have tried this from my local environment - i.e. from a completly different IP-adress and it still fails. This means that the app-engine app is not blocked from accessing google docs. The max-result change from 2 to 1 also proves that.
Conclusion:
The slow return time from the Google Docs API must be due to the extensive amount of files and collections inside the collection which I'm looping through. Keep in mind that this collection contains about 3500 Mb. Is this an issue?
Log:
DocListUrl to get entries from = https://docs.google.com/feeds/default/private/full/folder:XXXXXXX/contents?max-results=1.
Retrying RetryGetDocList, wait for 1 seconds.
Retrying RetryGetDocList, wait for 1 seconds.
Retrying RetryGetDocList, wait for 4 seconds.
Retrying RetryGetDocList, wait for 9 seconds.
Retrying RetryGetDocList, wait for 16 seconds.
Retrying RetryGetDocList, wait for 25 seconds.
ApplicationError: 5
Traceback (most recent call last):
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/_webapp25.py", line 703, in call
handler.post(*groups)
File "/base/data/home/apps/XXXX/prod-43.358023265943651014/DocsHandler.py", line 418, in post
success = uploader.Upload(blob_reader, fileToUpload.uploadSize, fileToUpload.MainFolder, fileToUpload.ruleTypeReadableId ,fileToUpload.rootFolderId,fileToUpload.salesforceLink,fileToUpload.rootFolder, fileToUpload.type_folder_name, fileToUpload.file_name, currentUser, client, logObj)
File "/base/data/home/apps/XXXX/prod-43.358023265943651014/DocsClasses.py", line 404, in Upload
collections = GetAllEntries('https://docs.google.com/feeds/default/private/full/%s/contents?max-results=1' % (ruleTypeFolderResourceId), client)
File "/base/data/home/apps/XXXX/prod-43.358023265943651014/DocsClasses.py", line 351, in GetAllEntries
chunk = RetryGetDocList(client.GetDocList , chunk.GetNextLink().href)
File "/base/data/home/apps/XXX/prod-43.358023265943651014/DocsClasses.py", line 202, in RetryGetDocList
return functionCall(uri)
File "/base/data/home/apps/XXX/prod-43.358023265943651014/gdata/docs/client.py", line 142, in get_doclist
auth_token=auth_token, **kwargs)
File "/base/data/home/apps/XXXX/prod-43.358023265943651014/gdata/client.py", line 635, in get_feed
**kwargs)
File "/base/data/home/apps/XXXXX/prod-43.358023265943651014/gdata/client.py", line 265, in request
uri=uri, auth_token=auth_token, http_request=http_request, **kwargs)
File "/base/data/home/apps/XXXX/prod-43.358023265943651014/atom/client.py", line 117, in request
return self.http_client.request(http_request)
File "/base/data/home/apps/XXXXX/prod-43.358023265943651014/atom/http_core.py", line 420, in request
http_request.headers, http_request._body_parts)
File "/base/data/home/apps/XXXXX/prod-43.358023265943651014/atom/http_core.py", line 497, in _http_request
return connection.getresponse()
File "/base/python_runtime/python_dist/lib/python2.5/httplib.py", line 206, in getresponse
deadline=self.timeout)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/urlfetch.py", line 263, in fetch
return rpc.get_result()
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/apiproxy_stub_map.py", line 592, in get_result
return self.__get_result_hook(self)
File "/base/python_runtime/python_lib/versions/1/google/appengine/api/urlfetch.py", line 371, in _get_fetch_result
raise DeadlineExceededError(str(err))
DeadlineExceededError: ApplicationError: 5
Regards
/Jens
On occasion responses from the Google Documents List API exceed the deadline for App Engine HTTP requests. This can be the case with extremely large corpuses of documents being returned in the API.
To workaround this, set the max-results parameter to a smaller number than 1000.
Also, retry the request using exponential back-off.
To work around failing uploads, use the Task Queue in App Engine to complete uploads, as well as resumable upload with the API.
You can request the App Engine team increase the size of the HTTP timeout of your application to a large number of seconds that would allow this request to succeed. However, it is rare that the team approves such a request without a strong need.

Resources