aws-samples / aws-media-services-vod-automation

Sample code and CloudFormation scripts for automating Video on Demand workflows on AWS
Apache License 2.0
136 stars 112 forks source link

Lambda Test Error when adjusting the jobs.json with new MediaConvert preset #36

Closed pickupboyd closed 3 years ago

pickupboyd commented 3 years ago

Hi All,

I am following the tutorial, but instead of using the original jobs.json (which works fine), I am trying to adjust this to a new preset. I have been experimenting with the json but continue to get errors.

Process I use the original jobs.json (attached) and I run a test in Lambda and it works fine (receive a 200). However, I create a new json with a new preset (attached as newjob.json) and I am receiving an error below.

My main question is if I create a job/preset in MediaConvert, what do I need to do to make it work for my Lambda function? I thought I just needed to adjust the "inputs" and "Outputs" groups properly. Thank you for your help. json.zip

[INFO]  2021-03-12T17:58:43.289Z    f283b7b4-c0af-4862-a4bf-bffa1e00abe2    jobInput: Default
[INFO]  2021-03-12T17:58:43.295Z    f283b7b4-c0af-4862-a4bf-bffa1e00abe2    {"Settings": {"OutputGroups": [{"Name": "File Group", "Outputs": [{"ContainerSettings": {"Container": "MP4", "Mp4Settings": {"CslgAtom": "INCLUDE", "CttsVersion": 0, "FreeSpaceBox": "EXCLUDE", "MoovPlacement": "PROGRESSIVE_DOWNLOAD", "AudioDuration": "DEFAULT_CODEC_DURATION"}}, "VideoDescription": {"Width": 640, "ScalingBehavior": "DEFAULT", "Height": 480, "TimecodeInsertion": "DISABLED", "AntiAlias": "ENABLED", "Sharpness": 50, "CodecSettings": {"Codec": "H_264", "H264Settings": {"InterlaceMode": "PROGRESSIVE", "ScanTypeConversionMode": "INTERLACED", "ParNumerator": 1, "NumberReferenceFrames": 3, "Syntax": "DEFAULT", "Softness": 0, "FramerateDenominator": 1001, "GopClosedCadence": 1, "GopSize": 90, "Slices": 1, "GopBReference": "DISABLED", "ParDenominator": 1, "EntropyEncoding": "CABAC", "Bitrate": 5000000, "FramerateControl": "SPECIFIED", "RateControlMode": "CBR", "CodecProfile": "MAIN", "Telecine": "NONE", "FramerateNumerator": 30000, "MinIInterval": 0, "AdaptiveQuantization": "AUTO", "CodecLevel": "AUTO", "FieldEncoding": "PAFF", "SceneChangeDetect": "ENABLED", "QualityTuningLevel": "SINGLE_PASS", "FramerateConversionAlgorithm": "DUPLICATE_DROP", "UnregisteredSeiTimecode": "DISABLED", "GopSizeUnits": "FRAMES", "ParControl": "SPECIFIED", "NumberBFramesBetweenReferenceFrames": 2, "RepeatPps": "DISABLED", "DynamicSubGop": "STATIC"}}, "AfdSignaling": "NONE", "DropFrameTimecode": "ENABLED", "RespondToAfd": "NONE", "ColorMetadata": "INSERT"}, "AudioDescriptions": [{"AudioTypeControl": "FOLLOW_INPUT", "CodecSettings": {"Codec": "AAC", "AacSettings": {"AudioDescriptionBroadcasterMix": "NORMAL", "Bitrate": 96000, "RateControlMode": "CBR", "CodecProfile": "LC", "CodingMode": "CODING_MODE_2_0", "RawFormat": "NONE", "SampleRate": 48000, "Specification": "MPEG4"}}, "LanguageCodeControl": "FOLLOW_INPUT"}], "NameModifier": "-converted-75"}], "OutputGroupSettings": {"Type": "FILE_GROUP_SETTINGS", "FileGroupSettings": {"Destination": "s3://encoding-completed.hecmedia.org/TestVideo/"}}}], "AdAvailOffset": 0, "Inputs": [{"AudioSelectors": {"Audio Selector 1": {"Offset": 0, "DefaultSelection": "DEFAULT", "ProgramSelection": 1}}, "VideoSelector": {"ColorSpace": "FOLLOW", "Rotate": "DEGREE_0", "AlphaBehavior": "DISCARD"}, "FilterEnable": "AUTO", "PsiControl": "USE_PSI", "FilterStrength": 0, "DeblockFilter": "DISABLED", "DenoiseFilter": "DISABLED", "InputScanType": "AUTO", "TimecodeSource": "ZEROBASED", "FileInput": "s3://encoding.hecmedia.org/inputs/TestVideo.mov"}]}, "AccelerationSettings": {"Mode": "DISABLED"}, "StatusUpdateInterval": "SECONDS_60", "Priority": 0}
[ERROR] 2021-03-12T17:58:43.736Z    f283b7b4-c0af-4862-a4bf-bffa1e00abe2    Exception: 'Inputs'
aburkleaux-amazon commented 3 years ago

There are 2 problems here:

  1. The format of the JSON in newjob.json should be the value of the "Settings" attribute from the MediaConvert full Job JSON. I removed the "Settings" key (see attachment) and the error you reported above is gone. newjob1.txt

    MediaConvert JSON:

    {
    "Settings": <value of "Settings">
    ...
    }

Input JSON for this workflow:

<value of "Settings">

  1. newjob.json is using attributes in Settings that are newer than the boto3 SDK that is included in Lambda deployment packages for this project. If you aren't using the deployment packages (i.e. just the tutorial) you won't hit this problem.
pickupboyd commented 3 years ago

Thank you so much. After going through your notes and the JSON, I see what you are talking about. Thank you for helping me understand the Settings issues that might be going on as well. It does seem to work.

Thank you so much.