Open Bug 1789397 Opened 3 years ago Updated 11 months ago

AVIF remux of an AV1 keyframe is displayed brighter than a PNG export of the same keyframe

Categories

(Core :: Graphics: ImageLib, defect, P3)

Firefox 104
defect

Tracking

()

UNCONFIRMED

People

(Reporter: mithgol, Unassigned, NeedInfo)

Details

Attachments

(1 file)

Attached image screenshot.png

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:104.0) Gecko/20100101 Firefox/104.0

Steps to reproduce:

  1. Download https://graph.org/file/e56c1b684839ae1c86d3d.mp4 and https://take-me-to.space/IOHXywN.mp4 and https://bun.filedit.ch/AgJgOnVffWrePbqMWAY.mp4 and confirm that these are three backup copies of the same video quote. (Later one of the backups might be used to reproduce this bug even if the other two are purged.)

  2. Visit the web site of “FFmpeg Windows Builds” at https://www.gyan.dev/ffmpeg/builds/ and download the FFmpeg build archive https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-2022-09-05-git-2ed5925e26-full_build.7z (currently the latest weekly build) and unpack the files “ffmpeg.exe” and “ffprobe.exe” from that 7-Zip archive. Also download https://take-me-to.space/SylGdhQ.7z and https://a.pomf.cat/axpakx.7z and confirm that these are two backup copies of the same 7-Zip archive. (Later one of the backups might be used to reproduce this bug even if the original build is deemed too old and purged.)

  3. Use the unpacked FFprobe to make a list of that video's frames by the following command on Windows:

ffprobe -loglevel error -select_streams v:0 -show_entries packet=pts_time,flags -of csv=print_section=0 https://take-me-to.space/IOHXywN.mp4 >framelist.txt

  1. Look through the lines of “framelist.txt” and confirm that the 1441st frame (at 60.06 seconds) is a keyframe and the 1921st frame (at 80.08 seconds) is also a keyframe.

  2. Use the unpacked FFmpeg to remux these keyframes to AVIF by the following commands on Windows:

ffmpeg -hide_banner -i https://take-me-to.space/IOHXywN.mp4 -ss 60.05 -frames:v 1 -c:v copy 1441.avif

ffmpeg -hide_banner -i https://take-me-to.space/IOHXywN.mp4 -ss 80.07 -frames:v 1 -c:v copy 1921.avif

  1. Export the same keyframes to PNG files by the following commands on Windows:

ffmpeg -hide_banner -i https://take-me-to.space/IOHXywN.mp4 -ss 60.05 -frames:v 1 1441.png

ffmpeg -hide_banner -i https://take-me-to.space/IOHXywN.mp4 -ss 80.07 -frames:v 1 1921.png

  1. Use https://download.xnview.com/XnViewMP-win-x64.exe to install XnView MP (currently version 1.02) on Windows.

  2. Use the installed XnView MP to compare the keyframe pairs (“1441.avif” and “1441.png”, “1921.avif” and “1921.png”) visually. Confirm that in each pair the AVIF file is visually equivalent to the PNG file and equally bright.

  3. Download https://github.com/ungoogled-software/ungoogled-chromium-windows/releases/download/104.0.5112.102-1.1/ungoogled-chromium_104.0.5112.102-1.1_windows_x64.zip and unpack the portable version of ungoogled Chromium (version 104.0.5112.102-1) from that archive.

  4. Run the unpacked “chrome.exe” on Windows, drag-and-drop the keyframe pairs (“1441.avif” and “1441.png”, “1921.avif” and “1921.png”) to the Chromium window and compare them visually. Confirm that in each pair the PNG file looks somewhat brighter (noticeably) than the AVIF file and also brighter than the same PNG in XnView MP. The AVIF file looks as bright as in XnView MP.

  5. Run Firefox (version 104.0.1) on Windows, drag-and-drop the keyframe pairs (“1441.avif” and “1441.png”, “1921.avif” and “1921.png”) to the Firefox window and compare them visually.

Actual results:

In each pair the AVIF file looks somewhat brighter (noticeably) than the PNG file and also brighter than the same AVIF in XnView MP or in Chromium.

The PNG file looks as bright as in Chromium.

(The attached screenshot demonstrates the first pair of files in Firefox and in Chromium.)

Expected results:

One expected result is that the AVIF remux (lossless) and the PNG export (also lossless) of the same AV1 keyframe should have looked equally bright (as in XnView MP).

The other expected result is that the colorspace for different image formats might be different, but it should have been the same in different Web browsers (such as PNG in Chromium and PNG in Firefox).

The actual results, however, differ from both of these expectations.

If you investigate the matter and discover some details that can prove that Firefox does the right thing and the bug resides in FFmpeg (or in Chromium, or in both), then please report these details to their developers.

The author of https://twitter.com/jonarnes/status/1313093339210829824 mentioned that AVIF images were darkened in Chrome Canary in 2020 and that they were lighter in Chrome earlier and continued being lighter in Firefox. That might be somehow related.

The Bugbug bot thinks this bug should belong to the 'Core::Graphics: ImageLib' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Graphics: ImageLib
Product: Firefox → Core
Severity: -- → S3
Flags: needinfo?(tnikkel)
Flags: needinfo?(aosmond)
Priority: -- → P3

The first of “Steps to reproduce” uses a video quote that has its own steps to reproduce.

(See https://gitlab.com/AOMediaCodec/SVT-AV1/-/issues/1929#note_1053287591 if they're necessary.)

Originally that was a video quote of Hikigaya Hachiman's monologue (from the 8th episode of “Yahari Ore no Seishun Love Comedy wa Machigatteiru Zoku”) made with the intention to fit that quote in the 5 MB file size limit imposed by https://graph.org/

Flags: needinfo?(tnikkel)

Incorrect gamma appears with any avif where "Transfer Characteristics" is specified 1 (BT.1886) or 6 / 14 (SMPTE 170M/BT.2020 SDR, which are the same as BT.1886)

BT.1886 is the typical match for rec 709 colorspace, common for video. Not so common for images, but it's AVIF's nature to handle both kinds of content

Not sure how this interacts with ICC profiles. AV1 contained in mp4 or webm does not have this problem. I'm on Windows 10 with 8-bit monitor

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: