Pulsating Fade with FFmpeg
How to apply continuous fade to a video source
The goal of this walkthrough is to create a pulsating fade effect that can be continuously applied to an input stream where the duration is unknown, like a live source.
geq to the rescue
geq filter allows the usage of an equation to be applied to each pixel. We can utilized this filter with the
T variable which references the time of the current frame.
For our example, we will combine it with a simple
sin to get a cyclic effect with a multiplier.
alpha_exprcannot be set alone. Either
lumor one of the
bmust be set along side. A hacky solution is to set
rgbto its original value via
absis used here to simplify the
sin‘s negative cycle
- The layer must be converted to have a alpha channel so that the
alphachannel can be changed
Combining some knowledge from the previous post on Blur Out Videos with FFmpeg, we get the end result. This takes in 1 input source, generates the blurred version of it, then adjusts the alpha according to time, then overlays the results on the base.