[FFmpeg-devel] [PATCH] swscale: set sane alpha blending defaults

Ivan Kalvachev ikalvachev at gmail.com
Sun Aug 30 21:29:23 CEST 2015


On 8/30/15, wm4 <nfxjfg at googlemail.com> wrote:
> On Sun, 30 Aug 2015 18:09:05 +0000 (UTC)
> Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
>
>> wm4 <nfxjfg <at> googlemail.com> writes:
>>
>> > Change the default to blend with black, which
>> > gives generally expected results.
>>
>> Given that this introduces a speed regression, is
>> rarely needed and it is immediately visible that
>> the function is needed, I don't think this is a
>> sensible change.
>>
>> Note that contrary to visual issue, the performance
>> regression is not immediately visible.
>>
>> And "black" may be sensible for prores, in all
>> other cases, it is either suboptimal or bad.
>>
>> Carl Eugen
>
> PS: there is a 3rd way: make libswscale fail initialization if an alpha
> conversion happens, but the user didn't specify the alpha mode.

That or blending with checkerboard pattern.

One of the strongest points in Carl objections is that there is no
universal optimal and correct behavior.

- In one case you would want to ignore the alpha channel, as it might
contain only garbage.
- In second case, you'd want to blend it with white color, because the
flv is encoded with it in mind.
- In this case, the proress encoding assumes blending with black color.

Since there is no single optimal solution, we should force the user in
picking the correct mode himself.

I think the default should be blending with checkerboard pattern.

It is immediately recognized as alpha artifact, so the user would know
what the reason for the issue. Even better - print a hint about
'alphablend' and its modes to console.

Of course, ideally there should be some metadata gimmick to set
blend-to-white with .flv and blend-to-black for proress.


More information about the ffmpeg-devel mailing list