[FFmpeg-devel] [PATCH] Fix colors for DVD subtitles

Alexandre Colucci alexandre at elgato.com
Tue Apr 26 21:20:50 CEST 2011


On 26 avr. 2011, at 19:11, Reimar Döffinger wrote:

> On Tue, Apr 26, 2011 at 10:53:54AM +0200, Alexandre Colucci wrote:
>> The patch simply makes DVD subtitles look like in VLC with a much simpler detection algorithm. It simply associates the component with the highest alpha (the actual text) with the chosen color. Those with lower alpha become darker.
> 
> Huh? Where do you see that? I only see you inverting the level value to what
> it is now, but your patch doesn't seem to care about the alpha values at any
> point!?
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 


As per the DVD specifications and the DVD implementation guidelines, the alpha values are meant to be in increasing order for the 4 color indexes. In particular see section 5.4.3 Allocation of pixel data:

00 - Background pixel
01 - Pattern pixel
10 - Emphasis pixel-1
11 - Emphasis pixel-2

All commercial DVDs adhere to this. The way this was meant by the DVD committee was to allow implementors to choose any index values in the 0-15 range in *ascending* order.

In other words there are two cases:

1 - properly authored DVDs where looking at the indexes suffices
2 - improperly authored DVDs where indexes do not follow the alpha levels.

This patch obviously does not care about case 2 but neither did the original code. However in case 1 it is clear that the original code does the exact opposite of what it should do, that is what the patch fixes.

Just compare the attached screenshots attached to the patch, they speak for themselves. The screenshots are from Con Air btw, not from some handmade source.

That said, the correct way is really not "guessing" but really using the actual color table in the PGC, see 4.3 Program Chain Information (7) PGC_SP_PLT in the DVD specifications. That is what VLC does and that is why they do not use this code (one of the reasons to be more precise), the guessing is really just a crutch for standalone vob files.

Alexandre



More information about the ffmpeg-devel mailing list