Skip to content

Normalised encoder telemetry: one per-frame and per-block schema with adapters for open and hardware encoders #86

Closed

Description

@lusoris

BLUF. There is no vendor-neutral, open description of "what the encoder actually did" per frame and per block. Pelorus has the first pieces (PEL_SEC_QPREPORT, an x265 CSV reader); this issue turns them into a normalised encoder-telemetry layer with adapters for the open encoders and the hardware-encoder feedback APIs. Target: pre-1.0 spec, adapters during VMAFx 1.2.

Problem

Quality-driven tooling needs the encoder's own decisions (QP, bits, picture type, block-mode mix) next to the quality score. Today each encoder reports them in a different shape, scale and granularity, so every consumer writes its own parser and none of them can compare encoders.

Evidence (all read 2026-10-06)

  • FFmpeg master 6287ad1: the only cross-encoder channel is AV_PKT_DATA_QUALITY_STATS (libavcodec/packet.h), filled through ff_encode_add_stats_side_data() by libx264, libx265, libsvtav1, libaomenc, libvpxenc, the nvenc, amfenc and qsvenc wrappers and a few others. It carries one QP-as-lambda value, the picture type and optional SSE per packet. No per-block data, no bit split, no block-mode counts.
  • AV_FRAME_DATA_VIDEO_ENC_PARAMS (per-block QP delta) is produced only by decoders (h264dec, mpegvideo_dec, vp9); no encoder writes it.
  • x265 writes frame-level CSV (--csv --csv-log-level 1|2: QP, bits, scenecut flag, PSNR, SSIM, CU-mode percentages) and no per-CU QP export (https://x265.readthedocs.io/en/master/cli.html).
  • SVT-AV1 writes a per-picture PSNR/SSIM file (--stat-file, needs --enable-stat-report 1) in its own format (https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/Docs/Parameters.md).
  • Hardware-encoder SDKs expose richer data under unrelated names: one hardware-encoder SDK has BlockQpFeedback, PSNRFeedback, SSIMFeedback, StatisticsFeedback properties (header VideoEncoderVCE.h, read 2026-10-06); another returns frame-average QP and frame SATD with each locked bitstream (SDK 12.1 application note, secondary source via search); the Vulkan feedback-query extensions add intra/inter/skip counts (VK_KHR_video_encode_feedback2, introduced with Vulkan 1.4.353 per https://phoronix.com/news/Vulkan-1.4.353, secondary source).
  • Pelorus today: PEL_SEC_QPREPORT (ABI 1.1) and pel_x265_csv_parse; the hardware per-block path is hardware-blocked (ADR-0119, ADR-0122). No other encoder has an adapter.
  • Public tools that join metric and encoder data (ffmpeg-quality-metrics, https://github.com/slhck/ffmpeg-quality-metrics) read only the metric side. Unverified: that no other open project defines a cross-encoder per-frame stats schema; searches found none.

Proposal

  1. Specify a normalised per-frame record (append-only PEL_SEC_QPREPORT extension or a sibling section, ABI 1.4): codec family, QP scale id (AVC/HEVC 0..51, AV1 base_q_idx, VVC), QP as reported and as normalised, bits split (header/residual/total where available), picture type, intra/inter/skip counts, encoder-reported PSNR/SSIM with a source flag, and a granularity field (frame, row, block).
  2. Adapters in dependency-free C, SDK types abstracted as for the x265 reader: FFmpeg QUALITY_STATS, x265 CSV (exists), SVT-AV1 --stat-file, libaom per-frame stats, VVenC log, plus the hardware feedback structures behind the same input struct.
  3. A capability record per adapter (which fields it can fill), so a consumer can tell "not reported" from "zero".
  4. Fixture corpus: one recorded stats file per encoder, replayed in tests.

Acceptance criteria (failing first)

  • Test written first: parsing a truncated or field-shifted stats file for each adapter returns an error, never a partial record.
  • A record built from the same clip encoded by libx264, libx265 and libsvtav1 at matched QP carries identical normalised QP within one step; the test fails if an adapter forgets the scale conversion.
  • A field the encoder does not report reads "not reported" in the capability record, not zero (negative test per adapter).
  • Layout locks (_Static_assert) and the shared conformance fixture are updated in the same PR; VMAFx mirror re-synced.
  • Docs page under docs/metrics/ with the field table and per-encoder coverage matrix.

VMAFx link

Feeds the encoder-feedback work in vidiko/vmafx#2067 (items 5 and 6), the score provenance in vidiko/vmafx#2142 and the calibration in vidiko/vmafx#2143, which needs encoder-reported quality next to exact scores. Phase: spec before VMAFx 1.0.0 RC4 (so the mirror carries it), adapters in 1.2.

Activity

  1. added
    enhancement
    on Oct 6, 2026
  2. lusoris commented on Oct 8, 2026

    @lusoris
    ContributorAuthor

    vidiko/vmafx#2271 (decode-side bitstream facts, VMAFx 1.1) and vidiko/vmafx#2510 (stream-metadata ADR) both state that their field names are shared with this schema. #220 adds the test that loads both schemas and fails on any name difference. A field rename here after vidiko/vmafx#2271 publishes its schema needs a matching VMAFx change, so names are best settled in this issue before the ABI 1.4 bump merges.

  3. lusoris commented on Oct 9, 2026

    @lusoris
    ContributorAuthor

    The schema half of this issue shipped in v0.4.0-rc.1, and the adapters move to 0.6. On 2026-10-09 the maintainer decided the adapters follow VMAFx's 1.2 phase instead of blocking v0.4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions