Opened 8 months ago
Last modified 5 months ago
#10884 open defect
Using `-hwaccel_output_format videotoolbox_vld` make `scale_vt` to produce wrong color
Reported by: | gnattu | Owned by: | ePirat |
---|---|---|---|
Priority: | normal | Component: | avcodec |
Version: | git-master | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | yes |
Description
Summary of the bug:
When use -hwaccel_output_format videotoolbox_vld
with scale_vt
filter, the output SDR file will have a wrong color. The red light would appears to be yellow.
The sunlight from below video sample from LG promotion will produce a difference that is very easy to tell:
https://isovideo.com/SDR_to_HLG_Conversion_Clips/LG_4K_OLED_Wonders-184055-tmu_hlg10_hevc.mkv
How to reproduce:
Run below command and the test.mp4 will have wrong color:
% ./ffmpeg -hwaccel videotoolbox \ -hwaccel_output_format videotoolbox_vld \ -i LG_4K_OLED_Wonders-184055-tmu_hlg10_hevc.mkv \ -c:v hevc_videotoolbox \ -profile:v main \ -b:v 3M \ -vf scale_vt=w=iw/2:h=ih/2:color_matrix=bt709:color_primaries=bt709:color_transfer=bt709 \ -c:a copy \ -tag:v hvc1 \ test.mp4
Run this, just removing the -hwaccel_output_format videotoolbox_vld \
line, and replace it with an hwupload, will give you a correct color:
%./ffmpeg -hwaccel videotoolbox \ -i /Users/gnattu/Movies/ffmpeg-sample/4K_HLG.mkv \ -c:v hevc_videotoolbox \ -profile:v main \ -b:v 3M \ -vf hwupload,scale_vt=w=iw/2:h=ih/2:color_matrix=bt709:color_primaries=bt709:color_transfer=bt709 \ -c:a copy \ -tag:v hvc1 \ test-correct.mp4
Attachments (2)
Change History (6)
by , 8 months ago
Attachment: | wrong-color.jpg added |
---|
by , 8 months ago
Attachment: | correct-color.jpg added |
---|
The correct color output. The sunlight looks more natural.
comment:1 by , 8 months ago
I am new at this project but looks like pixel format causes the problem.
With -hwaccel_output_format videotoolbox_vld
you are using videotoolbox_vld
as pix_fmt
. If you run like that -hwaccel_output_format p010le
it should work as expected. I could not figure out how videotoolbox selects pixel format inside (If it have different format). But looks like it's supporting in the official documentation.
comment:2 by , 8 months ago
With some research, the problem looks like to me "Tone mapping". I am not sure I am still trying to figure out but it looks like default videotoolbox_vld
making basic tone mapping? during hardware decoding and if specify the pix_fmt
in this case the format = p010le
which is 10 bit format, I could not understand why it is works but it looks like it supposed to be.
comment:3 by , 5 months ago
Analyzed by developer: | set |
---|---|
Component: | avfilter → avcodec |
Owner: | set to |
Reproduced by developer: | set |
Status: | new → open |
comment:4 by , 5 months ago
Sent a patch to fix this: https://patchwork.ffmpeg.org/project/ffmpeg/patch/D1E2MAH4KSWW.3K4ZU7WI2LNUJ@gmail.com/
The wrong color output. The sunlight appears too yellow.