# Blueprints Explained

Basic Blueprint Structure

Blueprints consist of a few main structures, we'll take a closer look at some of them below:

  • inputAttachments - An array which holds the inputs information. Usually one per Workflow is used with the exception of Workflows which have input switching enabled:
  "inputAttachments": [
    {
      "inputId": "8487865",
      "inputAttachmentName": "EXInput_RTMP_push",
      "inputSettings": {
        "sourceEndBehavior": "CONTINUE",
        "inputFilter": "AUTO",
        "filterStrength": 1,
        "deblockFilter": "DISABLED",
        "denoiseFilter": "DISABLED",
        "audioSelectors": [],
        "captionSelectors": []
      }
    }
  ],
  • destinations - An array which holds the destination id and in our example a URL to which the encoder outputs HLS stream:
  "destinations": [
    {
      "id": "HLS_Akamai_Output",
      "settings": [
        {
          "url": "https://post.ioio-i.akamaihd.net/814841/testStream01_2/master"
        }
      ],
      "mediaPackageSettings": []
    }
  ],
  • encoderSettings - Structure which holds the audio and video settings:

    • audioDescriptions: This is an array which holds the audio settings for each output there is. Usually the settings for audio follow the source unless a specific audio requirements are given:
    "encoderSettings": {
      "audioDescriptions": [
        {
          "audioTypeControl": "FOLLOW_INPUT",
          "languageCodeControl": "FOLLOW_INPUT",
          "name": "audio_3obgf"
        }
      ],
    
    • outputGroups: This is where the settings are defined for the various outputs, the supported outputs are: HLS, Archive, Microsoft Smooth, UDP, RTMP, Frame Capture, MediaPackage and Multiplex:
        "outputGroups": [
        {
          "outputGroupSettings": {
            "hlsGroupSettings": {
              "adMarkers": [],
              "captionLanguageSetting": "OMIT",
              "captionLanguageMappings": [],
              "hlsCdnSettings": {
                "hlsAkamaiSettings": {
                  "numRetries": 10,
                  "connectionRetryInterval": 5,
                  "restartDelay": 5,
                  "filecacheDuration": 300,
                  "httpTransferMode": "CHUNKED"
                }
              },
              "inputLossAction": "EMIT_OUTPUT",
              "manifestCompression": "NONE",
              "destination": {
                "destinationRefId": "HLS_Akamai_Output"
              },
              "ivInManifest": "INCLUDE",
              "ivSource": "FOLLOWS_SEGMENT_NUMBER",
              "clientCache": "ENABLED",
              "tsFileMode": "SEGMENTED_FILES",
              "manifestDurationFormat": "INTEGER",
              "segmentationMode": "USE_SEGMENT_DURATION",
              "redundantManifest": "DISABLED",
              "outputSelection": "MANIFESTS_AND_SEGMENTS",
              "streamInfResolution": "INCLUDE",
              "iFrameOnlyPlaylists": "DISABLED",
              "indexNSegments": 10,
              "programDateTime": "EXCLUDE",
              "programDateTimePeriod": 600,
              "keepSegments": 21,
              "segmentLength": 6,
              "timedMetadataId3Frame": "PRIV",
              "timedMetadataId3Period": 10,
              "codecSpecification": "RFC_4281",
              "directoryStructure": "SINGLE_DIRECTORY",
              "segmentsPerSubdirectory": 10000,
              "mode": "LIVE"
            }
          },
    
    • outputs: Each output group has its own outputs which are nested in it. The outputs hold specific to the output settings, like in our example the outputs hold specific settings for HLS stream. The outputs group also references the videoDescriptionName and audioDescriptionName. This is where the output has its encoding settings defined:
            "outputs": [
          {
            "outputSettings": {
              "hlsOutputSettings": {
                "nameModifier": "_$w$x$h$_$rc$",
                "segmentModifier": "_$channel$",
                "hlsSettings": {
                  "standardHlsSettings": {
                    "m3u8Settings": {
                      "audioFramesPerPes": 4,
                      "audioPids": "492-498",
                      "pcrControl": "PCR_EVERY_PES_PACKET",
                      "pmtPid": "480",
                      "programNum": 1,
                      "scte35Pid": "500",
                      "scte35Behavior": "NO_PASSTHROUGH",
                      "timedMetadataPid": "502",
                      "timedMetadataBehavior": "NO_PASSTHROUGH",
                      "videoPid": "481"
                    },
                    "audioRenditionSets": "program_audio"
                  }
                }
              }
            },
            "outputName": "3i4u9_1080p",
            "videoDescriptionName": "video_qp562n",
            "audioDescriptionNames": [
              "audio_3obgf"
            ],
            "captionDescriptionNames": []
          }
        ]
    
    • videoDescriptions: This is an array of structures which define the video settings for each output. They are referenced in the outputs via the "videoDescriptionName":
        "videoDescriptions": [
        {
          "codecSettings": {
            "h264Settings": {
              "afdSignaling": "NONE",
              "colorMetadata": "INSERT",
              "adaptiveQuantization": "MEDIUM",
              "bitrate": 5000000,
              "entropyEncoding": "CABAC",
              "flickerAq": "ENABLED",
              "framerateControl": "INITIALIZE_FROM_SOURCE",
              "gopBReference": "DISABLED",
              "gopClosedCadence": 1,
              "gopNumBFrames": 2,
              "gopSize": 90,
              "gopSizeUnits": "FRAMES",
              "subgopLength": "FIXED",
              "scanType": "PROGRESSIVE",
              "level": "H264_LEVEL_AUTO",
              "lookAheadRateControl": "MEDIUM",
              "numRefFrames": 1,
              "parControl": "INITIALIZE_FROM_SOURCE",
              "profile": "MAIN",
              "rateControlMode": "CBR",
              "syntax": "DEFAULT",
              "sceneChangeDetect": "ENABLED",
              "spatialAq": "ENABLED",
              "temporalAq": "ENABLED",
              "timecodeInsertion": "DISABLED"
            }
          },
          "height": 1080,
          "name": "video_qp562n",
          "respondToAfd": "NONE",
          "sharpness": 50,
          "scalingBehavior": "DEFAULT",
          "width": 1920
        }
      ]
    

As we can see there are other fields as well but these are either service fields or are not being used at the moment.

Below is a complete blueprint which has an RTMP input and streams to HLS using the Akamai CDN:

{
  "name": "RTMP_push_output_HLS_to_akamai",
  "id": "218779",
  "arn": "arn:aws:medialive:eu-west-1:747067909250:channel:218779",
  "inputAttachments": [
    {
      "inputId": "8487865",
      "inputAttachmentName": "EXInput_RTMP_push",
      "inputSettings": {
        "sourceEndBehavior": "CONTINUE",
        "inputFilter": "AUTO",
        "filterStrength": 1,
        "deblockFilter": "DISABLED",
        "denoiseFilter": "DISABLED",
        "audioSelectors": [],
        "captionSelectors": []
      }
    }
  ],
  "state": "IDLE",
  "pipelinesRunningCount": 0,
  "destinations": [
    {
      "id": "HLS_Akamai_Output",
      "settings": [
        {
          "url": "https://post.ioio-i.akamaihd.net/814841/testStream01_2/master"
        }
      ],
      "mediaPackageSettings": []
    }
  ],
  "egressEndpoints": [
    {
      "sourceIp": "52.19.97.113"
    }
  ],
  "encoderSettings": {
    "audioDescriptions": [
      {
        "audioTypeControl": "FOLLOW_INPUT",
        "languageCodeControl": "FOLLOW_INPUT",
        "name": "audio_3obgf"
      }
    ],
    "captionDescriptions": [],
    "outputGroups": [
      {
        "outputGroupSettings": {
          "hlsGroupSettings": {
            "adMarkers": [],
            "captionLanguageSetting": "OMIT",
            "captionLanguageMappings": [],
            "hlsCdnSettings": {
              "hlsAkamaiSettings": {
                "numRetries": 10,
                "connectionRetryInterval": 5,
                "restartDelay": 5,
                "filecacheDuration": 300,
                "httpTransferMode": "CHUNKED"
              }
            },
            "inputLossAction": "EMIT_OUTPUT",
            "manifestCompression": "NONE",
            "destination": {
              "destinationRefId": "HLS_Akamai_Output"
            },
            "ivInManifest": "INCLUDE",
            "ivSource": "FOLLOWS_SEGMENT_NUMBER",
            "clientCache": "ENABLED",
            "tsFileMode": "SEGMENTED_FILES",
            "manifestDurationFormat": "INTEGER",
            "segmentationMode": "USE_SEGMENT_DURATION",
            "redundantManifest": "DISABLED",
            "outputSelection": "MANIFESTS_AND_SEGMENTS",
            "streamInfResolution": "INCLUDE",
            "iFrameOnlyPlaylists": "DISABLED",
            "indexNSegments": 10,
            "programDateTime": "EXCLUDE",
            "programDateTimePeriod": 600,
            "keepSegments": 21,
            "segmentLength": 6,
            "timedMetadataId3Frame": "PRIV",
            "timedMetadataId3Period": 10,
            "codecSpecification": "RFC_4281",
            "directoryStructure": "SINGLE_DIRECTORY",
            "segmentsPerSubdirectory": 10000,
            "mode": "LIVE"
          }
        },
        "outputs": [
          {
            "outputSettings": {
              "hlsOutputSettings": {
                "nameModifier": "_$w$x$h$_$rc$",
                "segmentModifier": "_$channel$",
                "hlsSettings": {
                  "standardHlsSettings": {
                    "m3u8Settings": {
                      "audioFramesPerPes": 4,
                      "audioPids": "492-498",
                      "pcrControl": "PCR_EVERY_PES_PACKET",
                      "pmtPid": "480",
                      "programNum": 1,
                      "scte35Pid": "500",
                      "scte35Behavior": "NO_PASSTHROUGH",
                      "timedMetadataPid": "502",
                      "timedMetadataBehavior": "NO_PASSTHROUGH",
                      "videoPid": "481"
                    },
                    "audioRenditionSets": "program_audio"
                  }
                }
              }
            },
            "outputName": "3i4u9_1080p",
            "videoDescriptionName": "video_qp562n",
            "audioDescriptionNames": [
              "audio_3obgf"
            ],
            "captionDescriptionNames": []
          }
        ]
      }
    ],
    "timecodeConfig": {
      "source": "EMBEDDED"
    },
    "videoDescriptions": [
      {
        "codecSettings": {
          "h264Settings": {
            "afdSignaling": "NONE",
            "colorMetadata": "INSERT",
            "adaptiveQuantization": "MEDIUM",
            "bitrate": 5000000,
            "entropyEncoding": "CABAC",
            "flickerAq": "ENABLED",
            "framerateControl": "INITIALIZE_FROM_SOURCE",
            "gopBReference": "DISABLED",
            "gopClosedCadence": 1,
            "gopNumBFrames": 2,
            "gopSize": 90,
            "gopSizeUnits": "FRAMES",
            "subgopLength": "FIXED",
            "scanType": "PROGRESSIVE",
            "level": "H264_LEVEL_AUTO",
            "lookAheadRateControl": "MEDIUM",
            "numRefFrames": 1,
            "parControl": "INITIALIZE_FROM_SOURCE",
            "profile": "MAIN",
            "rateControlMode": "CBR",
            "syntax": "DEFAULT",
            "sceneChangeDetect": "ENABLED",
            "spatialAq": "ENABLED",
            "temporalAq": "ENABLED",
            "timecodeInsertion": "DISABLED"
          }
        },
        "height": 1080,
        "name": "video_qp562n",
        "respondToAfd": "NONE",
        "sharpness": 50,
        "scalingBehavior": "DEFAULT",
        "width": 1920
      }
    ]
  },
  "inputSpecification": {
    "codec": "MPEG2",
    "resolution": "HD",
    "maximumBitrate": "MAX_10_MBPS"
  },
  "logLevel": "DISABLED",
  "tags": {},
  "channelClass": "SINGLE_PIPELINE"
}