Run AWS MediaConvert job over entire S3 bucket - H265

79 views Asked by At

I used the same title as another person from 2 years ago that links to this github project: https://github.com/aws-samples/aws-media-services-vod-automation/tree/master/MediaConvert-WorkflowWatchFolderAndNotification

It works but is using older media converting codecs, what I need help with his how to add in a newer media encoding for h265 or av1 encoding which is supported. I just can't seem to get the configuration correct.

Does anyone have a more up-todate version of something that will watch a folder and transocde it using more modern codecs? Or help me figure out how to change the conversion algorithm? Right now it creates 3 copies for apple and 1 for mp4. I just want 1 copy using either h265 or av1. Anyone who can help would be amazing or just even giving me bread crumbs.

1

There are 1 answers

0
aws-slm On

The 'WatchFolder' S3 bucket is used to store inputs and optional job settings for the conversion workflow. The NotificationConfiguration sets up the lambda trigger whenever an object is uploaded to the /inputs folder. MediaCOnvert job settings JSON files with your desired transcoding settings (e.g. codec, resolution etc) can be placed in the /jobs folder. The workflow will run a job for each settings file it finds there.

If no JSON file(s) are included in the /jobs folder, the workflow will use the the default job settings (i.e. job.json) in the lambda zip file.

This means that you can either update the Lambda function's job.json file to meet your requirements OR you can upload your own job.json file to the /jobs folder in S3.

Below is an example jobs.json file that creates one 720p HLS output using H.265. As there are many transcoding settings you can specify in the json, consider using the MediaConvert console to create an example job with your required settings. You can then open the job and choose to 'View JSON' and use that JSON output to create your job.json file.

{
    "OutputGroups": [
      {
        "CustomName": "HLS",
        "Name": "Apple HLS",
        "Outputs": [
          {
            "ContainerSettings": {
              "Container": "M3U8",
              "M3u8Settings": {
                "AudioFramesPerPes": 4,
                "PcrControl": "PCR_EVERY_PES_PACKET",
                "PmtPid": 480,
                "PrivateMetadataPid": 503,
                "ProgramNumber": 1,
                "PatInterval": 0,
                "PmtInterval": 0,
                "Scte35Source": "NONE",
                "Scte35Pid": 500,
                "TimedMetadata": "NONE",
                "TimedMetadataPid": 502,
                "VideoPid": 481,
                "AudioPids": [
                  482,
                  483,
                  484,
                  485,
                  486,
                  487,
                  488,
                  489,
                  490,
                  491,
                  492
                ]
              }
            },
            "VideoDescription": {
              "Width": 1280,
              "ScalingBehavior": "DEFAULT",
              "Height": 720,
              "TimecodeInsertion": "DISABLED",
              "AntiAlias": "ENABLED",
              "Sharpness": 50,
              "CodecSettings": {
                "Codec": "H_265",
                "H265Settings": {
                  "Bitrate": 3000000,
                  "RateControlMode": "CBR"
                }
              },
              "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"
              }
            ],
            "OutputSettings": {
              "HlsSettings": {
                "AudioGroupId": "program_audio",
                "AudioRenditionSets": "program_audio",
                "IFrameOnlyManifest": "EXCLUDE",
                "SegmentModifier": "$dt$"
              }
            },
            "NameModifier": "_720"
          }
        ],
        "OutputGroupSettings": {
          "Type": "HLS_GROUP_SETTINGS",
          "HlsGroupSettings": {
            "ManifestDurationFormat": "INTEGER",
            "SegmentLength": 10,
            "TimedMetadataId3Period": 10,
            "CaptionLanguageSetting": "OMIT",
            "Destination": "s3://<MEDIABUCKET>/Default/HLS/",
            "TimedMetadataId3Frame": "PRIV",
            "CodecSpecification": "RFC_4281",
            "OutputSelection": "MANIFESTS_AND_SEGMENTS",
            "ProgramDateTimePeriod": 600,
            "MinSegmentLength": 0,
            "DirectoryStructure": "SINGLE_DIRECTORY",
            "ProgramDateTime": "EXCLUDE",
            "SegmentControl": "SEGMENTED_FILES",
            "ManifestCompression": "NONE",
            "ClientCache": "ENABLED",
            "StreamInfResolution": "INCLUDE"
          }
        }
      }
    ],
    "AdAvailOffset": 0,
    "Inputs": [
      {
        "AudioSelectors": {
          "Audio Selector 1": {
            "Offset": 0,
            "DefaultSelection": "DEFAULT",
            "ProgramSelection": 1
          }
        },
        "VideoSelector": {
          "ColorSpace": "FOLLOW"
        },
        "FilterEnable": "AUTO",
        "PsiControl": "USE_PSI",
        "FilterStrength": 0,
        "DeblockFilter": "DISABLED",
        "DenoiseFilter": "DISABLED",
        "TimecodeSource": "EMBEDDED",
        "FileInput": "s3://rodeolabz-us-west-2/vodconsole/VANLIFE.m2ts"
      }
    ]
  }