[FFmpeg-trac] #9682(undetermined:new): vf_subtitles: color is displayed wrong (drawutils doesn't take into account bt709?)

FFmpeg trac at avcodec.org
Mon Mar 7 20:08:43 EET 2022


#9682: vf_subtitles: color is displayed wrong (drawutils doesn't take into account
bt709?)
-------------------------------------+-------------------------------------
             Reporter:  Gregory      |                     Type:  defect
  Beauregard                         |
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:  git-
  undetermined                       |  master
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 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.
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9682>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list