

# Per-frame metric reports in AWS Elemental MediaConvert
<a name="per-frame-metrics"></a>

![\[Diagram showing per-frame metrics workflow in MediaConvert\]](http://docs.aws.amazon.com/mediaconvert/latest/ug/images/mediaconvert_per_frame_metrics_diagram.png)


Per-frame metric reports provide detailed video quality analysis for your MediaConvert outputs. With these reports, you can analyze your output video quality on a frame-by-frame basis by using industry-standard quality metrics.

Some use cases for per-frame metric reports might include:
+ Evaluate encoding decisions with objective quality measurements.
+ Compare different encoding settings across different outputs.
+ Identify specific frames or scenes that have low video quality.
+ Validate that your encoding settings meet quality thresholds.

MediaConvert supports the following per-frame metric types:

**PSNR (Peak Signal-to-Noise Ratio)**  
Measures the amount of noise (typically compression artifacts) after encoding. Higher values indicate better quality. Measured in decibels (dB).

**PSNR HVS (Peak Signal-to-Noise Ratio, Human Visual System)**  
A variation of PSNR that accounts for the characteristics of human visual perception. Higher values indicate better quality. Measured in decibels (dB).

**SSIM (Structural Similarity Index Measure)**  
Measures structural information like luminance, contrast, and structure. Values range from 0 to 1, with 1 indicating perfect similarity.

**MS SSIM (Multi-Scale Structural Similarity Index Measure)**  
An enhanced version of SSIM that evaluates image quality at multiple resolutions. Values range from 0 to 1, with 1 indicating perfect similarity.

**VMAF (Video Multi-Method Assessment Fusion)**  
A machine learning-based metric trained on human viewer data. VMAF can be a good indicator of viewer satisfaction for streaming video quality. Values range from 0 to 100, with higher values indicating better quality.

**QVBR (Quality-Defined Variable Bitrate)**  
Represents the QVBR quality level for an individual frame. Values range from 1 to 10. Higher values indicate better quality. This metric is only available when your output settings include the QVBR rate control mode.

**Topics**
+ [Generating per-frame metric reports](per-frame-metrics-enable.md)
+ [Metric analysis techniques](per-frame-metrics-analysis.md)
+ [Requirements and processing impact](per-frame-metrics-requirements.md)
+ [Troubleshooting](per-frame-metrics-troubleshooting.md)

# Generating per-frame metric reports
<a name="per-frame-metrics-enable"></a>

Configure per-frame metric reports at either the output group level or the individual output level.

## MediaConvert console
<a name="collapsible-section-1"></a>

To enable per-frame metrics for an output group by using the MediaConvert console:

1. Select an **Output group**.

1. In the **Output group settings** section, enable **Per-frame metrics**.

1. Under **Per-frame metrics**, select one or more metrics.

To enable per-frame metrics for an individual output by using the MediaConvert console:

1. Select an **Output group**.

1. Select an individual video output.

1. In the video output's **Encoding settings** section, expand **Per-frame metrics**.

1. Enable **Per-frame metrics**.

1. Under **Per-frame metrics**, select one or more metrics.

## API, SDK, or AWS Command Line Interface (AWS CLI)
<a name="collapsible-section-2"></a>

To **enable Per-frame metrics** by using the API, SDK, or AWS Command Line Interface (AWS CLI), include the `perFrameMetrics` array in your output group settings or individual output settings.

The following is an excerpt of a job settings JSON that specifies per-frame metrics at the output group level:

```
...
  "outputGroups": [
    {
      "outputGroupSettings": {
        "type": "FILE_GROUP_SETTINGS",
        "fileGroupSettings": {
          "destination": "s3://amzn-s3-demo-bucket/output/"
        },
        "perFrameMetrics": [
          "PSNR",
          "SSIM",
          "MS_SSIM",
          "PSNR_HVS",
          "VMAF",
          "QVBR"
        ]
      }
    }
  ]
...
```

## Output files
<a name="per-frame-metrics-output"></a>

When you generate per-frame metrics, MediaConvert writes CSV files to your Amazon S3 output destination. Filenames use the following pattern:

```
[outputname]_[metric].csv
```

For example:
+ `outputname_PSNR.csv`
+ `outputname_SSIM.csv`
+ `outputname_VMAF.csv`

Each CSV file contains frame-by-frame metrics with the following columns:

1. Frame number

1. Metric value

The files also include summary statistics at the end, showing the average, minimum, and maximum values across all frames. Import the data into spreadsheet applications or data analysis tools for further processing and visualization.

The following is an example PSNR per-frame metric:

```
Display_ID,Value
0,100.00
1,55.36
2,54.88
3,55.05
4,53.39
5,54.10
6,54.21
7,54.18
8,54.37
9,54.25
...
3591,40.71
3592,40.71
3593,40.58
3594,40.64
3595,40.53
3596,40.75
3597,40.64
3598,40.68
3599,40.65
3600,40.73
Average: 43.15
Min: 34.19
Max: 100.00
```

# Metric analysis techniques
<a name="per-frame-metrics-analysis"></a>

This section provides techniques for analyzing your per-frame metrics and applying best practices to optimize your encoding workflow.

When analyzing frame metrics, keep the following indicators in mind:
+ *Consistency* – Sudden changes in metrics might indicate scene transitions or encoding problems.
+ *Minimum values* – Frames with significantly lower quality scores might need attention.
+ *Correlation with content* – For a given bitrate, complex visual scenes typically have lower scores.
+ *Trends over time* – Changes in metrics over time might indicate issues with your encoding configuration.

For comprehensive analysis, we recommend that you generate and compare multiple metrics together. You might find frames with low PSNR scores that maintain acceptable VMAF scores and still deliver a good viewer experience. Additionally, perform a detailed visual review in a controlled environment.

To get the most from your per-frame metric reports, we recommend the following strategies:
+ Combine several metrics for a more complete quality picture.
+ Test metrics across different encoding parameters.
+ Pair metric data with visual checks in controlled viewing conditions.
+ Account for your content's unique attributes when reading the numbers.
+ Set quality benchmarks for your specific workflow requirements.
+ Start with small content samples to establish baseline expectations.
+ Record your findings to help with future encoding decisions.
+ If 95% of your content has a good score, viewers will generally have a good experience.

The following is a list of tips when for interpretting results for different per-frame metric types:

**PSNR**  
Excellent: 40dB or greater (high bitrate, visually lossless)  
Good: 30-40dB (typical streaming quality)  
Poor: 30dB or less (visible artifacts)  
Tip: High motion and detailed content generally need higher values for a good viewing experience.

**PSNR HVS**  
Good: 35dB or greater  
Acceptable: 30-35dB  
Poor: 30dB or less  
PSNR HVS scores are generally 2-3dB lower than regular PSNR scores.

**SSIM**  
Excellent: 0.95 or greater  
Great: 0.90-0.95  
Good: 0.80-0.90  
Poor: 0.80 or less  
Tip: SSIM is more reliable for static or slow content and less reliable for high motion content.

**MS SSIM**  
Similar scale to SSIM but more accurate  
Excellent: 0.98 or greater  
Good: 0.90-0.98  
Poor: 0.90 or less  
Tip: MS SSIM is better at catching motion issues than SSIM.

**VMAF**  
Excellent: 90 or greater (premium streaming)  
Good: 70-90 (typical streaming)  
Fair: 50-70  
Poor: 50 or less  
Most reliable for natural content  
Less reliable for animation/gaming  
Tip: VMAF scores typically drop 10-15 points when moving from 1080p to 4K at same bitrate

**QVBR**  
Excellent: 9 or greater  
Good: 7 to 8  
Fair: 5 to 7  
Poor: 5 or less

# Requirements and processing impact
<a name="per-frame-metrics-requirements"></a>

To use per-frame metric reports, your job settings must include the following:
+ Your output must use one of the following video codecs: H.264, H.265, AV1, MPEG-2, AVC-Intra, or XAVC 
+ Include one or more video outputs.
+ For the QVBR metric, your output must use the QVBR rate control mode.

Jobs that generate per-frame metrics take longer to complete than standard encoding jobs. The additional processing time depends on several factors, including:
+ The resolution of your output
+ The complexity of your video content
+ The number of metrics you select

For high-resolution outputs (such as 4K), jobs might take up to twice as long to complete compared to standard encoding.

Some metrics require more computational resources than others. For example, VMAF calculation is more computationally intensive than other metrics. Consider enabling only the metrics you need for your specific analysis.

# Troubleshooting
<a name="per-frame-metrics-troubleshooting"></a>

The following is a list of troubleshooting tips for issues that you might encounter while working with per-frame metric reports:

**Missing metric reports**  
Verify that you've enabled the metrics at either the output group level or individual output level.

**QVBR metrics not appearing**  
Confirm that your output settings include the QVBR rate control mode.

**Unexpected metric values**  
Check that your content is appropriate for the selected metrics and review the interpretation guidelines for each metric type.

**Job taking too long**  
Consider reducing the number of selected metrics or applying them to fewer outputs to reduce processing time.