vf_subtitles: color is displayed wrong (drawutils doesn't take into account bt709?)
|Reported by:||Gregory Beauregard||Owned by:|
|Blocking:||Reproduced by developer:||no|
|Analyzed by developer:||no|
Summary of the bug: ffmpeg subtitles filter renders the wrong color. I think this is due to
ff_draw_color in drawutils.c not taking into account bt709 color space when converting from RGB. I've attached a sample with ASS subtitles where the color subtitle color is matched to a video element and the pink color in the subtitles matches perfect in mpv, but mismatches when encoded with ffmpeg subtitles filter.
How to reproduce:
ffmpeg -report -i bad_fontcolor.mkv -vf subtitles=bad_fontcolor.mkv -c:v libx264 -b:v 3M -sn out.mkv
Version used is ffmpeg master built on march 7, 2022. Sample and full log report is attached.
and https://github.com/FFmpeg/FFmpeg/blob/13a153d801011c4ec82b90af1351e10dcf1754e1/libavfilter/drawutils.c#L141-L182 where it doesn't seem to take into account bt709 when converting the color from RGB. If this is indeed the problem there are filters other than vf_subtitles that are in principle affected by this.