Body: <p>Thanks to the answers i got on my last <a href="https://video.stackexchange.com/questions/36547/how-to-add-a-afade-effect-to-a-complex-filter-in-this-case-volume">question</a>, i came up with the following if statement named <code>string</code> :
  <code>&quot;if(between(t,6,12.6)+between(t,16.6,29.8)+between(t,33.8,44),0.15,if(between(t,5,6),0.15/(6-5)*(t-5),if(between(t,15.6,16.6),0.15/(16.6-15.6)*(t-15.6),if(between(t,32.8,33.8),0.15/(33.8-32.8)*(t-32.8),if(between(t,12.6,13.6),0.15/(13.6-12.6)*(13.6-t),if(between(t,29.8,30.8),0.15/(30.8-29.8)*(30.8-t),if(between(t,44,45),0.15/(45-44)*(45-t))))))))&quot;</code></p>
  <p>And i'm applying it in the following fluent-ffmpeg command thanks to this complex filter :</p>
  <pre class="lang-js prettyprint-override"><code>.complexFilter([
      {
          filter: &quot;volume&quot;,
          options: [string], 
          inputs: &quot;1&quot;,
          outputs: 'audio',
          eval: 'frame'
      },
      {
          filter: &quot;amix&quot;,
          options: 'inputs=2',
          inputs: [&quot;0:a&quot;, &quot;audio&quot;]
      }
  ])
  </code></pre>
  <p>What this does is just like -filter_complex &quot;[1:a]volume=<code>string</code>:eval=frame[&quot;audio&quot;]&quot; then it applies an amix on 0:a and audio. I'm getting the following errors though :</p>
  <pre><code>[Parsed_volume_0 @ 0x7fffe828d140] [Eval @ 0x7ffff0835170] Missing ')' or too many args in 'between(t'
  [Parsed_volume_0 @ 0x7fffe828d140] Error when evaluating the volume expression '&quot;if(between(t'
  [AVFilterGraph @ 0x7fffe81e0400] Error initializing filter 'volume' with args '&quot;if(between(t'
  Error initializing complex filters.
  Invalid argument
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-06-05T14:08:59.513Z
Comments.Text: I tried your volume expression in the pure ffmpeg command, and it works, i.e. **it is syntactically correct** (but silence in first 5 seconds). So the problem is in the *fluent ffmpeg* part (I have no experience with it), for example you entered incorrect value in `options: [string]` (maybe braces have been part of the `string` variable itself – I only guess).
Comments.UserDisplayName: MarianD
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-06-05T14:27:31.720Z
Comments.Text: Ok i also tried and it seems like it works just in ffmpeg. Except it's not doing what i want, at all. Must have made an error somewhere. Between 6 to 12.6, 16,6 to 29.8 and 33.8 to 44 it should be at 15%. Before each of those it should decrease from 100% to 15% over 1s and after each of those it should increase to 100% over 1s.
  The rest of the time it should be at 100%. I'm gonna figure out why the fluent version isn't working but i have no idea why my if statement is wrong.
Comments.UserDisplayName: Nobunaji
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-06-05T15:11:21.230Z
Comments.Text: Ok i managed to fix my fluent-ffmpeg command. But for some reason, no filter is applied when i use it. Even though there is one when i just use the ffmpeg command.
Comments.UserDisplayName: Nobunaji
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-06-05T15:37:25.263Z
Comments.Text: I would prefer to construct your volume expression by continuing the procedure in my answer to your previous question – it is a safe way. Then, if it will work, you may optimize it.
Comments.UserDisplayName: MarianD
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-06-06T03:18:56.763Z
Comments.Text: Or use directly the ready-to-use expression in the comment of Баяр Гончикжапов under my answer of your previous question.
Comments.UserDisplayName: MarianD
Tags: <ffmpeg>
Title: "Error initializing complex filters" Using volume filter in fluent-ffmpeg
UserDisplayName: Nobunaji
ThreadText: # "Error initializing complex filters" Using volume filter in fluent-ffmpeg
  
  (Asked by: username_0 on 2023-06-05)
  
  Thanks to the answers i got on my last [question](https://video.stackexchange.com/questions/36547/how-to-add-a-afade-effect-to-a-complex-filter-in-this-case-volume), i came up with the following if statement named `string` :
  `"if(between(t,6,12.6)+between(t,16.6,29.8)+between(t,33.8,44),0.15,if(between(t,5,6),0.15/(6-5)*(t-5),if(between(t,15.6,16.6),0.15/(16.6-15.6)*(t-15.6),if(between(t,32.8,33.8),0.15/(33.8-32.8)*(t-32.8),if(between(t,12.6,13.6),0.15/(13.6-12.6)*(13.6-t),if(between(t,29.8,30.8),0.15/(30.8-29.8)*(30.8-t),if(between(t,44,45),0.15/(45-44)*(45-t))))))))"`
  
  And i'm applying it in the following fluent-ffmpeg command thanks to this complex filter :
  
  ```js
  .complexFilter([
      {
          filter: "volume",
          options: [string], 
          inputs: "1",
          outputs: 'audio',
          eval: 'frame'
      },
      {
          filter: "amix",
          options: 'inputs=2',
          inputs: ["0:a", "audio"]
      }
  ])
  
  ```
  
  What this does is just like -filter\_complex "[1:a]volume=`string`:eval=frame["audio"]" then it applies an amix on 0:a and audio. I'm getting the following errors though :
  
  ```
  [Parsed_volume_0 @ 0x7fffe828d140] [Eval @ 0x7ffff0835170] Missing ')' or too many args in 'between(t'
  [Parsed_volume_0 @ 0x7fffe828d140] Error when evaluating the volume expression '"if(between(t'
  [AVFilterGraph @ 0x7fffe81e0400] Error initializing filter 'volume' with args '"if(between(t'
  Error initializing complex filters.
  Invalid argument
  
  ```
  
  **Tags:** ffmpeg
  
  > **Comments:**
  > **username_1**: I tried your volume expression in the pure ffmpeg command, and it works, i.e. **it is syntactically correct** (but silence in first 5 seconds). So the problem is in the *fluent ffmpeg* part (I have no experience with it), for example you entered incorrect value in `options: [string]` (maybe braces have been part of the `string` variable itself – I only guess).  
  > **username_0**: Ok i also tried and it seems like it works just in ffmpeg. Except it's not doing what i want, at all. Must have made an error somewhere. Between 6 to 12.6, 16,6 to 29.8 and 33.8 to 44 it should be at 15%. Before each of those it should decrease from 100% to 15% over 1s and after each of those it should increase to 100% over 1s. The rest of the time it should be at 100%. I'm gonna figure out why the fluent version isn't working but i have no idea why my if statement is wrong.  
  > **username_0**: Ok i managed to fix my fluent-ffmpeg command. But for some reason, no filter is applied when i use it. Even though there is one when i just use the ffmpeg command.  
  > **username_1**: I would prefer to construct your volume expression by continuing the procedure in my answer to your previous question – it is a safe way. Then, if it will work, you may optimize it.  
  > **username_1**: Or use directly the ready-to-use expression in the comment of Баяр Гончикжапов under my answer of your previous question.  
  
  ---
  
  ## 0 answers
  
  