This demo is a variation of the main branch for media capture demo. This particular demo stitches audio files together in .mp4 format and meeting events together in .txt format. The source of these files is from the Amazon Chime SDK Media Capture bucket in S3.
- node V12+ installed
- npm installed
- yarn installed
- AWS CLI installed
- AWS CDK installed
npm install -g aws-cdk
- Be sure to have the latest version installed. If you need to upgrade, uninstall with
npm uninstall -g aws-cdk
and then reinstall.
- AWS CDK bootstrapped
cdk bootstrap
- Docker installed
- Deployment must be done in us-east-1
- S3 Bucket - Used for storage of the captured media as well as the processed media
- Meetings Table - DynamoDB used to store meeting and attendee information
- Create Lambda - Used to create the meeting and join users to the Chime SDK Meeting.
- Record Lambda - Used to start and stop the media capture pipeline.
- Process Lambda - Containerized image used after the recording has stopped to process the video from separate chunks into a single mp4 file.
- API Gateway - Used to trigger Lambdas from the client side browser
- EventBridge Rule - Rule used to trigger Process Lambda when Media Capture Pipeline is deleted.
- Clone this repo:
git clone https://github.com/aws-samples/amazon-chime-media-capture-pipeline-demo
cd amazon-chime-media-capture-pipeline-demo
./deploy.sh
- Accept prompts for CDK deployment
cd client
yarn
yarn start
nvm install 12
yum install jq
npm install -g aws-cdk
npm install -g yarn
./deploy.sh
cd client
yarn
yarn run start
This demo will assist you in seeing a Chime SDK Meeting media capture pipeline in action. It uses a simple React based client to create a meeting and then start a media capture pipeline of that meeting. This pipeline will take chunks of media in 5 second increments and store them in an S3 bucket. Once the recording has been stopped, a separate API call will trigger the Process Lambda and concatenate the separate files together into a single, playable media file.
This demo relies on ffmpeg for concatenating the files together. An Docker image is created that uses John Van Sickle's static build and is deployed as part of this deployment. For licensing information.
After successfully deploying the CDK components, navigate to the client directory cd client
and start the local server with yarn start
. This will allow you to start a Chime SDK Meeting at http://localhost:3000/
To start a meeting, enter a title in Meeting Title and click Submit. This client can be run in multiple tabs to have multiple participants joined to the same meeting if the same title is used. Click Start Video
to enable local video being sent and then Start Recording
to begin start the media capture pipeline. Once completed, press Stop Recording
and the process video lambda will be triggered to create
the concattenated media file.
Once the recording has stopped, an EventBridge pattern will match:
{
"detail-type": ["Chime Media Pipeline State Change"],
"source": ["aws.chime"],
"detail": {
"eventType": ["chime:MediaPipelineDeleted"]
}
}
This pattern will match a rule to trigger the processLambda.
The processLambda will list objects in the media capture S3 bucket matching the meetingId sent in the event trigger. If the account being used is configured to capture Active Speaker + Audio, the audio and video files will be stored in the audio/ prefix. These will be mp4 files with both audio and video. The processLambda will concatenate these files together into a single mp4 output file with both audio and video.
If the account being used is configured to capture all attendees and audio, audio files will be stored in the audio/ prefix and each attendee's video will be stored in the video/ prefix with the attendeeId used as part of the file name. The processLambda will concatenate the audio component from the audio/ prefix and each of the attendee components from the video/ prefix in to separate files. If there are two attendees in the meeting, a total of three files will be created:
- the composite audio file
- the video file of the first attendee
- the video file of the second attendee
To clean up this demo: cdk destroy
. The S3 bucket that is created will be emptied and destroyed as part of this destroy so if you wish to keep the media files, they should be moved.