[FFmpeg-user] using ebur128 with multiple streams of audio
Dave Rice
dave at dericed.com
Tue Apr 2 07:17:32 CEST 2013
Hi ffmpeg-user,
I have many files with multiple audio streams and would like to analyze all audio streams with ebur128 in a single pass. I can accomplish this with -map, but the output of ebur128 doesn't provide the stream index in the default output.
Here's how to reproduce. Make a file with multiple audio streams. Example:
ffmpeg -f lavfi -i aevalsrc="sin(440*2*PI*t)::s=8000" -f lavfi -i aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)" -f lavfi -i aevalsrc="-2+random(0)" -map 0 -map 1 -map 2 -c:a pcm_s16le -t 1 -y 3_tracks.mov
Then analyze with ebur128 like this:
ffmpeg -i 3_tracks.mov -map 0:a -af ebur128 -f null -
And the output is:
ffmpeg version 1.1.git Copyright (c) 2000-2013 the FFmpeg developers
built on Mar 31 2013 19:26:29 with Apple LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=cc --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid --enable-ffplay --enable-libopenjpeg --extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.1/include/openjpeg-1.5 '
libavutil 52. 24.100 / 52. 24.100
libavcodec 55. 2.100 / 55. 2.100
libavformat 55. 1.100 / 55. 1.100
libavdevice 55. 0.100 / 55. 0.100
libavfilter 3. 48.105 / 3. 48.105
libavresample 1. 1. 0 / 1. 1. 0
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '3_tracks.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf55.1.100
Duration: 00:00:01.02, start: 0.000000, bitrate: 1552 kb/s
Stream #0:0(eng): Audio: pcm_s16le (sowt / 0x74776F73), 8000 Hz, mono, s16, 128 kb/s
Metadata:
handler_name : DataHandler
Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 44100 Hz, mono, s16, 705 kb/s
Metadata:
handler_name : DataHandler
Stream #0:2(eng): Audio: pcm_s16le (sowt / 0x74776F73), 44100 Hz, mono, s16, 705 kb/s
Metadata:
handler_name : DataHandler
Output #0, null, to 'pipe:':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf55.1.100
Stream #0:0(eng): Audio: pcm_s16le, 48000 Hz, mono, s16, 768 kb/s
Metadata:
handler_name : DataHandler
Stream #0:1(eng): Audio: pcm_s16le, 48000 Hz, mono, s16, 768 kb/s
Metadata:
handler_name : DataHandler
Stream #0:2(eng): Audio: pcm_s16le, 48000 Hz, mono, s16, 768 kb/s
Metadata:
handler_name : DataHandler
Stream mapping:
Stream #0:0 -> #0:0 (pcm_s16le -> pcm_s16le)
Stream #0:1 -> #0:1 (pcm_s16le -> pcm_s16le)
Stream #0:2 -> #0:2 (pcm_s16le -> pcm_s16le)
Press [q] to stop, [?] for help
[Parsed_ebur128_0 @ 0x7fc8b8c11ac0] t: 0.0999792 M:-120.7 S:-120.7 I: -70.0 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c15640] t: 0.0999792 M:-120.7 S:-120.7 I: -70.0 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c16500] t: 0.0999792 M:-120.7 S:-120.7 I: -70.0 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c11ac0] t: 0.199979 M:-120.7 S:-120.7 I: -70.0 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c15640] t: 0.199979 M:-120.7 S:-120.7 I: -70.0 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c16500] t: 0.199979 M:-120.7 S:-120.7 I: -70.0 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c11ac0] t: 0.299979 M:-120.7 S:-120.7 I: -70.0 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c15640] t: 0.299979 M:-120.7 S:-120.7 I: -70.0 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c16500] t: 0.299979 M:-120.7 S:-120.7 I: -70.0 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c11ac0] t: 0.399979 M: -3.7 S:-120.7 I: -3.7 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c11ac0] t: 0.499979 M: -3.7 S:-120.7 I: -3.7 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c15640] t: 0.399979 M: -6.3 S:-120.7 I: -6.3 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c16500] t: 0.399979 M: -26.3 S:-120.7 I: -26.3 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c15640] t: 0.499979 M: -6.3 S:-120.7 I: -6.3 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c16500] t: 0.499979 M: -86.7 S:-120.7 I: -26.3 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c11ac0] t: 0.599979 M: -3.7 S:-120.7 I: -3.7 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c15640] t: 0.599979 M: -6.3 S:-120.7 I: -6.3 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c16500] t: 0.599979 M: -86.7 S:-120.7 I: -26.3 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c11ac0] t: 0.699979 M: -3.7 S:-120.7 I: -3.7 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c15640] t: 0.699979 M: -6.3 S:-120.7 I: -6.3 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c16500] t: 0.699979 M: -86.7 S:-120.7 I: -26.3 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c11ac0] t: 0.799979 M: -3.7 S:-120.7 I: -3.7 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c15640] t: 0.799979 M: -6.3 S:-120.7 I: -6.3 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c16500] t: 0.799979 M: -86.7 S:-120.7 I: -26.3 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c15640] t: 0.899979 M: -6.3 S:-120.7 I: -6.3 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c16500] t: 0.899979 M: -86.7 S:-120.7 I: -26.3 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c11ac0] t: 0.899979 M: -3.7 S:-120.7 I: -3.7 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c11ac0] t: 0.999979 M: -3.7 S:-120.7 I: -3.7 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c15640] t: 0.999979 M: -6.3 S:-120.7 I: -6.3 LUFS LRA: 0.0 LU
[Parsed_ebur128_0 @ 0x7fc8b8c16500] t: 0.999979 M: -86.7 S:-120.7 I: -26.3 LUFS LRA: 0.0 LU
size=N/A time=00:00:01.02 bitrate=N/A
video:0kB audio:288kB subtitle:0 global headers:0kB muxing overhead -100.007471%
Summary:
Integrated loudness:
I: -3.7 LUFS
Threshold: -13.7 LUFS
Loudness range:
LRA: 0.0 LU
Threshold: 0.0 LUFS
LRA low: 0.0 LUFS
LRA high: 0.0 LUFS
[Parsed_ebur128_0 @ 0x7fc8b8c15640] Summary:
Integrated loudness:
I: -6.3 LUFS
Threshold: -16.3 LUFS
Loudness range:
LRA: 0.0 LU
Threshold: 0.0 LUFS
LRA low: 0.0 LUFS
LRA high: 0.0 LUFS
[Parsed_ebur128_0 @ 0x7fc8b8c16500] Summary:
Integrated loudness:
I: -26.3 LUFS
Threshold: -36.3 LUFS
Loudness range:
LRA: 0.0 LU
Threshold: 0.0 LUFS
LRA low: 0.0 LUFS
LRA high: 0.0 LUFS
The loudness info is presented for all tracks but none of the data is labeled with a stream index, so this is a parsing challenge. What I'm hoping to derive is something like:
stream=0:0 I=-3.7
stream=0:1 I=-6.3
stream=0:2 I=-26.3
Is there a better way to get there besides counting the input audio streams and then count the occurrences of the integrated loudness summaries and matching them up.
Similary I'd also like to plot the loudness data per stream but the frame reporting lines such as
[Parsed_ebur128_0 @ 0x7fc8b8c11ac0] t: 0.699979 M: -3.7 S:-120.7 I: -3.7 LUFS LRA: 0.0 LU
do not report the stream index either.
Is there an existing way to add stream index data to the output of ebur128? Should I file an enhancement request?
Dave Rice
More information about the ffmpeg-user
mailing list