[FFmpeg-user] exponential decay, is it possible?

Paul B Mahol onemda at gmail.com
Sun Aug 5 18:30:32 EEST 2018


On 8/5/18, Michael Koch <astroelectronic at t-online.de> wrote:
> Am 05.08.2018 um 15:42 schrieb Gyan Doshi:
>>
>>
>> On 05-08-2018 06:41 PM, Michael Koch wrote:
>>> I'd like to ask if it's possible to make an exponential decay effect
>>> with FFmpeg.
>>> Let's assume a pixel is fashing to luminance = 1 in just one frame.
>>> Then in the output video I'd like to have the pixel flashing to 1
>>> immediately, followed by an exponential decay with a time constant of
>>> a few seconds.
>>>
>>> The mathematics would be something like this:
>>>
>>> luminance = 0.95 * luminance_in_last_frame;     // exponential decay
>>> if (luminance_in_new_frame > luminance)
>>>    luminance = luminance_in_new_frame;
>>
>> So,
>>
>> frame 0    --> luminance 0
>> frame 1    --> luminance 1
>> frame 2    --> as per exprs above
>> ...
>> frame 2+T  -->       "
>> frame NEXT  --> source luminance
>> ...
>> frame LAST -->       "
>>
>> ?
>>
>> Or would the exponential decay restart each time a pixel of lum 1 is
>> encountered?
>>
>
> Every time when the input becomes brighter than the last output frame,
> the output is set to the input value. If input is below the last output
> value, then exponential decay.
> I have a timelapse video of the night sky with meteors. Each meteor is
> visible only in one frame. I'd like to make them visible a little
> longer, decaying over several frames.
>
> Example:
> Input   Output
> 0     0
> 1     1            // set to input value
> 0     0.95      // exponential decay begins
> 0     0.90
> 0.50     0.86
> 0.50     0.81     // until here
> 0.90     0.90     // now set again to input value, because input is
> brighter
> 0.90     0.90     // keep at the same level
> 0.60     0.86     // exponential decay begins
> 0.60     0.81
> 0.60     0.77

If it is calculating global luma instead of local one, it can be added
to deflicker filter.
Otherwise you will need to write new video filter.


More information about the ffmpeg-user mailing list