Skip to content

moq-mux H.265 importer puts the VUI sample aspect ratio in the catalog's displayAspectWidth/Height (1:1 SAR shows 16:9 video as square) #6536

Closed

Description

@michaelstuurman

Versions: libmoq 0.6.17 (libmoq-v0.6.17, e2c5b50); the same code is on the release branch at 379c8ec (2026-10-17). Player: @moq/watch 0.6.3.

What happens

config_from_sps in rs/moq-mux/src/codec/h265/import.rs copies the SPS VUI
aspect_ratio_info into the catalog:

config.display_aspect_width = vui_data.display_ratio_width;
config.display_aspect_height = vui_data.display_ratio_height;

VuiData::new fills those values from sar_width/sar_height, or from the
predefined aspect_ratio_idc table (Square → 1:1). That is the sample
(pixel) aspect ratio. The catalog field is documented as the display aspect
ratio (rs/hang/src/catalog/video/mod.rs). @moq/watch passes it to WebCodecs as
displayAspectWidth/displayAspectHeight.

Result

A standard 1280×720 HEVC stream that explicitly signals square pixels
(aspect_ratio_idc = 1) ends up in the catalog as displayAspectWidth: 1, displayAspectHeight: 1. The player then shows it as a square: 16:9 content is
squeezed horizontally. Any non-square SAR (e.g. 16:11, 40:33) is also misread as
a display ratio.

The H.264 path skips the SAR, so it is not affected.

Expected

Either:

  • compute the display aspect from the SAR and the (cropped) picture size,
    width × sar_w : height × sar_h (1280×720 with SAR 1:1 gives 16:9); or
  • leave the field unset when the SAR is 1:1 or unspecified, so players use the
    coded size.

Reproduce

Publish any HEVC stream whose SPS VUI has aspect_ratio_info_present_flag = 1
with aspect_ratio_idc = 1 through the libmoq H.265 importer. The catalog then
shows displayAspectWidth/Height = 1/1, and @moq/watch renders the video square.

Our workaround: our encoder no longer signals aspect information for square pixels,
so the field stays absent and players use the coded size.

Activity

  1. kixelated commented on Oct 23, 2026

    @kixelated
    Collaborator

    Thanks for the detailed report. This is fixed on main by #5574 (the H.265 importer now derives the display aspect from SAR and the cropped size, and leaves it unset for square pixels), but that never reached the release line libmoq 0.6.x ships from. Decision: backport #5574 to release rather than wait for the next cut.

    Planned in #6580 as quest/m0/h265-aspect-backport.md.

    (Written by Claude Opus 5.5)

  2. added
    questBeing tracked/planned in a quest. See `quest/`
    on Oct 23, 2026
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

    questBeing tracked/planned in a quest. See `quest/`

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions