[FFmpeg-user] Documentation and feature request

Michael Koch astroelectronic at t-online.de
Mon Apr 29 12:15:20 EEST 2019


Am 15.04.2019 um 18:10 schrieb Gyan:
> Hi Michael,
>
> I'll look at these in detail later on, but just to touch on one point..
>
> On 15-04-2019 06:15 PM, Michael Koch wrote:
>>
>> "eq" filter:
>> -- It might be helpful to add a note that multiple eq filters can be 
>> cascaded, for example if contrast enhancement bigger than 2 is required.
>
> Contrast can go from -1000 to 1000. The range was expanded a few years 
> ago; the doc wasn't updated.
>
> Do note that what contrast does is scale the distance of a pixel's 
> value from the median value i.e. 128 for a 8-bit input. So, if a pixel 
> channel has a value of 100, then a contrast of 3 results in a value of 
>   128 + 3*(100-128) = 44.
>
> The order is contrast -> brightness -> gamma.


If we assume the video data is in the [0..1] range, the function (before 
applying gamma) is:

out = brightness + 0.5 + contrast * (in - 0.5)

This works fine for images where most pixels are in the center of the 
histogram.
But it fails for images which consist mainly of a dark background, with 
only a few bright details. To amplify contrast in such images, both 
brightness and contrast must be adjusted.

May I suggest to add a new parameter p (pivot) in the range [0..1] which 
is 0.5 by default (so that it's compatible with old command lines).

out = brightness + p + contrast * (in - p)

With the p value properly set, the contrast could be adjusted without 
changing the brightness.

Michael



More information about the ffmpeg-user mailing list