summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorOneric <oneric@oneric.de>2022-11-13 20:57:17 +0100
committerPaul B Mahol <onemda@gmail.com>2022-12-03 19:08:39 +0100
commit95115fcc184db6217ce01632a0fbdff3e253183f (patch)
tree22e148c9a89df2306fd96e051418d10c20376b91 /libavcodec
parentd82e30d0d18b665634d7ae441727a54082465a8c (diff)
avcodec/ass: accurately preserve colours
Colour values used in ASS files without a "YCbCr Matrix" header set to "None" are subject to colour mangling, due to how ASS was historically conceived. A more in-depth description can be found in the documetation inside libass' public ass_types.h header. The important part is, if this header is not set to "None", the final output colours can deviate from the literal value specified in the file. When converting from non-ASS formats we do not want any colour shift to happen, so let's set the appropiate header. NB: ffmpeg's subtitle filter, does not follow libass' documentation regarding colour mangling, thus hiding the bug. Anything based on VSFilter, XySubFilter or e.g. mpv do and might show the issue. (Of course native ASS subs, which _do_ rely on colour mangling won't work properly with the subtitle filter, but this can be fixed another time)
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/ass.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libavcodec/ass.c b/libavcodec/ass.c
index fdf55f36ca..d2ea4c62c3 100644
--- a/libavcodec/ass.c
+++ b/libavcodec/ass.c
@@ -41,6 +41,7 @@ int ff_ass_subtitle_header_full(AVCodecContext *avctx,
"PlayResX: %d\r\n"
"PlayResY: %d\r\n"
"ScaledBorderAndShadow: yes\r\n"
+ "YCbCr Matrix: None\r\n"
"\r\n"
"[V4+ Styles]\r\n"