File upload on AWS S3 Storage IOS in sequential order - amazon-web-services

I am working on chat application where I need to send media files (Image Audio Video, etc) to S3 storage using AWS IOS SDK v2.2.x.
I an sending all files for upload in a loop using AWSS3FileTransferManager by creating multiple upload requests. The uploads are working with callbacks coming from files in order of the one that finished first.
I am looking for an input as to how S3 can send me the finish callbacks in the same order as my upload request order.
Example:
Order I send
Image (10KB)
Video (2MB)
Image (10MB)
Video (50MB)
Audio (5MB)
Image (5KB)
Expected order received
Image (10KB)
Video (2MB)
Image (10MB)
Video (50MB)
Audio (5MB)
Image (5KB)
Observed order received
Image (5KB)
Image (10KB)
Video (2MB)
Audio (5MB)
Image (10MB)
Video (50MB)
Can there be some provision that even if the task hass finished its work for upload, the callback is received only after its previous task are completed and sent or else queued? And if the previous task has timed-out and failed then only the immediate next task is processed?

Related

how to stream microphone audio from browser to S3

I want to stream the microphone audio from the web browser to AWS S3.
Got it working
this.recorder = new window.MediaRecorder(...);
this.recorder.addEventListener('dataavailable', (e) => {
this.chunks.push(e.data);
});
and then when user clicks on stop upload the chunks new Blob(this.chunks, { type: 'audio/wav' }) as multiparts to AWS S3.
But the problem is if the recording is 2-3 hours longer then it might take exceptionally longer and user might close the browser before waiting for the recording to complete uploading.
Is there a way we can stream the web audio directly to S3 while it's going on?
Things I tried but can't get a working example:
Kineses video streams, looks like it's only for real time streaming between multiple clients and I have to write my own client which will then save it to S3.
Thought to use kinesis data firehose but couldn't find any client data producer from brower.
Even tried to find any resource using aws lex or aws ivs but I think they are just over engineering for my use case.
Any help will be appreciated.
You can set the timeslice parameter when calling start() on the MediaRecorder. The MediaRecorder will then emit chunks which roughly match the length of the timeslice parameter.
You could upload those chunks using S3's multipart upload feature as you already mentioned.
Please note that you need a library like extendable-media-recorder if you want to record a WAV file since no browser supports that out of the box.

Record real time Audio from browser and stream to Amazon S3 for storage

I want to record audio from my browser and live stream it for storage in Amazon S3. I cannot wait till the recording is finished as client can close the browser, so I would like to store what has been spoken (or nearest 5-10 second).
The issue is multipart upload does not support less than 5Mib chunks, and audio files will be for most part less than 5Mib.
Ideally I would like to send the chunks in 5 seconds, so what has been said in last 5 seconds to be uploaded.
Can it be support by S3? or should I use any other AWS service to first hold the recording parts - heard about kinesis stream but not sure if it can serve the purpose.

Amazon Transcribe Medical - Sample Rate Not Supported

I have a handfull of files with a sample rate of 8000hz and 11025hz.
Amazon's own documentation indicates that the valid MediaSampleRateHertz is between 8000 - 48000 (inclusive, judging by examples).
However running a media transcribe job (both via boto3 and directly on the service in the AWS console) returns failures with reasons:
The audio sample rate 8000 Hz is not supported. Change the audio
sample rate of your media file and try your request again.
The audio sample rate 11025 Hz is not supported. Change the audio sample rate of your media file and try your request again.
This happens when specifiying the sample rate AND leaving AWS to determine it (which it does correctly).
Where am I going wrong?

Echo Spot sometimes takes minutes to start playing a video

I'm currently developing a custom skill for the echo spot. I'm using AWS Lamda functions in .net core, using the Alexa.NET SDK. One of the intents lets Alexa play a video, which are hosted on a S3 bucket, but sometimes (randomly - once after opening the skill, once after the 4th or 5th video), Alexa immediately understands the command, but takes ages to play the video. According to the cloudwatch logs, the command is parsed and the lambda function executed within a couple of milliseconds, but the video starts playing very delayed (up to two minutes).
REPORT RequestId: xyz Duration: 366.44 ms Billed Duration: 400 ms Memory Size: 576 MB Max Memory Used: 79 MB
The videos being returned by the lambda function are rather short (5-15 seconds) if that could affect the issue. The wifi itself is stable with more than 30mbit available, alexa is not too far away from the wifi router.
We've tried different video encodings (MP4, H264, ...), different audio codecs, samplerates and framerates - the issue remains. Any clues what could cause this issue? We've read the recommendations for videos and applied all the recommended settings to the video.
Can i somehow access the device's logs to see if there's another issue with the video?
Turns out, videos are being streamed when combined with a plain text output speech. If your output speech is empty, the echo spot will download the whole video and start playing once the video is completely loaded. Hence, i recommend adding a speech reply to all of your videos to ensure a smooth loading of the video.

Face rekognition in streaming video returns just one frame for each second

I'm trying to run face recognition on live stream via amazon rekogntion and kinesis services. I've configured kinesis video stream for input video, stream processor for recognition and kinesis data stream to get results from the stream processor. All is working good, but I'm getting just one frame for each second in the stream.
I calculate frame timestamp accordignly:
https://docs.aws.amazon.com/rekognition/latest/dg/streaming-video-kinesis-output.html
by adding the ProducerTimestamp and FrameOffsetInSeconds field values together and get timestamps with defference 1 second.
For instance:
1528993313.0310001
1528993314.0310001
1528993314.0310001
I use demo app for video streaming from Java Producer SDK
https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-java.git
Total duration of data from stream processor is correct and equals the video file duration, but as I said I get just on frame for each second.
Answered my own question following some further research. As of today, Rekognition Streaming Video has restriction and analyses just one frame per second.