diff mbox

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

Message ID 20180820214839.34521-1-epirat07@gmail.com
State New
Headers show

Commit Message

Marvin Scholz Aug. 20, 2018, 9:48 p.m. UTC
---
Changes to v2:

- Removed -map option to prevent filter to affect all audio channels
  in the first pass example

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

Comments

Gyan Aug. 21, 2018, 4:44 a.m. UTC | #1
On 21-08-2018 03:18 AM, Marvin Scholz wrote:


> +@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

Since your input LRA is 9.4, and output LRA is 7 (default), the filter 
will upsample to 192 kHz. You should resample afterwards.

If we publish this, it will generate support queries as to why our 
example produces "silent" files.

Thanks,
Gyan
Marvin Scholz Aug. 21, 2018, 11:13 p.m. UTC | #2
On 21 Aug 2018, at 6:44, Gyan Doshi wrote:

> On 21-08-2018 03:18 AM, Marvin Scholz wrote:
>
>
>> +@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
>
> Since your input LRA is 9.4, and output LRA is 7 (default), the filter 
> will upsample to 192 kHz. You should resample afterwards.
>

Ok, whats the correct way to do that?

> If we publish this, it will generate support queries as to why our 
> example produces "silent" files.
>
> Thanks,
> Gyan
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Gyan Aug. 22, 2018, 4:40 a.m. UTC | #3
On 22-08-2018 04:43 AM, Marvin Scholz wrote:

>>
>>> +@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
>>
>> Since your input LRA is 9.4, and output LRA is 7 (default), the filter 
>> will upsample to 192 kHz. You should resample afterwards.
>>
> 
> Ok, whats the correct way to do that?

e.g.

     ffmpeg -i input -af loudnorm=...,aresample=48000 output

Ideally, loudnorm should call a resampler internally, but for now, this 
is what we can do.

Thanks,
Gyan
Marvin Scholz Aug. 22, 2018, 9:08 a.m. UTC | #4
On 22 Aug 2018, at 6:40, Gyan Doshi wrote:

> On 22-08-2018 04:43 AM, Marvin Scholz wrote:
>
>>>
>>>> +@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
>>>
>>> Since your input LRA is 9.4, and output LRA is 7 (default), the 
>>> filter will upsample to 192 kHz. You should resample afterwards.
>>>
>>
>> Ok, whats the correct way to do that?
>
> e.g.
>
>     ffmpeg -i input -af loudnorm=...,aresample=48000 output

This just gives me:

[Parsed_aresample_1 @ 0x7f99fb503ec0] Cannot select channel layout for 
the link between filters Parsed_aresample_1 and format_out_0_1.
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0


>
> Ideally, loudnorm should call a resampler internally, but for now, 
> this is what we can do.
>
> Thanks,
> Gyan
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Gyan Aug. 22, 2018, 9:44 a.m. UTC | #5
On 22-08-2018 02:38 PM, Marvin Scholz wrote:
> 
> 
> On 22 Aug 2018, at 6:40, Gyan Doshi wrote:
> 
>> On 22-08-2018 04:43 AM, Marvin Scholz wrote:
>>
>>>>
>>>>> +@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
>>>>
>>>> Since your input LRA is 9.4, and output LRA is 7 (default), the 
>>>> filter will upsample to 192 kHz. You should resample afterwards.
>>>>
>>>
>>> Ok, whats the correct way to do that?
>>
>> e.g.
>>
>>     ffmpeg -i input -af loudnorm=...,aresample=48000 output
> 
> This just gives me:
> 
> [Parsed_aresample_1 @ 0x7f99fb503ec0] Cannot select channel layout for 
> the link between filters Parsed_aresample_1 and format_out_0_1.

Share complete command and log.

Gyan
Marvin Scholz Aug. 22, 2018, 10:31 a.m. UTC | #6
On 22 Aug 2018, at 11:44, Gyan Doshi wrote:

> On 22-08-2018 02:38 PM, Marvin Scholz wrote:
>>
>>
>> On 22 Aug 2018, at 6:40, Gyan Doshi wrote:
>>
>>> On 22-08-2018 04:43 AM, Marvin Scholz wrote:
>>>
>>>>>
>>>>>> +@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
>>>>>
>>>>> Since your input LRA is 9.4, and output LRA is 7 (default), the 
>>>>> filter will upsample to 192 kHz. You should resample afterwards.
>>>>>
>>>>
>>>> Ok, whats the correct way to do that?
>>>
>>> e.g.
>>>
>>>     ffmpeg -i input -af loudnorm=...,aresample=48000 output
>>
>> This just gives me:
>>
>> [Parsed_aresample_1 @ 0x7f99fb503ec0] Cannot select channel layout 
>> for the link between filters Parsed_aresample_1 and format_out_0_1.
>
> Share complete command and log.

$ ffmpeg -i ~/Movies/input.wmv -af 
loudnorm=I=-13:TP=-1:measured_I=-9.0:measured_TP=1.5:measured_LRA=9.4:measured_thresh=-19.5:linear=true:print_format=summary,aresample=48000 
-c:v prores -c:a pcm_s16le -f mov output.mov

ffmpeg version 4.0.2 Copyright (c) 2000-2018 the FFmpeg developers
   built with Apple LLVM version 9.1.0 (clang-902.0.39.2)
   configuration: --prefix=/usr/local/Cellar/ffmpeg/4.0.2 
--enable-shared --enable-pthreads --enable-version3 
--enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= 
--host-ldflags= --enable-gpl --enable-libmp3lame --enable-libx264 
--enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
   libavutil      56. 14.100 / 56. 14.100
   libavcodec     58. 18.100 / 58. 18.100
   libavformat    58. 12.100 / 58. 12.100
   libavdevice    58.  3.100 / 58.  3.100
   libavfilter     7. 16.100 /  7. 16.100
   libavresample   4.  0.  0 /  4.  0.  0
   libswscale      5.  1.100 /  5.  1.100
   libswresample   3.  1.100 /  3.  1.100
   libpostproc    55.  1.100 / 55.  1.100
[wmv3 @ 0x7fb7c5806600] Extra data: 8 bits left, value: 20
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, asf, from '/Users/epirat/Movies/input.wmv':
   Metadata:
     SfOriginalFPS   : 299700
     WMFSDKVersion   : 12.0.17134.137
     WMFSDKNeeded    : 0.0.0.0000
     IsVBR           : 0
     DeviceConformanceTemplate: MP@HL
   Duration: 00:04:28.20, start: 0.000000, bitrate: 5446 kb/s
     Stream #0:0(ger): Audio: wmav2 (a[1][0][0] / 0x0161), 48000 Hz, 
stereo, fltp, 192 kb/s
     Stream #0:1(ger): Video: wmv3 (Main) (WMV3 / 0x33564D57), yuv420p, 
1280x720, 6099 kb/s, 29.97 fps, 29.97 tbr, 1k tbn, 1k tbc
[wmv3 @ 0x7fb7c5806c00] Extra data: 8 bits left, value: 20
Stream mapping:
   Stream #0:1 -> #0:0 (wmv3 (native) -> prores (native))
   Stream #0:0 -> #0:1 (wmav2 (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
[prores @ 0x7fb7c5860200] encoding with ProRes standard (apcn) profile
[prores @ 0x7fb7c5891000] encoding with ProRes standard (apcn) profile
[prores @ 0x7fb7c58e2a00] encoding with ProRes standard (apcn) profile
[prores @ 0x7fb7c58d8c00] encoding with ProRes standard (apcn) profile
[prores @ 0x7fb7c5814c00] encoding with ProRes standard (apcn) profile
[Parsed_aresample_1 @ 0x7fb7c540d500] Cannot select channel layout for 
the link between filters Parsed_aresample_1 and format_out_0_1.
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
Conversion failed!

>
> Gyan
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Gyan Aug. 22, 2018, 10:52 a.m. UTC | #7
On 22-08-2018 04:01 PM, Marvin Scholz wrote:

> Guessed Channel Layout for Input Stream #0.0 : stereo
...
>      Stream #0:0(ger): Audio: wmav2 (a[1][0][0] / 0x0161), 48000 Hz, 
> stereo, fltp, 192 kb/s

> [Parsed_aresample_1 @ 0x7fb7c540d500] Cannot select channel layout for 
> the link between filters Parsed_aresample_1 and format_out_0_1.

For this file,

     aresample=48000:ocl=stereo


Gyan
Reino Wijnsma Aug. 23, 2018, 10:38 a.m. UTC | #8
On 22-8-2018 12:52, Gyan Doshi <gyandoshi@gmail.com> wrote:
> On 22-08-2018 04:01 PM, Marvin Scholz wrote:
>> [Parsed_aresample_1 @ 0x7fb7c540d500] Cannot select channel layout for the link between filters Parsed_aresample_1 and format_out_0_1.
> For this file,
>
>     aresample=48000:ocl=stereo
>
>
> Gyan
Related and still unresolved: https://trac.ffmpeg.org/ticket/6638.

-- Reino
diff mbox

Patch

diff --git a/doc/filters.texi b/doc/filters.texi
index 32c95b591c..f082d55d32 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 -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.