You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Software host, VT-backed HEVC: no pixel aspect ratio reaches the layer, so anamorphic HEVC renders at coded dimensions #354
On the software host's VT-backed decoder (HEVC), nothing ever attaches a pixel aspect ratio, so anamorphic content is decoded, enqueued and displayed at its coded dimensions. A 720x576 stream declaring 64:45 presents as 720x576 instead of 1024x576: a 16:9 picture squashed into 5:4.
The libavcodec decoder on the same host does attach it (SoftwareVideoDecoder.attachPixelAspectRatio, the #177 fix), which is why this survived: the defect is one decoder wide, and the two are chosen per codec inside the same host.
Measured
aetherctl play --sw --frame-times, same synthetic clip encoded twice, 720x576 with setsar=64/45:
h264 (SoftwareVideoDecoder): picture settles at 1024x576 correct
hevc (HardwareVideoDecoder): picture settles at 720x576 squashed
The reading is AetherEngine.softwareDisplaySize (#353), which is taken off the format description the renderer enqueues, so it is the size the layer draws at rather than a second opinion about it.
Why
HardwareVideoDecoder.open builds its CMVideoFormatDescription with the hvcC atoms extension alone, and never kCMFormatDescriptionExtension_PixelAspectRatio. The renderer then builds its own description from the delivered CVPixelBuffer (CMVideoFormatDescriptionCreateForImageBuffer), which reads attachments off that buffer, and no kCVImageBufferPixelAspectRatioKey is ever set on it.
This is the same shape as the color metadata a few lines below, which carries a comment saying exactly why it is re-applied per frame: "VTDecompressionSession should propagate these from SPS+hvcC but has been observed not to".
Which sources reach it
The software host takes HEVC through VTCapabilityProbe.canHardwareDecode, and it is reached in production by an interlaced field order or an SPS that indicates interlacing (the deinterlace detour), and by forward-only sources. Broadcast SD is where both interlacing and a non-square SAR live at once, so the combination is not hypothetical, though it is narrow.
Fix
Resolve the ratio once at open() from the two declared sources the container can carry it on (declaredStreamSAR), run it through the existing PixelAspectPolicy gates (#177 components, #290 display aspect), and attach it in handleDecodedFrame next to the color metadata, clearing a stale attachment on a pooled buffer the way the libavcodec path does. No new policy: the same decision, applied on the decoder that was missing it.
Resolved once at open() rather than per frame, because VT delivers pixel buffers and not AVFrames: the per-frame source the libavcodec path prefers does not exist here, which also makes the #177 latch unnecessary, since one resolution cannot oscillate. Both declared sources are read, since only one of them is the container's, and both existing gates run unchanged. Square pixels attach nothing, and a stale attachment on a recycled pool buffer is removed.
Verified on the same four encodes the issue was measured with: the VT path moves 720x576 to 1024x576, the libavcodec path and both square-pixel controls are unchanged.
Activity
superuser404notfound commentedon Aug 9, 2026
Fixed in 6.17.0,
92a44047.Resolved once at
open()rather than per frame, because VT delivers pixel buffers and notAVFrames: the per-frame source the libavcodec path prefers does not exist here, which also makes the #177 latch unnecessary, since one resolution cannot oscillate. Both declared sources are read, since only one of them is the container's, and both existing gates run unchanged. Square pixels attach nothing, and a stale attachment on a recycled pool buffer is removed.Verified on the same four encodes the issue was measured with: the VT path moves 720x576 to 1024x576, the libavcodec path and both square-pixel controls are unchanged.
fix(swpath): attach the pixel aspect ratio on the VT-backed decoder too