AWS for M&E Blog

Monitor video content and encoding quality with Media Metrics in AWS Elemental MediaConvert

Introduction

When designing and operating video-on-demand workflows at scale, customers require rich metric data to gain insight into the performance of their transcoding pipelines. AWS Elemental MediaConvert is natively integrated with Amazon CloudWatch and Amazon EventBridge, providing customers with the necessary tools to create actionable and observable systems on Amazon Web Services (AWS).

MediaConvert now publishes Media Metrics, which extend MediaConvert’s observability portfolio, providing an enhanced experience for monitoring media-specific metrics in CloudWatch and EventBridge. By leveraging Media Metrics, customers can identify potential issues early on and make necessary adjustments to optimize video quality and delivery. In this blog post, I describe how CloudWatch Alarms and EventBridge rules can be used to create exception-based monitoring for factors such as transcoding warnings, black video content, missing captions, and encoding quality scores in MediaConvert.

AWS Elemental MediaConvert Events

AWS Elemental MediaConvert Events Diagram

MediaConvert users can use EventBridge events to access comprehensive information regarding job status, API calls, and errors. With the announcement of Media Metrics, MediaConvert Jobs will now begin emitting warning codes along with other video quality-specific information through EventBridge. The warnings serve as an indication that the transcode has come across a situation that could potentially have an unforeseen impact on the outputs of the job, without necessarily leading to a transcode failure. A few examples of warnings that you may encounter are audio and video synchronization issues, missing captions, and Amazon S3 throttling on the destination bucket. Customers can use these warnings in conjunction with the existing Job status change events to build extensive event-driven workflows and set up verbose notifications on potential quality-impacting alerts. Warning information is also available in the AWS Console and the job (GetJob, ListJobs) API response. For a comprehensive list of warning codes, visit this link.

In EventBridge, you can easily integrate MediaConvert events with other AWS services and third-party applications. Following, you can find a sample Event Pattern and an event payload that you can expect to receive for a NEW_WARNING event the first time a unique warning condition arises, as well as an event payload for a job COMPLETE event. Job COMPLETE and ERROR CloudWatch events will also contain a list of all unique warnings encountered, among a variety of new event data, such as:

  • Average bitrate of the output
  • Duration of the output in milliseconds
  • Resolution details of the output group
  • Start/stop timestamps of contiguous runs of black frames
  • Amount of video padding that was inserted
  • QVBR quality level statistics

With these samples, you can create EventBridge rules to match and filter incoming Warning Events and send them to Targets such as Amazon Simple Notification Service (Amazon SNS) for processing. By taking an event-driven approach, you can automate actions in a variety of ways, including:

  • Receive notifications for MediaConvert Job state changes and warnings
  • Automate remediation actions with other AWS services such as AWS Lambda
  • Hook into third-party solutions to create and extend actionable pipelines

For a step-by-step guide on how to configure EventBridge notifications with Amazon SNS for AWS Media Services, visit this link.

EventBridge Event Pattern

{
  "source": ["aws.mediaconvert"],
  "detail-type": ["MediaConvert Job State Change"],
  "detail": {
    "status": ["NEW_WARNING"]
  }
}                 

AWS Elemental MediaConvert NEW_WARNING Example Payload

{
    "version": "0",
    "id": "1234abcd-12ab-34cd-56ef-1234567890ab",
    "detail-type": "MediaConvert Job State Change",
    "source": "aws.mediaconvert",
    "account": "111122223333",
    "time": "2018-01-07T23:35:20Z",
    "region": "us-west-2",
    "resources": ["arn:aws:mediaconvert:us-west-2:111122223333:jobs/1515368087458-qnoxtd"],
    "detail": {
        "timestamp": 1515368120764,
        "accountId": "111122223333",
        "queue": "arn:aws:mediaconvert:us-west-2:111122223333:queues/Default",
        "jobId": "1515368087458-qnoxtd",
        "status": "NEW_WARNING",
        "warningCode": "000000",
        "warningMessage": "Example warning message",
        "userMetadata": {}
    }
}

AWS Elemental MediaConvert COMPLETE Example Payload

{
    "version": "0",
    "id": "1234abcd-12ab-34cd-56ef-1234567890ab",
    "detail-type": "MediaConvert Job State Change",
    "source": "aws.mediaconvert",
    "account": "111122223333",
    "time": "2022-12-19T19:07:12Z",
    "region": "us-west-2",
    "resources": [
        "arn:aws:mediaconvert:us-west-2::jobs/1671476818694-phptj0"
    ],
    "detail": {
        "timestamp": 1671476832124,
        "accountId": "111122223333",
        "queue": "arn:aws:mediaconvert:us-west-2:111122223333:queues/Default",
        "jobId": "1671476818694-phptj0",
        "status": "COMPLETE",
        "userMetadata": {},
        "warnings": [
            {
                "code": 000000,
                "count": 1
            }
        ],
        "outputGroupDetails": [
            {
                "outputDetails": [
                    {
                        "outputFilePaths": [
                            "s3://DOC-EXAMPLE-BUCKET/file/file.mp4"
                        ],
                        "durationInMs": 30041,
                        "videoDetails": {
                            "widthInPx": 1920,
                            "heightInPx": 1080,
                            "qvbrAvgQuality": 7.38,
                            "qvbrMinQuality": 7,
                            "qvbrMaxQuality": 8,
                            "qvbrMinQualityLocation": 2168,
                            "qvbrMaxQualityLocation": 25025
                        }
                    }
                ],
                "type": "FILE_GROUP"
            }
        ],
        "paddingInserted": 0,
        "blackVideoDetected": 10,
        "blackSegments": [
            {
                "start": 0,
                "end": 10
            }
        ]
    }
}

AWS Elemental MediaConvert Metrics

AWS Elemental MediaConvert emits CloudWatch metrics that can be used to monitor the performance of your transcoding workflows and video content. Here are a few ways you can use CloudWatch metrics to monitor your MediaConvert Queues, Jobs, and Outputs:

  • Monitor Programmatic Errors: Customers can track errors encountered when calling MediaConvert APIs including CreateJob, GetJob, ListJobs, etc.
  • Monitor Queue Efficiency: Use queue metrics to get details about the number of jobs in a given queue and the amount of time to complete the transcoding jobs
  • Monitor Encoding Performance: Media-specific metrics can help customers understand the video quality of their source content as well as their MediaConvert outputs

By using Media Metrics in MediaConvert, you can enhance the amount of information at your disposal regarding your source content and outputs. For example, you can monitor the number of black frames of your input assets as well as the bitrate and video quality scores of your transcoded content. Following is a list of media-specific CloudWatch Metrics newly introduced for MediaConvert. For a comprehensive list of MediaConvert metrics, visit this link.

Metric Name Description Metric Units Metric Dimensions
VideoPaddingInserted

The total duration of blank frames MediaConvert inserted across all outputs in your job, in milliseconds.

Video padding inserts blank frames to help keep audio and video durations aligned. Large VideoPaddingInserted values show that more blank frames were inserted. They also show to what extent your input audio tracks either start late, end early, or both.

Milliseconds Queue
VideoPaddingInsertedRatio

The ratio of blank frames MediaConvert inserted to the overall duration of your output.

Higher ratios may signal audio video sync issues in your input.

Ratio Queue
QVBRAvgQualityHighBitrate The average QVBR quality score of the highest bitrate output in the output group. Score Queue, Output Group Type
QVBRAvgQualityLowBitrate The average QVBR quality score of the lowest bitrate output in the output group. Score Queue, Output Group Type
QVBRMinQualityHighBitrate The minimum QVBR quality score of the highest bitrate output in the output group. Score Queue, Output Group Type
QVBRMinQualityLowBitrate The minimum QVBR quality score of the lowest bitrate output in the output group. Score Queue, Output Group Type
BlackVideoDetected

The total duration of black video frames in your output that are also present in your input in milliseconds.

Note that BlackVideoDetected does not include any black frames inserted by MediaConvert.

Milliseconds Queue
BlackVideoDetectedRatio

The ratio of black video frames to the total duration of your output.

Higher ratios show outputs with more black frames.

Ratio Queue
LongestBlackSegmentDetected The location in your output with the longest continuous segment of black video frames, in milliseconds. Milliseconds Queue
AvgBitrateTop The average bitrate of the highest bitrate output in the output group. Bits per second Queue, Output Group Type
AvgBitrateBottom The average bitrate of the lowest bitrate output in the output group. Bits per second Queue, Output Group Type

MediaConvert Diagram

For eyes-on-glass monitoring of your MediaConvert Jobs, CloudWatch Dashboards allow customers to surface CloudWatch Metrics in a unified location, providing a comprehensive view of transcoding job performance and video quality. For a more proactive approach, try using CloudWatch Alarms. Alarms enable customers to receive notifications and automate actions when certain metrics exceed a specified threshold. With MediaConvert Media Metrics, customers can now create alarms for thresholds around black video frames, padded video frames, bitrate statistics, and video quality scores of their transcode assets. Similar to EventBridge, users can execute a variety of actions on threshold breaches including using SNS to send notifications and calling other AWS services and third-party solutions. CloudWatch Alarms can reduce the monitoring overhead and increase visibility into your transcoding pipelines, allowing you to quickly and appropriately respond to potential issues. This blog post provides a step-by-step guide on how you can create dashboards and alarms for AWS Elemental MediaConvert using Amazon CloudWatch.

Conclusion

Monitoring AWS Elemental MediaConvert with Metrics and Events is crucial for obtaining detailed video and audio quality metrics for your transcoded content and identifying issues before they impact customer quality of experience (QoE). Amazon CloudWatch and Amazon EventBridge provide powerful sets of tools for monitoring, analyzing, and actioning on MediaConvert workflows, allowing users to gain valuable insights into MediaConvert performance and quickly resolve any issues that may arise. MediaConvert Media Metrics offer abundant data about your video content and transcoding jobs, which can be used to optimize your video workflows and video quality. By tracking key metrics such as transcoding warnings, video quality scores, black frames, and bitrate statistics, you can make informed decisions that improve the overall quality of your video assets. Be on the lookout for additional events and metrics on the horizon that will continue to enhance the observability capabilities for MediaConvert.

Kevin Nguyen

Kevin Nguyen

Kevin Nguyen is an Enterprise Account Engineer supporting AWS Elemental customer media workflows from contribution encoding through origination and content delivery.