diff mbox

[FFmpeg-devel,v2] doc/filters: Add double-pass example for loudnorm

Message ID 20180819215700.33041-1-epirat07@gmail.com
State Superseded
Headers show

Commit Message

Marvin Scholz Aug. 19, 2018, 9:57 p.m. UTC
---
Changes compared to v1:

- Change example loudnorm value to match EBU128
- Change file names to "input" and "output"

 doc/filters.texi | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

Comments

Gyan Aug. 20, 2018, 5:30 a.m. UTC | #1
On 20-08-2018 03:27 AM, Marvin Scholz wrote:

> +@example
> +$ ffmpeg -i input -map 0:a -af loudnorm=I=-23:TP=-1:print_format=summary -f null -
> +
> +[...]
> +Input Integrated:     -9.0 LUFS
> +Input True Peak:      +1.5 dBTP
> +Input LRA:             9.4 LU
> +Input Threshold:     -19.5 LUFS
> +@end example
> +
> +Then pass the input measurements to the next run that produces the result:
> +
> +@example
> +ffmpeg -i input -af loudnorm=I=-23:TP=-1:measured_I=-9.0:measured_TP=1.5:measured_LRA=9.4:measured_thresh=-19.5:print_format=summary output

a) Your first pass command will run the filter for all audio streams in 
the input, but your 2nd pass command won't. Suggest you remove the mapping.

b) Except for a particular set of conditions*, loudnorm will resample 
the audio to 192 kHz. ffmpeg may then resample the result to the highest 
supported rate by the encoder. For native AAC, this will be 96 kHz; for 
PCM, it will remain to 192kHz. Some (many ?) players, especially web 
ones, don't support these sampling rates. It's advised to insert 
aresample afterwards e.g. aresample=48000

*if all of these conditions are met: linear is true and enabled; target 
LRA is equal or greater than input LRA; target TP is equal or greater 
than input LRA after adjusting for integrated loudness change.


Gyan
Marvin Scholz Aug. 20, 2018, 1:16 p.m. UTC | #2
On 20 Aug 2018, at 7:30, Gyan Doshi wrote:

> On 20-08-2018 03:27 AM, Marvin Scholz wrote:
>
>> +@example
>> +$ ffmpeg -i input -map 0:a -af 
>> loudnorm=I=-23:TP=-1:print_format=summary -f null -
>> +
>> +[...]
>> +Input Integrated:     -9.0 LUFS
>> +Input True Peak:      +1.5 dBTP
>> +Input LRA:             9.4 LU
>> +Input Threshold:     -19.5 LUFS
>> +@end example
>> +
>> +Then pass the input measurements to the next run that produces the 
>> result:
>> +
>> +@example
>> +ffmpeg -i input -af 
>> loudnorm=I=-23:TP=-1:measured_I=-9.0:measured_TP=1.5:measured_LRA=9.4:measured_thresh=-19.5:print_format=summary 
>> output
>
> a) Your first pass command will run the filter for all audio streams 
> in the input, but your 2nd pass command won't. Suggest you remove the 
> mapping.

Oh indeed, thanks.

>
> b) Except for a particular set of conditions*, loudnorm will resample 
> the audio to 192 kHz. ffmpeg may then resample the result to the 
> highest supported rate by the encoder. For native AAC, this will be 96 
> kHz; for PCM, it will remain to 192kHz. Some (many ?) players, 
> especially web ones, don't support these sampling rates. It's advised 
> to insert aresample afterwards e.g. aresample=48000

Sure but this is already mentioned in the documentation so I thought it 
would make the example needlessly complex
as I wanted to focus it on the two-pass aspect. But I can add that.

>
> *if all of these conditions are met: linear is true and enabled; 
> target LRA is equal or greater than input LRA; target TP is equal or 
> greater than input LRA after adjusting for integrated loudness change.
>
>
> Gyan
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Carl Eugen Hoyos Aug. 20, 2018, 2:55 p.m. UTC | #3
2018-08-20 7:30 GMT+02:00, Gyan Doshi <gyandoshi@gmail.com>:
> On 20-08-2018 03:27 AM, Marvin Scholz wrote:
>
>> +@example
>> +$ ffmpeg -i input -map 0:a -af loudnorm=I=-23:TP=-1:print_format=summary
>> -f null -
>> +
>> +[...]
>> +Input Integrated:     -9.0 LUFS
>> +Input True Peak:      +1.5 dBTP
>> +Input LRA:             9.4 LU
>> +Input Threshold:     -19.5 LUFS
>> +@end example
>> +
>> +Then pass the input measurements to the next run that produces the
>> result:
>> +
>> +@example
>> +ffmpeg -i input -af
>> loudnorm=I=-23:TP=-1:measured_I=-9.0:measured_TP=1.5:
>> measured_LRA=9.4:measured_thresh=-19.5:print_format=summary
>> output
>
> a) Your first pass command will run the filter for all audio streams in
> the input, but your 2nd pass command won't. Suggest you remove the mapping.

Or use -map 0:a:0

Carl Eugen
diff mbox

Patch

diff --git a/doc/filters.texi b/doc/filters.texi
index 32c95b591c..dfc0d91008 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3659,6 +3659,29 @@  Set print format for stats. Options are summary, json, or none.
 Default value is none.
 @end table
 
+@subsection Examples
+
+For double pass processing you need to first run the filter with
+@code{print_format} set to either @code{json} or @code{summary}, then read
+the values in the output and pass it to the next run of the filter:
+
+@example
+$ ffmpeg -i input -map 0:a -af loudnorm=I=-23:TP=-1:print_format=summary -f null -
+
+[...]
+Input Integrated:     -9.0 LUFS
+Input True Peak:      +1.5 dBTP
+Input LRA:             9.4 LU
+Input Threshold:     -19.5 LUFS
+@end example
+
+Then pass the input measurements to the next run that produces the result:
+
+@example
+ffmpeg -i input -af loudnorm=I=-23:TP=-1:measured_I=-9.0:measured_TP=1.5:measured_LRA=9.4:measured_thresh=-19.5:print_format=summary output
+@end example
+
+
 @section lowpass
 
 Apply a low-pass filter with 3dB point frequency.