[FFmpeg-devel] [PATCH 1/3] avformat/dvdvideodec: add CLUT utilities and subtitle palette support

Stefano Sabatini stefasab at gmail.com
Wed Mar 6 18:00:38 EET 2024


On date Wednesday 2024-03-06 09:43:26 -0600, Marth64 wrote:
> It is true that this is necessary when muxing to Matroska, but it is also
> the case for MOV - the MOV muxer expects RGB prior to converting to YUV
> again. So this would be needed for MOV also, despite the awkward conversion
> circle. I should update the document to reflect this.

So we might drop the reference to Matroska, or change to something as:

Output subtitle palettes (CLUTs) as RGB, as required for example when
for subtitles rendering in Matroska or MP4 video.
...

I assume there is no heuristic to distinguish RGB/YUV (one trick might
be to add some custom metadata for the colorspace so that it can then
be read by the encoder).

Also I wonder if this is should not rather be an option for the
Matroska/MP4 renderer, to avoid duplicating the code.

> On Wed, Mar 6, 2024 at 09:36 Marth64 <marth64 at proxyid.net> wrote:
> 
> > Good morning,
> >
> > DVD subtitle palettes, which are natively YUV, are currently carried as
> > a hex string in their respective subtitle streams and have
> > no concept of colorspace tagging (even predating dvd demuxer). The
> > convention is to convert
> > them to RGB prior to storage. Common players will only render
> > the palettes properly if they are stored as RGB. Even ffmpeg itself
> > expects this, and already does -in libavformat- the YUV-RGB conversions,
> > specifically in mov.c and movenc.c.
> >
> > The point of this patch is to provide a consolidation of the code
> > that deals with creating the extradata as well as the RGB conversion.
> > That can then (1) enable usable palette support for DVD demuxer if it is
> > merged
> > and (2) start the process of consolidating the related conversions in
> > MOV muxer/demuxer and eventually find a way to properly tag
> > the colorspace.
> >
> > Thank you!


More information about the ffmpeg-devel mailing list