h264 color spaces are not supported

UNCONFIRMED
Unassigned

Status

()

Core
Audio/Video: Playback
P5
normal
UNCONFIRMED
2 years ago
18 days ago

People

(Reporter: Vittorio Giovara, Unassigned)

Tracking

43 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments)

(Reporter)

Description

2 years ago
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:43.0) Gecko/20100101 Firefox/43.0
Build ID: 20151216175450

Steps to reproduce:

Open a h264 video with properly tagged color_matrix, transfer_charcteristic, color_primaires, the colors will not look correct.

This happens for bt709 and bt601 videos on any platform.


Actual results:

The output color does not match the original video


Expected results:

The output color should have matched the original video.
(Reporter)

Comment 1

2 years ago
Created attachment 8705066 [details]
example video
(Reporter)

Comment 2

2 years ago
Created attachment 8705067 [details]
how it looks
(Reporter)

Comment 3

2 years ago
Created attachment 8705069 [details]
how it should look

Updated

2 years ago
Component: Untriaged → Audio/Video: Playback
Product: Firefox → Core
I can't tell if this is the embedded colour declaration (which we don't support) or the hardware decoder using video vs pc output levels (which is can't support, but nvidia's control panel has a pref).

Thanks for the report. Supporting colour-correction for video would be nice, be we don't have plans to implement it currently.
Priority: -- → P5
(Reporter)

Comment 5

2 years ago
The hardware decoder gets it right on Windows, but that's about it. No matter of hw acceleration, it looks incorrect on OSX and Linux. I don't know if color range is involved, but the input video I tried all had tv/video level.
Maybe screenshot a standard testpattern, and measure the colour values vs what's expected, so we have some quantitative measure of the issue?
Bug 1210357 has VP9 samples. Once this is fixed for VP9, it should also be easy to fix for H.264.
(Reporter)

Comment 8

a year ago
(In reply to Ralph Giles (:rillian) needinfo me from comment #6)
> Maybe screenshot a standard testpattern, and measure the colour values vs
> what's expected, so we have some quantitative measure of the issue?

Sorry for the delay, I don't have an exact test pattern, but you can generate correctly converted samples with this command line

for 30 fps videos (and multiples)
`ffmpeg -i input_tagged_bt709.mp4 -vf colorspace=all=bt601-6-525 -colorspace smpte170m -color_trc smpte170m -color_primaries smpte170m output_tagged_bt601ntsc.mp4`

for 25 fps videos (and multiples)
`ffmpeg -i input_tagged_bt709.mp4 -vf colorspace=all=bt601-6-625 -colorspace bt470bg -color_trc smpte170m -color_primaries bt470bg output_tagged_bt601pal.mp4`

Comment 9

19 days ago
We wrote a Test-Tool, to check the h264 colorspace support on different Browsers: 
http://hr-a.akamaihd.net/test/colorspaceTest/videoplayer.html

You can take videos from there, if you like. 
They have all the same colors but different resolutions and colorspaces.
The right colorspace signalized in the h.264 parameter sets.

On Win7 the behavior depends on the GPU: 
Intel uses only bt.601  

Nvidia is guessing the colorspace: 960x540 and larger it uses bt.709 and for 640x360 and smaller it uses bt.601.
Depending on the Nvidia-Driver-Settings the TV-Range does not match.
(Reporter)

Comment 10

18 days ago
(In reply to adorn from comment #9)
> We wrote a Test-Tool, to check the h264 colorspace support on different
> Browsers: 
> http://hr-a.akamaihd.net/test/colorspaceTest/videoplayer.html

interesting, on OSX I get

firefox - bt601: ok, bt709: not ok 
chrome - bt601: not ok, bt709: ok
safari - bt601: ok, bt709: ok

I'll check your tool out more, thanks for sharing
(Reporter)

Comment 11

18 days ago
the chrome and firefox difference is especially interesting since they should be using the same library (libyuv)

Comment 12

18 days ago
I think Firefox is ignoring the Colorspace-info in the SPS/PPS-Headers.

Without this Info Nvidia is guessing the colorspace: 960x540 and larger it uses bt.709 and for 640x360 and smaller it uses bt.601.
and Intel is allways using bt.601.

Chrome Canary has still wrong colors on OSX and Android. But it's working on Windows.
You need to log in before you can comment on or make changes to this bug.