Opened 2 years ago

Closed 2 years ago

#9682 closed defect (duplicate)

vf_subtitles: color is displayed wrong (drawutils doesn't take into account bt709?)

Reported by: Gregory Beauregard Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

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.

See also https://github.com/FFmpeg/FFmpeg/blob/13a153d801011c4ec82b90af1351e10dcf1754e1/libavfilter/vf_subtitles.c#L170

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.

Attachments (2)

bad_fontcolor.mkv (517.9 KB ) - added by Gregory Beauregard 2 years ago.
sample
ffmpeg-20220307-100321.log (85.6 KB ) - added by Gregory Beauregard 2 years ago.
log

Download all attachments as: .zip

Change History (3)

by Gregory Beauregard, 2 years ago

Attachment: bad_fontcolor.mkv added

sample

by Gregory Beauregard, 2 years ago

Attachment: ffmpeg-20220307-100321.log added

log

comment:1 by Gregory Beauregard, 2 years ago

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.