Skip to content

[Bug]: AV1 encodes which require using alignment mode 1080p or unrestricted don't signal the correct resolution #423

@RFCArrow

Description

@RFCArrow

Describe the bug
It seems that when using the AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE set to AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_NO_RESTRICTIONS, the video is extended by adding rows/columns of black pixels to fit into a whole number of transforms. However, the height and width signalled in the Sequence Header OBU is set to the extended resolution rather than the original height/width. This means that when a video is encoded using a non-64x16 alignment and then decoded, it will feature a black strip at the edge of the video at some resolutions (for example 1920x1080, 960x540, 320x180 etc). Instead the Sequence Header OBU should signal the original resolution so that the frame is cropped appropriately to avoid the black edges being displayed. It is also important that the original resolution is signalled because some applications require that the original input resolution is maintained in the output.

To Reproduce
Steps to reproduce the behavior:

  • Build the AMF TranscodeHW sample.
  • Run with -WIDTH 320 -HEIGHT 180 -INPUT C:\Users\rob.arrow\assets\test_input\other\input_short_320x180_8bit_420p.yuv -OUTPUT output.mp4 -CODEC AV1 -TRACE_LEVEL 4 -Av1AlignmentMode NORESTRICTIONS
  • Play/inspect the output
  • Note the black strip at the bottom
  • Note the resolution is signalled as 320x192.

Setup (please complete the following information):

  • OS: Windows 11 Pro (22H2 / 22621.2283)
  • Driver Version: 21.9.3
  • GPU: RX 7900 XTX
  • AMF: 1.4.30 (2f32635)
  • Which component has the issue: Encoder

Debug Log (please upload or paste):
Attached here

Expected behavior
The output video has resolution 320x180 (the same as the input video). No black edge extension is visible while playing the output video.

Additional context
Note a similar effect occurs when using the 64x16A1080P alignment mode one 1080p video. In that case, the video is extended to 1920x1082 and a similar 2-pixel tall row of black pixels is added to the bottom of the video.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions