ffmpeg: Apply a time-based expr to control intensity of lowpass, highpass, aphaser, or aecho

  Kiến thức lập trình

I’m fading in and out two sources, intertwined in the output. Now I want to apply lowpass, highpass, aphaser, and/or aecho to the transitions using a time-based expr.

I’ve already succeeded using the volume filter to fade the sources in and out (Note that the sine has reversed polarity for the second volume filter):

# working fade in/out
ffmpeg -i knox.mp3 -i static.mp3 -filter_complex 
"[0:a] 
    volume = 'min(1, max(0, 0.5 + 0.5 * cos(PI * t / 5)))': eval=frame 
    [a0]; 
[1:a] 
    volume = 'min(1, max(0, 0.5 - 0.5 * cos(PI * t / 5)))': eval=frame 
    [a1]; 
[a0][a1]
    amix = inputs=2: duration=shortest" 
-c:a libmp3lame -q:a 2 output.mp3

ffmpeg -filters says that lowpass has time-based support:

  T.. = Timeline support
 TSC lowpass           A->A       Apply a low-pass filter with 3dB point frequency.

How can I similarly apply these other filters to source1 using a time-bassed expr? I was unsuccessful in figuring out lowpass and highpass:

# applying a lowpass filter
ffmpeg -i knox.mp3 -i static.mp3 -filter_complex 
"[0:a] 
    volume = 'min(1, max(0, 0.5 + 0.5 * cos(PI * t / 5)))': eval=frame, 
    lowpass=f=3000: mix='0.5 + 0.5 * cos(PI * t / 5)' 
    [a0]; 
[1:a] 
    volume = 'min(1, max(0, 0.5 - 0.5 * cos(PI * t / 5)))': eval=frame 
    [a1]; 
[a0][a1]
    amix = inputs=2: duration=shortest" 
-c:a libmp3lame -q:a 2 output.mp3

With the resultant error:

[Parsed_lowpass_1 @ 0x7f9a72005c00] [Eval @ 0x7ff7bec423d8] Undefined constant or missing '(' in 't/5)'
[Parsed_lowpass_1 @ 0x7f9a72005c00] Unable to parse option value "0.5 + 0.5 * cos(PI * t / 5)"
Error applying option 'mix' to filter 'lowpass': Invalid argument

What complicated fffmpeg faerie magic is needed to make some of the filters other than volume controlled by a time-based expr?

LEAVE A COMMENT