Open Bug 2081479 Opened 1 month ago Updated 1 month ago

Full range video not displayed correctly on MacOS

Categories

(Core :: Audio/Video: Playback, defect, P3)

defect

Tracking

()

UNCONFIRMED

People

(Reporter: tnibler, Unassigned)

Details

Attachments

(2 files)

Attached file bt709-fullrange.html —

A test of mine fails on try using macOS 10.15 because reading back pixels of solid [0, 0, 255] RGB frames yields values in the range of [16-235] (+-3 as is usual for canvas). Those values are what one would expect from limited range rec.709 colors or -color_range tv in ffmpeg, but the video is full range.
The test case uses drawImage to draw a <video> to canvas and getImageData to read it back out.

The video is generated with:

ffmpeg -f lavfi -i nullsrc=r=25:s=320x240:duration=0.1 \
                                    -vf "drawbox=enable='between(n,0,25)':color=0x0000ff:t=fill" \
                                    -c:v libx264 \
                                    -color_range pc \
                                    -colorspace bt709 \
                                    fullrange.mp4
Attached video fullrange.mp4 —

It's not actually the 16-235 range, there's a 0,0,238 pixel too and larger values like 244.

Thank you for the test page and the sample video.

Analysis

The attached bt709-fullrange.html and fullrange.mp4 give a reliable test case. The video is H.264, 320x240, with full range BT.709. All of its frames are solid blue. On macOS, drawImage followed by getImageData gives blue values that are compressed into a limited range, not 255.

On macOS, the decoder selects its output pixel format from the color range in the decoder config. It selects a FullRange format only when that range is FULL. Refer to AppleVTDecoder.cpp. The step that loses the full range flag is not located yet. Possible steps are the decoder config, the decoder output, and the conversion of the MacIOSurface for the canvas. For this conversion, refer to MacIOSurface.cpp.

Related bugs: in bug 1720346, macOS reftests failed when the color range metadata was set. In bug 2055639, VideoDecoder reports full range H.264 as limited range.

Next steps

The next step is for the team to run the test page on macOS. Then the team can find which step changes the full range to the limited range. No more data is necessary from you now.


To give feedback on this comment, add a thumbs-up or thumbs-down reaction.

Severity: -- → S3
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: