<p>I need to run an audio filter on a piped input using its own lufs value as a variable, without writing to disk.</p>
<p>I previously bounced the piped input to <code>processedaudio.wav</code> and the command works as:</p>
<pre><code>ffmpeg -i pipe:0 -af $(echo &quot;startofafilter$(echo &quot;$(
ffmpeg -i processedaudio.wav -vn -af ebur128=framelog=verbose -f null - 2&gt;&amp;1 |awk '/I:/{print $2}')&quot;)
restofthefilter&quot;) -f null - 2&gt;&amp;1);
</code></pre>
<p>which pulls the lufs value from <code>processedaudio.wav</code> in that nested ffmpeg command (which is the same as pipe:0), but the value needs to change dynamically with each file. I need it to read from the pipe (or whatever gets me a similar effect) like this:</p>
<pre><code>ffmpeg -i pipe:0 -af $(echo &quot;startofafilter$(echo &quot;$(
ffmpeg -i pipe:0 -vn -af ebur128=framelog=verbose -f null - 2&gt;&amp;1 |awk '/I:/{print $2}')&quot;)
restofthefilter&quot;) -f null - 2&gt;&amp;1);
</code></pre>
<p>where the only change is the nested input, but that command just hangs. Any ideas?</p>
<p>Edit: This is basically the workflow needed:
<a href="https://i.sstatic.net/6m4kW.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/6m4kW.png" alt="enter image description here" /></a></p>
<p>Edit2: Attempting a named pipe seems to cause ffmpeg to hang.
Named pipes are working in general:</p>
<pre><code>mkfifo outpipe.wav | ffmpeg -y -i test.mov outpipe.wav | ffmpeg -f wav -i outpipe.wav testout.wav
</code></pre>
<p>and this command works with an actual file name:</p>
<pre><code>echo &quot;$(ffmpeg -f wav -i test.wav -vn -af &quot;ebur128=framelog=verbose&quot; -f null - 2&gt;&amp;1 | awk '/I:/{print $2}')&quot;
</code></pre>
<p>But it doesn't work with a piped input:</p>
<pre><code>mkfifo outpipe.wav | ffmpeg -y -i test.mov outpipe.wav | echo &quot;$(ffmpeg -f wav -i outpipe.wav -vn -af &quot;ebur128=framelog=verbose&quot; -f null - 2&gt;&amp;1 | awk '/I:/{print $2}')&quot;
</code></pre>
<p>At this point, I'm not sure what's going on. Am I missing something? Is this a bug?</p>

CC BY-SA 4.0
2020-01-14T05:32:48.020Z
How are you planning to use the LUFS value?
Gyan
CC BY-SA 4.0
2020-01-14T05:51:12.910Z
I'm doing some math to it and using that new number as the adjustment value for the audio filter. The files I process have different average levels in every video, mostly voice over at a constant level within each video, so the value must be adjusted up or down as needed.
BreadEagles
CC BY-SA 4.0
2020-01-14T20:20:48.323Z
It will eventually be the n value for silencedetect, if that helps.
BreadEagles
CC BY-SA 4.0
2020-01-15T05:55:11.920Z
Make the pipe input available though two named pipes and read through those..
Gyan
<ffmpeg><audio><filter><metadata>
ffmpeg dynamic filter values from piped input
BreadEagles
# ffmpeg dynamic filter values from piped input

(Asked by: username_0 on 2020-01-14)

I need to run an audio filter on a piped input using its own lufs value as a variable, without writing to disk.
I previously bounced the piped input to processedaudio.wav and the command works as:
ffmpeg -i pipe:0 -af $(echo "startofafilter$(echo "$(
ffmpeg -i processedaudio.wav -vn -af ebur128=framelog=verbose -f null - 2>&1 |awk '/I:/{print $2}')")
restofthefilter") -f null - 2>&1);

which pulls the lufs value from processedaudio.wav in that nested ffmpeg command (which is the same as pipe:0), but the value needs to change dynamically with each file. I need it to read from the pipe (or whatever gets me a similar effect) like this:
ffmpeg -i pipe:0 -af $(echo "startofafilter$(echo "$(
ffmpeg -i pipe:0 -vn -af ebur128=framelog=verbose -f null - 2>&1 |awk '/I:/{print $2}')")
restofthefilter") -f null - 2>&1);

where the only change is the nested input, but that command just hangs. Any ideas?
Edit: This is basically the workflow needed:

Edit2: Attempting a named pipe seems to cause ffmpeg to hang.
Named pipes are working in general:
mkfifo outpipe.wav | ffmpeg -y -i test.mov outpipe.wav | ffmpeg -f wav -i outpipe.wav testout.wav

and this command works with an actual file name:
echo "$(ffmpeg -f wav -i test.wav -vn -af "ebur128=framelog=verbose" -f null - 2>&1 | awk '/I:/{print $2}')"

But it doesn't work with a piped input:
mkfifo outpipe.wav | ffmpeg -y -i test.mov outpipe.wav | echo "$(ffmpeg -f wav -i outpipe.wav -vn -af "ebur128=framelog=verbose" -f null - 2>&1 | awk '/I:/{print $2}')"

At this point, I'm not sure what's going on. Am I missing something? Is this a bug?

**Tags:** ffmpeg, audio, filter, metadata

> **Comments:**
> **username_1**: How are you planning to use the LUFS value?  
> **username_0**: I'm doing some math to it and using that new number as the adjustment value for the audio filter. The files I process have different average levels in every video, mostly voice over at a constant level within each video, so the value must be adjusted up or down as needed.  
> **username_0**: It will eventually be the n value for silencedetect, if that helps.  
> **username_1**: Make the pipe input available though two named pipes and read through those..  

---

## 0 answers

