

# Monitoring with content quality analysis in AWS Elemental MediaConnect
<a name="monitor-content-quality-analysis"></a>

You can use MediaConnect content quality analysis to monitor your source streams more effectively. This feature enables you to track specific audio and video metrics, helping you ensure that your content meets required quality standards. By monitoring these metrics, you can quickly identify anomalies in your streams, enabling you to promptly resolve issues and maintain content quality. 

When used alongside other MediaConnect monitoring tools, content quality analysis provides you with a comprehensive view of your stream's quality. This integrated monitoring approach enables you to implement proactive measures and ensure a smooth and reliable media delivery workflow. 

**Contents**
+ [Key points](#monitor-content-quality-analysis-key-points)
  + [How content quality analysis works](#how-content-quality-analysis-works)
  + [Considerations](#content-quality-analysis-considerations)
+ [Next steps](#content-quality-analysis-next-steps)

## Key points
<a name="monitor-content-quality-analysis-key-points"></a>

### How content quality analysis works
<a name="how-content-quality-analysis-works"></a>

You can monitor for the following content quality issues:
+ **Silent audio periods -** Use this metric to detect periods of audio silence in the stream. This is useful for catching muted microphones in live broadcasts, unintended silence in recordings, or audio encoding issues. 
+ **Black frames -** Use this metric to detect periods of black video frames in the stream. This is helpful for identifying issues in live broadcasts, pre-recorded content, or your video encoding process. 
+ **Frozen frames -** Use this metric to detect periods of unchanging video frames in the stream. This is valuable for live events, identifying equipment issues, or detecting problems in your content delivery.

For each metric, you can set custom duration thresholds to fine-tune when alerts are triggered based on your specific needs. MediaConnect then monitors the status of the content within your source stream, posting warnings and alerts when issues occur in the areas you've chosen to monitor.

### Considerations
<a name="content-quality-analysis-considerations"></a>
+ Content quality analysis works with transport stream source flows only. CDI flows and bridge flows aren't currently supported. 
+ The content quality analysis feature only monitors the first video stream and the first audio stream it encounters within a single source.
+ Content quality analysis monitoring is limited to flows with 10 outputs or fewer. If a flow exceeds 10 outputs, MediaConnect automatically disables content analysis for that flow.
+ This feature is available at no additional charge in all AWS Regions where MediaConnect is available.

## Next steps
<a name="content-quality-analysis-next-steps"></a>

To get started with this feature, see [Enabling content quality analysis and configuring thresholds](enable-content-quality-analysis.md).

# Enabling content quality analysis and configuring thresholds
<a name="enable-content-quality-analysis"></a>

You enable content quality analysis for each flow in MediaConnect individually. You can do this when you create a new flow, or when you update an existing one. For each flow, you can customize the monitoring experience by configuring thresholds for individual metrics or disabling specific metrics as needed. 

This page guides you through the process of enabling content quality analysis and configuring its metrics. 

## Prerequisites
<a name="enable-content-quality-analysis-prerequisites"></a>

If you want to enable content quality analysis for an existing flow, ensure that the flow state is `STANDBY`, `UPDATING`, or `ACTIVE` before you start.

## Procedure
<a name="enable-content-quality-analysis-procedure"></a>

You can enable content quality analysis through the AWS Management Console, the AWS CLI, and the MediaConnect API.

### Enabling content quality analysis when you create a flow
<a name="enable-content-quality-analysis-procedure-new-flow"></a>

------
#### [ Console ]

**To enable content quality analysis when you create a flow**  
Follow the instructions for [Creating a flow](flows-create.md). In the **Source monitoring configuration** step, make sure to turn on **Content quality analysis state. ** 

When you enable content quality analysis, you can specify a threshold for the following metrics. For each metric, you can populate a value between 10 and 60 seconds. The default threshold is 30 seconds.


****  
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/mediaconnect/latest/ug/enable-content-quality-analysis.html)

------
#### [ AWS CLI ]

**To enable content quality analysis with default settings**  
Run the [create-flow](https://docs.aws.amazon.com/cli/latest/reference/mediaconnect/create-flow.html) command as shown in the following example:

```
aws mediaconnect create-flow
  --flow-name "myFlow" \
  --source-arn "sourceFlowARN" \
  --source-monitoring-config ContentQualityAnalysisState=ENABLED \
  --other-required-parameters
```

MediaConnect automatically enables all individual metrics with a default value of 30 seconds, as shown below:

```
{
   "Flow": {
              "FlowArn": <arn>,
              ...
              "SourceMonitoringConfig": {
                "ContentQualityAnalysisState": "ENABLED",
                "AudioMonitoringSettings": [
                    {
                        "SilentAudio": {
                            "State": "ENABLED",
                            "ThresholdSeconds": 30
                        }
                    }
                ],
                "VideoMonitoringSettings": [
                    {
                        "BlackFrames": {
                            "State": "ENABLED",
                            "ThresholdSeconds": 30
                        },
                        "FrozenFrames": {
                            "State": "ENABLED",
                            "ThresholdSeconds": 30
                        }
                    }
                ]
            }
           }
}
```

**To enable content quality analysis with custom thresholds**  
Run the [create-flow](https://docs.aws.amazon.com/cli/latest/reference/mediaconnect/create-flow.html) command with the `--source-monitoring-config` parameter configured as shown below. 

The following example command enables all three metrics with custom thresholds:

```
aws mediaconnect create-flow
  --flow-name "myFlow" \
  --source-arn "sourceFlowARN" \
  --source-monitoring-config '{"ContentQualityAnalysisState": "ENABLED", \
   "VideoMonitoringSettings": [{ \
   "FrozenFrames": {"State": "ENABLED", "ThresholdSeconds": <int>}, \
   "BlackFrames": {"State": "ENABLED", "ThresholdSeconds": <int>}}], \
   "AudioMonitoringSettings": [{ \
   "SilentAudio": {"State": "ENABLED", "ThresholdSeconds": <int>}}]}'
```

Keep in mind the following:
+ For each threshold, replace *<int>* with a value between 10 and 60 seconds.
+ If you don't specify a threshold, the default value of 30 seconds is used.
+ You can enable one or more of the following metrics.
  + If you enable video monitoring, you must enable at least one of the `BlackFrames` or `FrozenFrames` metrics.
  + If you enable audio monitoring, you must enable the `SilentAudio` metric.


****  
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/mediaconnect/latest/ug/enable-content-quality-analysis.html)

------

### Enabling content quality analysis in an existing flow
<a name="enable-content-quality-analysis-procedure-existing-flow"></a>

------
#### [ Console ]

**To enable content quality analysis in an existing flow**  
Follow the instructions for [Updating a flow](flows-update.md). In the **Source monitoring configuration** step, make sure to turn on **Content quality analysis state. ** 

When you enable content quality analysis, you can specify a threshold for the following metrics. For each metric, you can populate a value between 10 and 60 seconds. The default threshold is 30 seconds.


****  
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/mediaconnect/latest/ug/enable-content-quality-analysis.html)

------
#### [ AWS CLI ]

**To enable content quality analysis with default settings**  
Run the [update-flow](https://docs.aws.amazon.com/cli/latest/reference/mediaconnect/update-flow.html) command as shown in the following example:

```
aws mediaconnect update-flow
  --flow-arn "FlowArn" \
  --source-monitoring-config ContentQualityAnalysisState=ENABLED
```

MediaConnect automatically enables all individual metrics with a default value of 30 seconds, as shown below:

```
{
   "Flow": {
              "FlowArn": <arn>,
              ...
              "SourceMonitoringConfig": {
                "ContentQualityAnalysisState": "ENABLED",
                "AudioMonitoringSettings": [
                    {
                        "SilentAudio": {
                            "State": "ENABLED",
                            "ThresholdSeconds": 30
                        }
                    }
                ],
                "VideoMonitoringSettings": [
                    {
                        "BlackFrames": {
                            "State": "ENABLED",
                            "ThresholdSeconds": 30
                        },
                        "FrozenFrames": {
                            "State": "ENABLED",
                            "ThresholdSeconds": 30
                        }
                    }
                ]
            }
           }
}
```

**To enable content quality analysis with custom thresholds**  
Run the [update-flow](https://docs.aws.amazon.com/cli/latest/reference/mediaconnect/update-flow.html) command with the `--source-monitoring-config` parameter configured as shown below. 

This example command enables all three metrics with custom thresholds. 

```
aws mediaconnect update-flow \
 --flow-arn "FlowArn" \
  --source-monitoring-config '{"ContentQualityAnalysisState": "ENABLED", \
   "VideoMonitoringSettings": [{ \
   "FrozenFrames": {"State": "ENABLED", "ThresholdSeconds": <int>}, \
   "BlackFrames": {"State": "ENABLED", "ThresholdSeconds": <int>}}], \
   "AudioMonitoringSettings": [{
   "SilentAudio": {"State": "ENABLED", "ThresholdSeconds": <int>}}]}' \
```

Keep in mind the following:
+ For each threshold, replace *<int>* with a value between 10 and 60 seconds.
+ If you're enabling a metric for the first time and you don't specify a threshold, the default value of 30 seconds is used.
+ If you're updating a previously enabled metric and you don't specify a threshold, the previously set value is retained.
+ You can enable one or more of the following metrics.
  + If you enable video monitoring, you must enable at least one of the `BlackFrames` or `FrozenFrames` metrics.
  + If you enable audio monitoring, you must enable the `SilentAudio` metric.


****  
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/mediaconnect/latest/ug/enable-content-quality-analysis.html)

------

## Next steps
<a name="enable-content-quality-analysis-next-steps"></a>
+ After you enable content quality analysis for a flow, MediaConnect starts analyzing the source stream and reporting any detected issues. For instructions on how to review these issues, see [Viewing content quality analysis settings and alerts](content-quality-analysis-viewing.md).
+ If you no longer want to analyze content quality for your flow, you can disable the feature. For instructions, see [Disabling content quality analysis](disable-content-quality-analysis.md).

## Additional resources
<a name="enable-content-quality-analysis-additional-resources"></a>
+ [Creating a flow](flows-create.md)
+ [Updating a flow](flows-update.md)
+ [Monitoring and tagging in AWS Elemental MediaConnect](monitor.md)

# Viewing content quality analysis settings and alerts
<a name="content-quality-analysis-viewing"></a>

When you enable content quality analysis, MediaConnect starts posting warnings and alerts for the enabled metrics in your AWS account. 

This page guides you through the process of confirming your content quality analysis settings, and viewing any warnings and alerts for the flows in your account. 

## Prerequisites
<a name="content-quality-analysis-viewing-prerequisites"></a>

The following procedure assumes that you have already enabled content quality analysis for a flow.

## Procedure
<a name="content-quality-analysis-viewing-procedure"></a>

You can view content quality warnings and alerts through the AWS Management Console, the AWS CLI, and the MediaConnect API.

------
#### [ Console ]

**To check if content quality analysis is enabled**

1. Open the MediaConnect console at [https://console.aws.amazon.com/mediaconnect/](https://console.aws.amazon.com/mediaconnect/).

1. From the **Flows** screen, select the flow you want to inspect.

1. On the flow details page, choose the **Configuration** tab.

1. Under **Source monitoring configuration**, you can find the content quality analysis state.

![\[A MediaConnect flow with content quality analysis enabled.\]](http://docs.aws.amazon.com/mediaconnect/latest/ug/images/content-quality-analysis-enabled.png)


**To check if quality alerts are present**

1. Open the MediaConnect console at [https://console.aws.amazon.com/mediaconnect/](https://console.aws.amazon.com/mediaconnect/).

1. From the **Flows** screen, select the flow you want to inspect.

1. On the **Alerts** tab, alerts appear when content quality problems are detected in the flow source.

![\[A content quality alert shown on a MediaConnect flow details page.\]](http://docs.aws.amazon.com/mediaconnect/latest/ug/images/content-quality-analysis-alert.png)


------
#### [ AWS CLI ]

To confirm if quality analysis metrics are enabled for a given flow, run the [describe-flow](https://docs.aws.amazon.com/cli/latest/reference/mediaconnect/describe-flow.html) command:

```
aws mediaconnect describe-flow --flow-arn flowARN
```

The response shows which content quality analysis metrics are enabled:

```
{
    "Flow": {
        "FlowArn": "flowARN",
        ...
        "SourceMonitoringConfig": {
            "ContentQualityAnalysisState": "ENABLED",
            "AudioMonitoringSettings": [
                {
                    "SilentAudio": {
                        "State": "DISABLED",
                        "ThresholdSeconds": 15
                    }
                }
            ],
            "VideoMonitoringSettings": [
                {
                    "BlackFrames": {
                        "State": "DISABLED",
                        "ThresholdSeconds": 10
                    },
                    "FrozenFrames": {
                        "State": "ENABLED",
                        "ThresholdSeconds": 5
                    }
                }
            ]
        },
        ...
    }
}
```

The response also shows messages about any warnings or alerts that need your attention:

```
{
    ...
    "Messages": {
        "Errors": [
            "Monitoring Stream Alert: Audio Stream Missing. Please investigate the flow source.",
            "Monitoring Stream Alert: Video Stream Missing. Please investigate the flow source."
        ]
    }
}
```

Alternatively, if both audio and video streams are present but experiencing issues, you might see something like this:

```
{
    ...
    "Messages": {
        "Errors": [
            "Monitoring Stream Alert: Black frames detected for more than 30 seconds. Please investigate the flow source.",
            "Monitoring Stream Alert: Frozen frames detected for more than 30 seconds. Please investigate the flow source.",
            "Monitoring Stream Alert: Silent audio detected for more than 30 seconds. Please investigate the flow source."
        ]
}
```

**Note**  
These error messages are context-dependent. If an audio or video stream is missing, related quality alerts for that stream (such as silent audio or black/frozen frames) won't be triggered.

------

## Next steps
<a name="content-quality-analysis-viewing-next-steps"></a>

If you no longer want to analyze content quality for your flow, you can disable the feature. For instructions, see [Disabling content quality analysis](disable-content-quality-analysis.md).

# Disabling content quality analysis
<a name="disable-content-quality-analysis"></a>

You can disable the content quality analysis feature without losing your previously configured settings for individual metrics. If you re-enable content quality analysis in the future, your custom thresholds for individual metrics are preserved so that you don’t have to reconfigure them. 

This page guides you through the process of disabling the content quality analysis feature.

## Prerequisites
<a name="disable-content-quality-analysis-prerequisites"></a>

The following procedure assumes that you have already enabled content quality analysis for a flow. You can disable content quality analysis on an active or inactive flow. If the flow is active, you don't have to stop it first.

## Procedure
<a name="disable-content-quality-analysis-procedure"></a>

You can disable content quality analysis through the AWS Management Console, the AWS CLI, and the MediaConnect API.

------
#### [ Console ]

**To disable content quality analysis**

1. Open the MediaConnect console at [https://console.aws.amazon.com/mediaconnect/](https://console.aws.amazon.com/mediaconnect/).

1. From the **Flows** screen, select the flow for which you want to disable content quality analysis.

1. On the flow details page, choose the **Sources** tab.

1. In the **Source monitoring configuration **section, choose **Edit**.

1. Choose one of the following options:

   1. To disable all metrics, turn off **Content quality analysis state**.

   1. To disable specific metrics, turn off one or more of the following metrics:  
****    
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/mediaconnect/latest/ug/disable-content-quality-analysis.html)

1. Choose **Update **to save your changes.

------
#### [ AWS CLI ]

**To disable all metrics**  
Run the [update-flow](https://docs.aws.amazon.com/cli/latest/reference/mediaconnect/update-flow.html) command as shown in the following example:

```
aws mediaconnect update-flow \
--flow-arn "flowARN" \
--source-monitoring-config ContentQualityAnalysisState=DISABLED
```

In the following example response, `ContentQualityAnalysisState` is now disabled, but individual metric settings remain unchanged:

```
{
   "Flow": {
              "FlowArn": "<arn>",
              ...
              "SourceMonitoringConfig": {
                "ContentQualityAnalysisState": "DISABLED",
                "ThumbnailState": "ENABLED",
                "AudioMonitoringSettings": [
                    {
                        "SilentAudio": {
                            "State": "ENABLED",
                            "ThresholdSeconds": 30
                        }
                    }
                ],
                "VideoMonitoringSettings": [
                    {
                        "BlackFrames": {
                            "State": "ENABLED",
                            "ThresholdSeconds": 30
                        },
                        "FrozenFrames": {
                            "State": "ENABLED",
                            "ThresholdSeconds": 10
                        }
                    }
                ]
            }
         }
}
```

**Note**  
When `ContentQualityAnalysisState` is set to `DISABLED`, it takes precedence over the individual metric settings. This means that even though individual metrics (`SilentAudio`, `BlackFrames`, `FrozenFrames`) show as `ENABLED`, they are not active. This enables you to maintain your preferred configuration for individual metrics without having to reconfigure them each time you toggle the overall `ContentQualityAnalysisState`.  
When you want to re-enable content quality analysis, set `ContentQualityAnalysisState` back to `ENABLED`. Your previously configured individual metric settings will then become active again.

**To disable specific metrics**  
Run the [update-flow](https://docs.aws.amazon.com/cli/latest/reference/mediaconnect/update-flow.html) command with the `--source-monitoring-config parameter` configured as shown below. 

The following example command disables the two video monitoring metrics while preserving the custom thresholds for future use: 

```
aws mediaconnect update-flow \
 --flow-arn "FlowArn" \
 --source-monitoring-config ContentQualityAnalysisState=ENABLED \
 '{"VideoMonitoringSettings": [ \
 {"FrozenFrames": {"State": "DISABLED", "ThresholdSeconds": 10}}, \
 {"BlackFrames": {"State": "DISABLED", "ThresholdSeconds": 15}}], \
 "AudioMonitoringSettings": [ \
 {"SilentAudio": {"State": "ENABLED", "ThresholdSeconds": 25}}]}'
```

In the following example response, `ContentQualityAnalysisState` remains enabled, but both of the video monitoring metrics are now disabled:

```
{
   "Flow": {
              "FlowArn": <arn>,
              ...
              "SourceMonitoringConfig": {
                "ContentQualityAnalysisState": "ENABLED",
                "AudioMonitoringSettings": [
                    {
                        "SilentAudio": {
                            "State": "ENABLED",
                            "ThresholdSeconds": 25
                        }
                    }
                ],
                "VideoMonitoringSettings": [
                    {
                        "BlackFrames": {
                            "State": "DISABLED",
                            "ThresholdSeconds": 15
                        },
                        "FrozenFrames": {
                            "State": "DISABLED",
                            "ThresholdSeconds": 10
                        }
                    }
                ]
            }
         }
}
```

Keep in mind the following:
+ You don’t have to change or remove the existing thresholds for individual metrics. If you re-enable content quality analysis in the future, your custom thresholds are preserved so that you don’t have to reconfigure them. 
+ You can disable one, two, or all three of the following metrics: 


****  
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/mediaconnect/latest/ug/disable-content-quality-analysis.html)

------

## Next steps
<a name="disable-content-quality-analysis-next-steps"></a>

You can re-enable the content quality analysis feature at any time. For instructions, see [Enabling content quality analysis in an existing flow](enable-content-quality-analysis.md#enable-content-quality-analysis-procedure-existing-flow).