CONCEPT Cited by 1 source
In-loop quality metrics¶
Definition¶
In-loop quality metrics are reference visual-quality metrics (e.g. PSNR, SSIM, VMAF) computed during transcoding — inside the same command producing the encoded output — rather than post-hoc against already- encoded files. The "loop" is the encode path: a decoder is inserted after each encoder so its bitmaps can be compared against the pre-compression bitmaps in real time (Source: sources/2026-03-09-meta-ffmpeg-at-meta-media-processing-at-scale).
Why "after" doesn't always work¶
FFmpeg has long supported computing PSNR/SSIM/VMAF as a separate command taking two completed encodings as input. This suffices for:
- Offline analysis (bakeoffs, A/B comparisons).
- VOD quality dashboards computed after upload finishes.
It does not suffice for:
- Livestreaming. The encode is continuous; there is no "after" to compare against. If you want per-lane quality signals for alerting or for adaptive bitrate decisions, you need them now, not when the stream ends.
The architectural shape¶
The post describes it plainly:
"To do this, we need to insert a video decoder after each video encoder used by each output lane. These provide bitmaps for each frame in the video after compression has been applied so that we can compare against the frames before compression. In the end, we can produce a quality metric for each encoded lane in real time using a single FFmpeg command line."
For a multi-lane pipeline this becomes:
┌──> encoder_A ──> dec_A ──┐
│ ├──> quality_A
source ─> decoder ─────┤ ├──> quality_B
(once) │ ├──> quality_C
├──> encoder_B ──> dec_B ──┘
└──> encoder_C ──> dec_C ──┘
Each decoder after the encoder produces the "distorted" frames; the original shared decoder output is the "reference". Comparing reference vs distorted gives a per-lane reference metric in real time.
FFmpeg upstream timeline¶
FFmpeg did not historically support this graph shape. FFlabs, VideoLAN, and other contributors landed the feature as "in-loop" decoding in FFmpeg 7.0+, which was the final upstream unblock Meta needed to deprecate its internal FFmpeg fork for livestream use cases.
Cost implication¶
Every encoder now has a matching decoder running in the same command. This doubles the per-lane decode work (once for reference upstream of the encoders, once for distorted downstream of each encoder). At livestream scale this is the accepted cost of gaining real-time quality signals; for VOD the post-hoc comparison remains cheaper.
Reference-only¶
In-loop metrics are reference metrics by construction — the whole architecture exists to make the reference frames available for comparison. No-reference metrics (which score a single encoding against universal priors) don't need this machinery.