Skip to content

Commit

Permalink
Update to version v5.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
@tomnight committed Dec 18, 2020
1 parent f9b59fa commit 56e9b09
Show file tree
Hide file tree
Showing 22 changed files with 5,519 additions and 212 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [5.2.0] - 2020-12-10
### Added
- Support for S3 Signature Version4 for pre-signed URLs (https://github.com/awslabs/video-on-demand-on-aws/pull/111)
- New MediaConvert job templates with:
- Fewer HLS and DASH ABR renditions
- Updated encoder settings
- No presets
- Enabled point-in-time recovery backup for DynamoDB table

### Changed
- MediaInfo executable version (from v19.09 to v20.09) (https://github.com/awslabs/video-on-demand-on-aws/pull/116)
- CloudFront configuration improvements (https://github.com/awslabs/video-on-demand-on-aws/pull/96, https://github.com/awslabs/video-on-demand-on-aws/pull/99)
- MediaConvert presets are no longer being created
- All new MediaConvert job templates gets created regardless of whether MediaPackage is enabled or not

### Fixed
- Settings are no longer overwritten when using custom templates (https://github.com/awslabs/video-on-demand-on-aws/pull/107)
- Solution now deploys even in regions with no MediaPackage support


## [5.1.0] - 2020-04-30
### Added
Expand Down
37 changes: 29 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,12 @@ AWS MediaConvert Quality-defined Variable Bit-Rate (QVBR) control mode gets the

| Resolution | MaxBitrate | QvbrQualityLevel |
|----------|:-------------:|------:|
| 2160p | 20000kbps | 8 |
| 2160p | 15000Kbps | 9 |
| 1080p | 8500Kbps | 8 |
| 720p | 6500Kbps | 8 |
| 720p | 6000Kbps | 8 |
| 720p | 5000Kbps | 8 |
| 720p | 3500Kbps | 7 |
| 540p | 6500Kbps | 7 |
| 540p | 3500Kbps | 7 |
| 360p | 1200Kbps | 7 |
| 360p | 600Kbps | 7 |
| 360p | 1500Kbps | 7 |
| 270p | 400Kbps | 7 |

For more detail please see [QVBR and MediaConvert](https://docs.aws.amazon.com/mediaconvert/latest/ug/cbr-vbr-qvbr.html).
Expand Down Expand Up @@ -173,7 +170,31 @@ The CloudFormation template is configured to pull the Lambda deployment packages
aws s3 mb s3://my-bucket-us-east-1
```

### 3. Create the deployment packages
### 3. Build MediaInfo
Build MediaInfo using the following commands on an [EC2 instance](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html) running an Amazon Linux AMI.

```console
sudo yum update -y
sudo yum groupinstall 'Development Tools' -y
sudo yum install libcurl-devel -y
wget https://mediaarea.net/download/binary/mediainfo/20.09/MediaInfo_CLI_20.09_GNU_FromSource.tar.xz
tar xvf MediaInfo_CLI_20.09_GNU_FromSource.tar.xz
cd MediaInfo_CLI_GNU_FromSource/
./CLI_Compile.sh --with-libcurl
```

Run these commands to confirm the compilation was successful:
```console
cd MediaInfo/Project/GNU/CLI/
./mediainfo --version
```
Copy the mediainfo binary into the `source/mediainfo/bin` directory of your cloned respository.

If you'd like to use a precompiled MediaInfo binary for Lambda built by the MediaArea team, you can download it [here](https://mediaarea.net/en/MediaInfo/Download/Lambda).
For more information, check out the [MediaInfo site](https://mediaarea.net/en/MediaInfo).


### 4. Create the deployment packages
Build the distributable:
```
chmod +x ./build-s3-dist.sh
Expand All @@ -187,7 +208,7 @@ Deploy the distributable to the Amazon S3 bucket in your account:
aws s3 cp ./regional-s3-assets/ s3://my-bucket-us-east-1/video-on-demand-on-aws/version/ --recursive --acl bucket-owner-full-control
```

### 4. Launch the CloudFormation template.
### 5. Launch the CloudFormation template.
* Get the link of the video-on-demand-on-aws.template uploaded to your Amazon S3 bucket.
* Deploy the Video on Demand to your account by launching a new AWS CloudFormation stack using the link of the video-on-demand-on-aws.template.

Expand Down
16 changes: 13 additions & 3 deletions deployment/build-s3-dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,21 @@ sed -i -e $replace $template_dir/../README.md

cp $template_dist_dir/video-on-demand-on-aws.template $build_dist_dir/

echo "------------------------------------------------------------------------------"
echo "Download mediainfo binary for AWS Lambda"
echo "------------------------------------------------------------------------------"
cd $source_dir/mediainfo/
rm -rf bin/*
curl -O https://mediaarea.net/download/binary/mediainfo/20.09/MediaInfo_CLI_20.09_Lambda.zip
unzip MediaInfo_CLI_20.09_Lambda.zip
mv LICENSE bin/
chmod +x ./bin/mediainfo
rm -r MediaInfo_CLI_20.09_Lambda.zip

cd $source_dir/
echo "------------------------------------------------------------------------------"
echo "Lambda Functions"
echo "------------------------------------------------------------------------------"
cd $source_dir
chmod +x ./mediainfo/bin/mediainfo

for folder in */ ; do
cd "$folder"
Expand All @@ -81,7 +91,7 @@ for folder in */ ; do
elif [ -e "setup.py" ]; then
# If you're running this command on macOS and Python3 has been installed using Homebrew, you might see this issue:
# DistutilsOptionError: must supply either home or prefix/exec-prefix
# Please follow the workaround suggested on this StackOverflow answer: https://stackoverflow.com/a/44728772
# Please follow the workaround suggested on this StackOverflow answer: https://stackoverflow.com/a/4472877
python3 setup.py build_pkg --zip-path=$zip_path
fi

Expand Down
35 changes: 27 additions & 8 deletions deployment/video-on-demand-on-aws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ Resources:
rules_to_suppress:
- id: W11
reason: "* is required to create CloudWatch logs and interact with MediaConvert / MediaPackage actions that do not support resource level permissions"
- id: W76
reason: "All policies are required by the custom resource."

StepFunctionsServiceRole:
Type: AWS::IAM::Role
Expand Down Expand Up @@ -359,9 +361,13 @@ Resources:
Id: !Sub "${AWS::StackName}-EncodeError"

DynamoDBTable:
DeletionPolicy: Retain
UpdateReplacePolicy: Retain
Type: AWS::DynamoDB::Table
Properties:
BillingMode: PAY_PER_REQUEST
PointInTimeRecoverySpecification:
PointInTimeRecoveryEnabled: true
AttributeDefinitions:
- AttributeName: guid
AttributeType: S
Expand Down Expand Up @@ -530,7 +536,11 @@ Resources:
AllowedMethods:
- GET
- HEAD
- OPTIONS
Compress: true
MaxTTL: 0
MinTTL: 0
ViewerProtocolPolicy: "redirect-to-https"
DefaultTTL: 0
TargetOriginId: vodS3Origin
ForwardedValues:
QueryString: false
Expand All @@ -540,7 +550,6 @@ Resources:
- Origin
- Access-Control-Request-Method
- Access-Control-Request-Headers
ViewerProtocolPolicy: allow-all
PriceClass: PriceClass_100
ViewerCertificate:
CloudFrontDefaultCertificate: true
Expand Down Expand Up @@ -574,6 +583,7 @@ Resources:
StackName: !Ref AWS::StackName
EndPoint: !GetAtt MediaConvertEndPoint.EndpointUrl
EnableMediaPackage: !Ref EnableMediaPackage
EnableNewTemplates: true

MediaPackageVod:
Type: Custom::LoadLambda
Expand Down Expand Up @@ -726,18 +736,18 @@ Resources:
MediaConvert_Template_2160p:
!If
- IsMediaPackageEnabled
- !Sub "${AWS::StackName}_Ott_2160p_Avc_Aac_16x9_mvod"
- !Sub "${AWS::StackName}_Ott_2160p_Avc_Aac_16x9_qvbr"
- !Sub "${AWS::StackName}_Ott_2160p_Avc_Aac_16x9_mvod_no_preset"
- !Sub "${AWS::StackName}_Ott_2160p_Avc_Aac_16x9_qvbr_no_preset"
MediaConvert_Template_1080p:
!If
- IsMediaPackageEnabled
- !Sub "${AWS::StackName}_Ott_1080p_Avc_Aac_16x9_mvod"
- !Sub "${AWS::StackName}_Ott_1080p_Avc_Aac_16x9_qvbr"
- !Sub "${AWS::StackName}_Ott_1080p_Avc_Aac_16x9_mvod_no_preset"
- !Sub "${AWS::StackName}_Ott_1080p_Avc_Aac_16x9_qvbr_no_preset"
MediaConvert_Template_720p:
!If
- IsMediaPackageEnabled
- !Sub "${AWS::StackName}_Ott_720p_Avc_Aac_16x9_mvod"
- !Sub "${AWS::StackName}_Ott_720p_Avc_Aac_16x9_qvbr"
- !Sub "${AWS::StackName}_Ott_720p_Avc_Aac_16x9_mvod_no_preset"
- !Sub "${AWS::StackName}_Ott_720p_Avc_Aac_16x9_qvbr_no_preset"
CloudFront: !GetAtt CloudFront.DomainName
EnableMediaPackage: !Ref EnableMediaPackage
InputRotate: DEGREE_0
Expand Down Expand Up @@ -1128,6 +1138,9 @@ Resources:
- sqs:SendMessage
Resource:
- !GetAtt SqsQueue.Arn
Condition:
Bool:
'aws:SecureTransport': 'true'
-
Effect: Allow
Action:
Expand Down Expand Up @@ -1186,6 +1199,9 @@ Resources:
- sns:Publish
Resource:
- !Ref SnsTopic
Condition:
Bool:
'aws:SecureTransport': 'true'
- Effect: Allow
Action:
- logs:CreateLogGroup
Expand Down Expand Up @@ -1301,6 +1317,9 @@ Resources:
- sns:Publish
Resource:
- !Ref SnsTopic
Condition:
Bool:
'aws:SecureTransport': 'true'
- Effect: Allow
Action:
- dynamodb:UpdateItem
Expand Down
33 changes: 29 additions & 4 deletions source/custom-resource/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,16 @@ exports.handler = async (event, context) => {
break;

case 'MediaPackageVod':
responseData = await MediaPackage.create(config);
if (config.EnableMediaPackage === 'true') {
responseData = await MediaPackage.create(config);
}
else {
// response data with these attributes still needs to be returned even if we're not using MediaPackageVod
responseData = {
GroupId: null,
GroupDomainName: null
};
}
break;

default:
Expand All @@ -72,9 +81,17 @@ exports.handler = async (event, context) => {
break;

case 'MediaPackageVod':
responseData = await MediaPackage.update(config);
if (config.EnableMediaPackage === 'true') {
responseData = await MediaPackage.update(config);
}
else {
// response data with these attributes still needs to be returned even if we're not using MediaPackageVod
responseData = {
GroupId: null,
GroupDomainName: null
};
}
break;

default:
console.log(config.Resource, ': update not supported, sending success response');
}
Expand All @@ -86,7 +103,15 @@ exports.handler = async (event, context) => {
break;

case 'MediaPackageVod':
responseData = await MediaPackage.purge(config);
if (config.EnableMediaPackage === 'true') {
responseData = await MediaPackage.purge(config);
}
else {
// response data with these attributes still needs to be returned even if we're not using MediaPackageVod
responseData = {
GroupId: null
};
}
break;

default:
Expand Down
2 changes: 1 addition & 1 deletion source/custom-resource/lib/cfn/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const _responseData = {
test: 'testing'
};

describe('#CFN RESONSE::', () => {
describe('#CFN RESPONSE::', () => {
it('should return "200" on a send cfn response sucess', async () => {
const mock = new MockAdapter(axios);
mock.onPut().reply(200, {});
Expand Down
Loading

0 comments on commit 56e9b09

Please sign in to comment.