[FFmpeg-trac] #9491(avfilter:open): ass/subtitle filter incorectly handles colorspaces

FFmpeg trac at avcodec.org
Mon Nov 1 15:31:45 EET 2021


#9491: ass/subtitle filter incorectly handles colorspaces
--------------------------------------+------------------------------------
             Reporter:  alwinramirus  |                    Owner:  (none)
                 Type:  defect        |                   Status:  open
             Priority:  normal        |                Component:  avfilter
              Version:  git-master    |               Resolution:
             Keywords:  ass           |               Blocked By:
             Blocking:                |  Reproduced by developer:  0
Analyzed by developer:  0             |
--------------------------------------+------------------------------------
Comment (by alwinramirus):

 I am way out of my area of experties here, but as I understand it the
 YCbCr Matrix line is there for historical reasons to maintain backwards
 compatibility with old subtitles.

 > What is worse, VSFilter originally always used BT.601, even for BT.709
 videos, which means there are many subtitles out there which have RGB
 colors that match the BT.709 video only if you use BT.601 for the video's
 YCbCr -> RGB conversion! Very ugly, indeed. Because of this problem the
 "YCbCr matrix" field was added to the ASS header, which allows interested
 parties (e.g. the video renderer) to understand which matrix the subtitle
 was created for, and if that happens to mismatch the video's actual
 encoded matrix, extra measures could be applied (e.g. by the video
 renderer) to correct for the mismatch.
 https://github.com/libass/libass/issues/297#issuecomment-360126487

 As I understand it this is what is supposed to happen depending on the
 YCbCr Matrix value:
 > TV.601 = Output BT.601 with 16-235 YCbCr level range
 > TV.709 = Output BT.709 with 16-235 YCbCr level range
 > PC.601 = Output BT.601 with 0-255 YCbCr level range
 > PC.709 = Output BT.709 with 0-255 YCbCr level range
 > None = [Decide] based on video
 > If 'YCbCr Matrix' is missing from a script,[...] use TV.601 for legacy
 script compatibility
 https://www.videohelp.com/software/xy-VSFilter/version-history

 There are also some notes in the libass code:
 https://github.com/libass/libass/blob/49f116ab1fa4386f6a5191f322ac29872279516e/libass/ass_types.h#L105-L156
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9491#comment:6>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list