[FFmpeg-user] How to associate a palette to DVD subtitle ?

Thierry Lelégard thierry.lelegard at free.fr
Sun Sep 22 22:12:33 CEST 2013

Le 19/09/2013 19:19, Nicolas George a écrit :
> Le jour du Génie, an CCXXI, Thierry Lelegard a écrit :
>> I am looking for a way to make ffmpeg use or guess the correct palette. Is
>> there any?
> There is a "palette" option to the dvdsub decoder. It has the same syntax as
> the "palette:" line in VOBSUB IDX files: a comma-separated list of 16
> 24 bits RGB values. It should do the trick.
I confirm that the following works:

1) Extract the palette info (16 x 4 bytes) from the VTS_xx_0.IFO file.
See http://dvd.sourceforge.net/dvdinfo/ifo.html
Follow the chain VTS_PGCI -> VTS_PGC -> palette in PGC

2) Convert the palette from YUV (0, Y, Cr, Cb) to RGB (0, R, G, B).
See http://en.wikipedia.org/wiki/Yuv and search for 'Integer operation of ITU-R standard for YCbCr(8 bits per channel) to RGB888'

3) Use command ffmpeg -palette rrggbb,rrggbb,...,rrggbb -i input ...

And you get the correct DVD subtitle colors.
Thanks to Nicolas (again) for pointing to the right options.

More information about the ffmpeg-user mailing list