AccMPEG: Optimizing Video Encoding for Video Analytics

Kuntai Du, Qizheng Zhang, Anton Arapin, Haodong Wang, Zhengxu Xia, Junchen JiangarXiv 2022 · DOI

Abstract

Video analytics applications typically rely on streaming high-definition video from edge cameras to centralized cloud servers for inference via Deep Neural Networks (DNNs). However, traditional video compression standards like H.264 are designed to optimize for human visual perception, often preserving details irrelevant to AI while discarding features critical for accuracy. We introduce AccMPEG, a novel encoding framework that leverages "accuracy gradients" to prioritize image regions essential for machine vision. By employing a lightweight camera-side model to guide Region-of-Interest (ROI) encoding, AccMPEG reduces end-to-end latency by 10-43% without compromising inference performance.

1. Introduction

The proliferation of smart cities and autonomous systems has led to a surge in edge-to-cloud video analytics. In these architectures, resource-constrained edge devices (cameras) capture video and transmit it to powerful cloud servers for complex tasks such as object detection and semantic segmentation. The primary bottleneck in this pipeline is the trade-off between bandwidth consumption and inference accuracy.

Current video codecs (e.g., MPEG) prioritize textures and colors perceptible to the human eye. In contrast, DNNs may prioritize structural boundaries or specific semantic contexts that humans find negligible. Existing attempts to bridge this gap, such as server-driven feedback loops (DDS) or local heuristics (Reducto), suffer from high network latency or inadequate handling of complex spatial tasks. AccMPEG addresses these challenges by introducing a compute-efficient, accuracy-aware encoding mechanism.

2. Methodology

AccMPEG centers on the concept of the Accuracy Gradient (AccGrad), a metric that quantifies the sensitivity of a server-side DNN's output to the encoding quality of specific 16x16 macroblocks.

2.1 The AccModel

To implement this at the edge, the authors developed the AccModel, a lightweight quality selector based on a modified MobileNet-SSD. This model runs locally on the camera, processing incoming frames to generate a binary mask. This mask identifies "critical" macroblocks requiring High Quality (HQ) encoding versus "non-critical" regions that can be compressed at Low Quality (LQ).

2.2 ROI Encoding and Temporal Optimization

AccMPEG utilizes standard H.264 ROI features, ensuring compatibility with existing hardware encoders. To minimize computational overhead, the system employs temporal optimization: the AccModel is invoked only once every 10 frames. Given the high temporal redundancy in video, the generated mask remains valid for subsequent frames, significantly reducing the per-frame compute cost.

2.3 Decoupled Training

A significant hurdle in specialized encoding is the tight coupling between the encoder and the specific server-side model. AccMPEG overcomes this through decoupled training. Ground-truth AccGrads are pre-calculated from the heavy server model and used to train the lightweight AccModel. This process is highly efficient, allowing a new selector to be trained for a specific task in approximately 8 minutes using an 8-GPU cluster.

3. Experimental Evaluation

The researchers evaluated AccMPEG across three diverse video datasets sourced from YouTube, covering various challenges including fast motion and varying lighting:

  • Driving: 9,000 frames focused on object detection in urban environments.
  • Dashcam: 12,600 frames involving varied lighting and high-speed motion.
  • Surf: 6,598 frames for complex semantic segmentation and keypoint detection.

4. Key Insights

  • Macroblock Granularity: Operating at the 16x16 macroblock level—the native unit of H.264—reduces the complexity of the selection task by 256x compared to pixel-level segmentation.
  • Contextual Importance: Unlike simple object-based encoding that only prioritizes bounding boxes, AccGrads reveal that DNNs often require the pixels surrounding an object to maintain high confidence.
  • Robustness to False Positives: The system is designed to be conservative; "over-encoding" a low-impact block as HQ has negligible impact on bandwidth compared to the accuracy loss of "under-encoding" a critical block. This allows the use of a very lightweight, slightly less precise AccModel.

5. Results

AccMPEG demonstrates significant improvements over state-of-the-art baselines like DDS and AWStream:

  • Latency: End-to-end inference delay is reduced by 10-43%.
  • Accuracy: Inference accuracy is maintained or slightly improved (0.5-2%) due to the targeted preservation of critical features.
  • Resource Efficiency: The camera-side overhead is 20x lower than full-frame high-quality encoding on a Jetson Nano, supporting 30fps on standard CPU hardware.

6. Conclusion and Future Work

AccMPEG successfully redefines video encoding for the era of machine vision. By aligning compression with the needs of DNNs rather than human viewers, it achieves superior latency and accuracy. Future research will address challenges related to out-of-distribution data—where the AccModel may fail to recognize novel objects—and extreme motion scenarios that exceed the current 10-frame sampling window. Additionally, further optimization is required for detecting very small, distant objects in high-resolution streams.

Summary updated

BibTeX
@misc{du2022accmpeg,
  author = {Kuntai Du and Qizheng Zhang and Anton Arapin and Haodong Wang and Zhengxu Xia and Junchen Jiang},
  title = {{AccMPEG: Optimizing Video Encoding for Video Analytics}},
  year = {2022},
  eprint = {2204.12534},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2204.12534},
}
Figure