Requirement: For deep learning predictions, I want to send the frame from my local system camera to EC2 instance for predictions.
Work done till now:
I am able test my deep learning code on my local system.
I have uploaded the code on EC2 instance.
I am able to send the live feed from my local camera to AWS Kinesis Video Stream.
Problem: I don't know how to send the AWS Kinesis video stream frames to EC2 instance for predictions. I searched everywhere, I know this is one of the use case of AWS Kinesis Video to send the frame to EC2 but I don't know how it will be possible.
If I understand correctly, you want the code in the EC2 to consume the frames being sent by your system camera. You can base your application off the parser library (https://github.com/aws/amazon-kinesis-video-streams-parser-library) and run it on the EC2 instance to capture the frames and perform deep learning predictions. Hope this gives an idea!
Per #divku suggestion, you can use GetMedia API and the parser library she referenced to read and parse out and "consume" the frames. You can cut GitHub issues against the assets in question to get more precise and timely responces.
Related
I want to upscale a live video on aws. The input stream will be a rtmp stream which i want to upscale using my own AI upscaling model and then the output will be distributed through the CDN.
I tried searching the internet regarding upscaling on aws but i couldn't find a way to do it using my own models. I already have a streaming pipeline set up where i stream my screen from my phone and the stream goes to aws elemental medialive to aws elemental mediapackage and then to CDN for distribution across the globe. I don't understand how to include the upscaling in the pipeline and where in the pipeline should upscaling be done at to save the transmission cost?
I already have a pipeline setup for streaming using aws medialive and aws mediapackage.
Thanks for your message.
The scaling operation will need a compute resource, probably EC2.
Your scaler could in theory be configured to accept either a continuous bitstream or a series of flat files (TS segments). The 'bitstream' option will require that you implement a streaming receiver/decoder, potentially based on the NGINX streaming proxy. The flat file option might be simpler as you could configure the scaler to either read those files from an S3 bucket. The resulting output can be delivered to MediaLive in either a continuous bitstream or as a series of flat files.
Regarding order of operations, placing the scaler before MediaLive makes the most sense as you want to deliver the optimized content to MediaLive for further encoding into ABR stack renditions, and leverage other features such as logo branding, input switching, output stabilization in the event of input loss, et cetera. Note: at present, UHD or "4k" is the largest input resolution supported by MediaLive.
I'm using the Agora SDK & RestAPI to recording life streams and upload them on AWS S3, the sdk comes with snapshoting feature that's Im planning to use for stream thumbnails.
Both Cloud Recording and Snapshot Recording are integrated with my app and works perfectly,
the Remaining problem is that the snapshots are named down to the microseconds
Agora snapshot services image file naming
From my overview, The services works as follow, Mobile App sends data to my Server, My server make requests to the Agora API so It joins the Life Stream channel and starts snapshoting and saving the images to AWS, so I suppose it's impossible to have time synchronization between AWS, AgoraRestAPI, my Server & my mobile app.
I've gone through their docs and I can't find anything about retrieving the file names.
I was thinking maybe I can have a Lambda Function that retrieves the last added file on a given bucket/folder? but due to my lack of knowledge on AWS and Lambda functions I don't know how's that or if it's possible.
any suggestions would be appreciated
I have a local program that inputs a video, uses a tensorflow model to do object classification, and then does a bunch of processing on the objects. I want to get this running in AWS, but there is a dizzying array of AWS services. My desired flow is:
video gets uploaded to s3 --> do classification and processing on each frame of said video --> store results in s3.
I've used Lambda for similar work, but this program relies on 2 different models and its overall size is ~800 MB.
My original thought is to run an ec2 instance that can be triggered when 3 receives a video. Is this the right approach?
You can consider creating a docker image containing your code, dependencies, and the model. Then, you can push it to ECR and create a task definition and fargate cluster. When the task definition is ready, you can set up a cloudwatch event, which will be triggered upon s3 upload, and as a target, you can select fargate resources that were created at the beginning.
There's a tutorial with a similar case available here: https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatch-Events-tutorial-ECS.html
I think you're on the right track. I would configure S3 to send new object notifications to an SQS queue. Then you can have your EC2 instance poll the queue for pending tasks. I would probably go with ECS + Fargate for this, but EC2 also works.
You can use Amazon Elemental to split the video file, and distribute the parts to different lambdas, so you can scale it, and process it in parallel.
What I need:
- load video from client
- cut this video on chunks by timepoints
- store thuis chunks
- provide access to this video chunks for web-users
Could you please give some advices how to properly build this process using AWS infrastructure?
You have a very broad question, so you cannot expect a very detailed answer. But lets start at least with basic puzzle pieces.
AWS may provide you infrastructure and services to support your case.
load video from client
Commonly the uploads are to be stored in an S3 bucket.
cut this video on chunks by timepoints
Once the video is uploaded, you may use the Elastic Transcoder service or any application on a virtual machine (AWS EC2, AWS Batch,..) to process the uploaded video files. You can use the Elastic Transcoder to generate clips (chunks)
store thuis chunks - provide access to this video chunks for web-users
The chunks can be stored in S3 again and you can make a web app to reference (give access) to the stored chunks
This is at least basic overview, but based on your question it may be a good start
I have to write code in react-native that allows a user to upload videos to amazon s3 to be transcoded for consumption by various devices. For the processing after the upload occurs; I am reviewing two approaches:
1) I can use Lambda with ffmpeg to handle the transcoding immediately after the uploading occurs (my fear here would be the amount of time required to transcode the videos and the effect on pricing if it takes a considerable amount of time).
2) I can have s3 pass an sns message to a rest api after the created event occurs and the rest api generate a rabbitmq message that will be processed by worker that will perform the transcoding using ffmpeg.
Option 1) seems to be the preferable option based on a completion time perspective. How concerned should I be with using 1) considering how long video transcoding might take as opposed to option 2)?
Also, regardless, I need a way to pass additional parameters to lambda or along the sns messaging that would allow me to somehow associate the user who uploaded the video with their account. Is there a way to pass additional text-based values to s3 to pass along to lambda or along sns when the upload completes, as a caveat I plan to upload the video directly to s3 using the rest layer(found this answer here: http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html#RESTObjectPUT-responses-examples)?
AWS provides a video transcoding service for exactly this type of thing. If you don't want to do that for some reason then you need to make sure you can complete your transcoding tasks in AWS Lambda in under 5 minutes. Not sure where the second option of using RabbitMQ and workers is coming from. Why RabbitMQ instead of SQS? Would workers be processes on EC2 servers instead of Lambda functions?
Regarding your other question, you need to pass those extra parameters as metadata fields on the S3 object. In the document you linked, look at how x-amz-meta- works. Then when you later retrieve the object from S3 to transcode it you can retrieve the metadata fields at the same time.