<p>The <code>lut</code> filter expressions don't work with time. <code>geq</code> does.</p>

<pre><code>geq=r='(1-0.7*min((T-S)/D,1))*p(X,Y)':g={the same as r}:b={the same}:enable='gte(t,S)'
</code></pre>

<p><code>S</code> should be your start time in second. <code>D</code> is duration for the change in colours. <code>T</code> and <code>p(X,Y)</code> are variables and should be kept as is.  </p>

CC BY-SA 3.0
2017-04-14T16:58:39.047Z
Gives me an error. I tried both substituting each S with the start time and not substituting. `[Parsed_geq_0 @ 0x7fa6ab5007c0] [Eval @ 0x7fff576460e0] Unknown function in 'S)/D,1))*p(X,Y)'
[AVFilterGraph @ 0x7fa6ab413a80] Error initializing filter 'geq' with args 'r=(1-0.7*min((T-S)/D,1))*p(X,Y):g=(1-0.7*min((T-S)/D,1))*p(X,Y):b=(1-0.7*min((T-S)/D,1))*p(X,Y):enable=gte(t,3)'`
HDL
CC BY-SA 3.0
2017-04-14T17:15:37.977Z
`S` and `D` have to be substituted with numerical values.
Gyan
CC BY-SA 3.0
2017-04-14T17:46:18.620Z
I got it working, however it's slowing the rest of the encoding process to a crawl. How do I get it to resume normal encoding speed?
HDL
CC BY-SA 3.0
2017-04-14T17:50:28.323Z
Change enable to `between(t,S,S+D) ` And add your lut filter for `gte(t,S+D)`
Gyan
CC BY-SA 3.0
2017-04-14T22:45:25.510Z
I get an error trying that. Here's what I have: `geq=r='(1-0.7*min((T-3)/3,1))*p(X,Y)':g='(1-0.7*min((T-3)/3,1))*p(X,Y)':b='(1-0.7*min((T-3)/3,1))*p(X,Y)':'between(t,3,3+3)',lutrgb=enable='gte(t,3+3)'`
HDL
CC BY-SA 3.0
2017-04-15T05:02:06.510Z
You have to keep the `enable=` before `between` (and I assume you've simply omitted the lut exprs for brevity. They should be specified)
Gyan
CC BY-SA 3.0
2017-04-15T19:35:38.343Z
Finally got it. Thanks for your patience. I actually had to use `gt` instead of `gte`, otherwise I would get a frame of overlap where the image was extra darkened. Final command that works: `geq=r='(1-0.7*min((T-3)/3,1))*p(X,Y)':g='(1-0.7*min((T-3)/3,1))*p(X,Y)':b='(1-0.7*min((T-3)/3,1))*p(X,Y)':enable='between(t,3,3+3)',lutrgb=enable='gt(t,6)':'r=0.3*val:g=0.3*val:b=0.3*val'`
HDL
CC BY-SA 3.0
2017-04-14T16:28:03.750Z
2017-04-14T16:28:03.750Z
Gyan
<p>I have a background image that I'm trying to fade to specific color values using this filter: <code>lutrgb=enable='gte(t,3)':'r=0.3*val:g=0.3*val:b=0.3*val'</code></p>

<p>This almost works, but it changes the values instantly.  How do I get it to fade to those values gradually over time?</p>

CC BY-SA 3.0
2017-04-14T15:48:39.170Z
Your example doesn't alter alpha but the color channels. Is that what you want?
Gyan
CC BY-SA 3.0
2017-04-14T16:01:13.870Z
Sorry, I was messing with alpha earlier and the word "opacity" stuck. I'm simply trying to get the background image to partially fade/darken, not become transparent.
HDL
<video><ffmpeg><editing><filter><alpha>
ffmpeg fade to specific color values over time
HDL
# ffmpeg fade to specific color values over time

(Asked by: username_0 on 2017-04-14)

I have a background image that I'm trying to fade to specific color values using this filter: `lutrgb=enable='gte(t,3)':'r=0.3*val:g=0.3*val:b=0.3*val'`

This almost works, but it changes the values instantly. How do I get it to fade to those values gradually over time?

**Tags:** video, ffmpeg, editing, filter, alpha

> **Comments:**
> **username_1**: Your example doesn't alter alpha but the color channels. Is that what you want?  
> **username_0**: Sorry, I was messing with alpha earlier and the word "opacity" stuck. I'm simply trying to get the background image to partially fade/darken, not become transparent.  

---

## 1 answers

### Answer by username_1 on 2017-04-14. Score: 2 | Accepted answer

The lut filter expressions don't work with time. geq does.
geq=r='(1-0.7*min((T-S)/D,1))*p(X,Y)':g={the same as r}:b={the same}:enable='gte(t,S)'

S should be your start time in second. D is duration for the change in colours. T and p(X,Y) are variables and should be kept as is.

> **Comments:**
> **username_0**: Gives me an error. I tried both substituting each S with the start time and not substituting. `[Parsed_geq_0 @ 0x7fa6ab5007c0] [Eval @ 0x7fff576460e0] Unknown function in 'S)/D,1))*p(X,Y)' [AVFilterGraph @ 0x7fa6ab413a80] Error initializing filter 'geq' with args 'r=(1-0.7*min((T-S)/D,1))*p(X,Y):g=(1-0.7*min((T-S)/D,1))*p(X,Y):b=(1-0.7*min((T-S)/D,1))*p(X,Y):enable=gte(t,3)'`  
> **username_1**: `S` and `D` have to be substituted with numerical values.  
> **username_0**: I got it working, however it's slowing the rest of the encoding process to a crawl. How do I get it to resume normal encoding speed?  
> **username_1**: Change enable to `between(t,S,S+D) ` And add your lut filter for `gte(t,S+D)`  
> **username_0**: I get an error trying that. Here's what I have: `geq=r='(1-0.7*min((T-3)/3,1))*p(X,Y)':g='(1-0.7*min((T-3)/3,1))*p(X,Y)':b='(1-0.7*min((T-3)/3,1))*p(X,Y)':'between(t,3,3+3)',lutrgb=enable='gte(t,3+3)'`  
> **username_1**: You have to keep the `enable=` before `between` (and I assume you've simply omitted the lut exprs for brevity. They should be specified)  
> **username_0**: Finally got it. Thanks for your patience. I actually had to use `gt` instead of `gte`, otherwise I would get a frame of overlap where the image was extra darkened. Final command that works: `geq=r='(1-0.7*min((T-3)/3,1))*p(X,Y)':g='(1-0.7*min((T-3)/3,1))*p(X,Y)':b='(1-0.7*min((T-3)/3,1))*p(X,Y)':enable='between(t,3,3+3)',lutrgb=enable='gt(t,6)':'r=0.3*val:g=0.3*val:b=0.3*val'`  

---

