Last updated on 250115-1111
Copyright © 2014-2022 by Peter Belkner <info@pbelkner.de>This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
BS1770GAIN is a loudness scanner compliant with ITU-R BS.1770 and its flavors EBU R128, ATSC A/85, and ReplayGain 2.0. It helps normalizing the loudness of audio and video files to the same level.
Nanos gigantum humeris insidentes: This project is dedicated to my German heritage. It is strictly to be understood as a statement against the saccarine "sweet" liberal lie of "multiculturalism" which is going to destroy Europe as we know it, in particular against the Merkel regime selling out Europe for nothing as we watch. #WLM
Home: | http://pbelkner.de/projects/web/bs1770gain/ | |
Download: | http://pbelkner.de/projects/files/bs1770gain/bs1770gain/ |
Date | Release | Notes |
---|---|---|
2020-03-16
|
|
|
2025-01-15 | 0.9.7 |
Just recently Tobias Jakobi reported the bug that bs1770gain ended with an error message under
certain circumstances when trying to calculate true peak, i.e. using option -t. Finally we
figured that the resampler used for upsampling was incomplete switched to the new sample format.
After having fixed this, the runtime error was still in place, and Tobias proposed the solution.
Thanks a lot Tobias! |
2024-10-11 | 0.9.4 |
Starting with version 0.9.3-β2 bs1770gain corrects a bug dating back to the
very beginning and to which Orivej pointed us (again). It now issues the correct
values for the relative
loudness. If you insist on the errornous traditional approach run with long option --traditional.Orivej spotted another bug when parsing a time stamp. It is also fixed. Thanks a lot Orivej! |
2024-05-31 | 0.9.2 |
|
2024-05-23 | 0.9.1 | Debian detected a bug by using synthetic test data. Thanks a lot Debian. |
2024-05-20 | 0.9.0 | Finally weve managed to replace FFmpeg's traditional bit-mask based channel layout API by their re-designed one. BS1770GAIN now compiles flawlessly with a decent FFmpeg (without using the HOLZHAMMER). |
2023-06-11 | 0.8.8 |
Unfortunately, with the previous release we introduced a (minor) bug we where hinted to by Debian
(when bs1770gain is called with option -o/--output and without option -a/--apply.)
In file "libbg/bg_muxer.c" former line 377 had to be moved up a few lines to line 371 so that it is guarded by flag "apply". Thanks a lot Debian! |
2023-05-28 | 0.8.7 |
|
2022-12-06 | 0.8.6.2 | Just a binary release build with a decent FFmpeg configured with option --enablelibmp3lame. The source code is untouched. |
2022-12-06 | 0.8.6.1 | Fixes a bug in the muxer used e.g. with option -ao' we where hinted to by Debian. Thanks a lot Debian! |
2022-12-03 | 0.8.6 | Bundles the changes of the latest β releases especially configuration option --enable-xml. |
2022-10 26 | 0.8.5 | Bundles two changes suggested by Debian: |
2022-08-06 | 0.8.4.1 |
This is just a minor update to the 0.8.4-release w.r.t the latest version of the gcc-compiler in order to avoid a warning. It doesn't affect functionalty by any means, it's pure syntactically. On the other hand, unfortunately, it has no influence on what was said w.r.t 0.8.4-β16: bs1770gain is doomed to death. |
2022-05-19 | 0.8.4 | |
2020-08-17 | 0.8.3 |
|
2020-07-26 | 0.8.2 |
This is a maintenence release affecting mostly the Windows builds:
|
2020-07-10 | 0.8.1 |
Jointly with AdRY the following was achieved:
|
2020-06-24 | 0.8.0 |
|
2020-05-29 | 0.7.0 | Essentially the same as 0.7.0-β4. |
2020-05-11 | 0.7.0-β4 |
|
2020-05-06 | 0.7.0-β3 | Fixed some synchronization issues. |
2020-05-06 | 0.7.0-β2 |
|
2020-04-29 | 0.6.9 | Hadrien proposed that bs1770gain should offer an option like --quiet supressing any output except error messages. Here we go! |
2020-04-29 | 0.6.8 | Hadrien pointed us to the issue that under certain conditions option --overwrite was broken and was sending in a respective patch. Thanks a lot Hadrien! |
2020-03-10 | 0.6.7 |
|
2019-12-13 | 0.6.6 | Austin pointed us to the issue that aggregation was broken. Thanks a lot Austin! |
2019-12-21 |
9/11 and
"War on Terror":
|
|
2019-12-10 |
DOJ/AG
William Barr
(track two of two concurrent):
|
|
2019-11-22 |
Impeachment circus (track one of two concurrent ‐ viva la "resistence"!):
|
|
2019-12-13 |
Brexit:
|
|
2019-10-03 | 0.6.5 | Tobias pointed us to the issue that peak calcualion had an upper bound at some odd 1.000031 and in a lot of cases true peak calculation doesn't reproduced the values known from pre-0.6.0 even if lower then magic 1.000031. Thanks a lot Tobias! |
2019-09-29 | 0.6.4 |
|
2019-09-20 | 0.6.3 | For technical reasons the same as v0.6.2 (except some more minor improvements.) |
2019-09-20 | 0.6.2 | Essentially the same as v0.6.2-β4 (except some minor code clean-up.) |
2019-09-19 | 0.6.2-β4 |
Unfortunately, the Invalid write bug was just fixed on the surface,
i.e. it doesn't appear any longer just in the most simplest cases.
Below the surface there was a deeper reason:
|
2019-09-17 | 0.6.2-β3 | Fixed two other instances of the Invalid write bug and a Conditional jump or move depends on uninitialised value(s) bug (thanks again Debian.) |
2019-09-17 | 0.6.2-β2 |
|
2019-09-15 | 0.6.2-β1 | Restored option --time. |
2019-09-14 |
|
|
2019-09-12 | 0.6.1 |
|
2019-09-05 | 0.6.0 |
|
2019-08-13 | 0.6.0-β34 |
|
2019-08-13 | 0.6.0-β33 |
Just out of curiosity this morning we again made the experiment described
below and found it crashing with "Segmentation
fault" when attempting to dynamically load the FFmpeg shared
objects by means of a libc with a version lower than the one on the
system bs1770gain was compiled on. Hence in such a situation
bs1770gain now aborts immediatly:
peter@debian-9:~/msys2/bs1770gain$ ./linux/debian-10-i686/bs1770gain --version --help=codec |
2019-08-12 | 0.6.0-β32 |
|
2019-08-11 | 0.6.0-β30 |
|
2019-07-13 | 0.6.0-β25 |
|
2019-07-07 | 0.6.0-β24 | Purged off several (meanwhile) inactive code branches. Might be considered a release candidate. |
2019-07-04 | 0.6.0-β23 | Seeking (needed for implementing option -b/--begin) still wasn't in the shape it should be. We now follow the advice given here. |
2019-06-29 | 0.6.0-β22 | Improved seeking (update 2019-06-30: needed for implementing option -b/--begin.) |
2019-06-28 | 0.6.0-β21 |
|
2019-06-27 |
|
|
2019-06-27 | 0.6.0-β20 |
|
2019-06-26 |
0.6.0-β17
through 0.6.0-β19 |
|
2019-06-24 |
0.6.0-β14
through 0.6.0-β16 |
|
2019-06-19 | Hopefully the days of Merkel's tyranny are counted: Merkel shakes uncontrollably during military parade. | |
2019-06-14 | 0.6.0-β13 | When transcoding/remuxing bs1770gain v0.6.0-β13 first creates a temporary file before finally moving it to its destination. By default, the temporary file's name is the target file's name prefixed with a dot ‘.’. When it happens that there is a file in the way with that particular name bs1770gain aborts. In order to make it possible to resolve this (we assume very rare) situation bs1770gain offers an option --temp-prefix=<prefix> making it possible to define a prefix different from the default. |
2019-06-12 |
0.6.0-β11
through 0.6.0-β12 |
Dealing with option --overwrite still wasn't in the shape it should be. |
2019-06-11 | 0.6.0-β10 | Fixed crashing with option --overwrite. |
2019-06-11 | 0.6.0-β9 | Diimaan pointed us to a severe bug when re-muxing without transcoding, i.e. using option -o without option -a. Thanks a lot Diimaan! |
2019-06-10 |
0.6.0-β4
through 0.6.0-β8 |
Jointly with Alexis made bs1770gain compilable on macOS (i.e. with gcc 10.0.1 whereas on our site just gcc 6.3.0 or gcc 9.1.0 is available.) Thanks a lot Alexis! |
2019-06-10 | 0.6.0-β3 |
This β-release should fix the following:
|
2019-06-06 | 0.6.0-β2 | Fixes a bug with re-muxing to an unexpected target path when the source path contains one ore more additional dots ‘.’ except the separator for the file extension. Thanks a lot Hadrien for testing! |
2019-06-06 | 0.6.0-β1 |
This β-version is the first attempt letting see a renovated bs1770gain the light of the world:
|
2019-06-06 |
(C) by Dr. Ludwig (C) by Dr. Ludwig (C) by Ratatoskr (C) by Dr. Ludwig (C) by Dr. Ludwig (the Palästinalied is by Walther von der Vogelweide, ca. 1170 – ca. 1230, cf. also Wikipdia's entry regarding the Palästinalied) |
|
2019-04-04 |
|
|
2019-01-23 | 0.5.2 | Released in order to make it into Debian 10 'buster'. Essentially the same as v0.5.2-β3. |
2019-01-23 | 0.5.2-β3 | By the previous β-release we fixed a bug w.r.t. the MP3 codec we've already fixed by v0.5.0-β2 w.r.t. the OPUS codec. This β-release generalizes the approach. |
2019-01-23 | 0.5.2-β2 | Aimed to fix bug #910451. |
2018-10-26 | 0.5.2-β1 |
|
2018-10-19 | 0.5.1 | Brought back to life building the project with autotools. |
2018-09-02 | 0.5.0 | |
2018-09-01 | We're aware that we're not the world's most gifted software developer. Anyway, we feel that we belong to #TeamWhite and hence added the respective hashtag to the above note. | |
2018-08-11 | 0.5.0-β5 |
|
2018-08-09 | 0.5.0-β4 |
|
2018-08-05 | 0.5.0-β3 | |
2018-08-02 | 0.5.0-β2 |
|
2018-07-29 | 0.5.0-β1 |
|
2017-01-10 | Added a political statement to the top of this page. | |
2016-12-08 | 0.4.12 | Added UTF-16 support to the Windows Console. Linux should not be affected and should have been worked all the time because being based on UTF-8. This development was triggered by Seongkyun (Andrei) Kim who is located in Korea and provided some testing. |
2016-12-06 | Thanks to Seongkyun (Andrei) Kim there is an introduction to bs1770gain in Korean language available at http://blog.naver.com/eqmaker/220879120285 and a manual at http://www.eqmaker.kr/public/BS1770GAIN_Manual_KOR-20161206.pdf. | |
2016-11-10 | To all you great people out there in the US: Thank you for electing Donald Trump! | |
2016-08-13 | 0.4.11 |
Just recently a very talented guy who calls himself kevinlekiller
(https://github.com/kevinlekiller/)
approached me with a bunch of bugs he obviously had learned the hard way
by using the tool (i.e. by not artificially testing it). But not just
that, he also proposed a solution for each of the bugs:
https://gist.github.com/kevinlekiller/62730fa5ddcf791107a723b1f235773e. This release mainly consists of his contributions.
|
2016-07-18 | 0.4.10 | Fixed writing xml escaped strings with the --xml option. Please note that bs1770gain is not officially supported on OSX even if it seems to build on OSX platforms and that it hence don&t take into account unicode mapping anomalies between OSX and Linux/Windows (NFD/NFC). It will always output the unicode dialect common on the platform and hence the generated XML is not portable between OSX and Linux/Windows. |
2016-03-16 | 0.4.9 | |
2015-12-19 | 0.4.8 |
|
2015-09-15 | 0.4.7 | Fixed a serious bug regarding the -r option. |
2015-09-12 | 0.4.6 |
|
2015-06-25 | 0.4.5 | Various fixes mainly to make BS1770GAIN compile on various architectures. |
2015-06-22 | 0.4.4 |
|
2015-06-15 | 0.4.3 |
|
2015-06-08 | 0.4.2 | Fixed memory leaks. |
2015-01-29 | 0.4.1 | Several fixes. |
2015-01-14 | 0.4.0 |
|
2015-01-08 | 0.3.2 |
|
2014-12-30 | 0.3.1 | Minor fixes. |
2014-12-23 | 0.3.0 | Finite state machine for remuxing/transcoding. |
2014-12-11 | 0.2.1 |
|
2014-12-07 | 0.2.0 | Added experimental options. |
2014-12-04 | 0.1.1 |
|
2014-12-01 | 0.1.0 | Initial release. |
Audio from different sources can be expected to be different loud and it would be nice to automatically adapt all these audio sources to the same loudness. Fortunately the ITU-R in their BS.1770 standard defines an algorithm which makes it possible to measure the loudness of a certain audio source. Based on the ITU-R BS.1770 measure several standards bodys defined what they think is the preferred loudness audio should normalize to, notably
The integrated loudness is the two phase gated measurement of the mean loudness as described by ITU-R BS.1770. All measures are described in detail by EBU R128.
On top of that BS1770GAIN provides to additional measures not related to loudness:
Besides measuring the loudness BS1770GAIN is also able to adapt it conformant with the above mentioned statndards. There are two ways to achieve this:
Following we describe in more detail how BS1770GAIN has to be customized.
In the simplest case we want to analyze the (integrated) loudness of a track or, a bit more general, an album. Assuming the album is stored in some folder (in the following examples the folder is "~/2012_live_at_the_georgia_theatre") we may issue the following command:
Immediatly BS1770GAIN gives us the (integrated) loudness of each track as well as of the whole album.$ bs1770gain ~/2012_live_at_the_georgia_theatre /home/home/2012_live_at_the_georgia_theatre analyzing "2012_live_at_the_georgia_theatre" ... [1/3] "01_intro_like_i_am.mkv": integrated: -16.2 LUFS / -6.8 LU [2/3] "02_good_one_coming_on.mkv": integrated: -15.9 LUFS / -7.1 LU [3/3] "03_up_in_smoke.mkv": integrated: -15.6 LUFS / -7.4 LU [ALBUM]: integrated: -15.9 LUFS / -7.1 LU done.
The figure behind the slash is the gain one has to apply in order to achieve a certain loudness. Which loudness to choose depends on the users preferences and there are several standards to choose from, noatbly EBU R128, ATSC A/85, and ReplayGain 2.0 (cf. above). BS1770GAIN silently assumes EBU R128. If we want to alter this we have to utilize the --atsc or --replaygain options, respectively. For example, if we want to normalize to ATSC A/85 we have to issue the command
$ bs1770gain ~/2012_live_at_the_georgia_theatre --atsc /home/home/2012_live_at_the_georgia_theatre analyzing "2012_live_at_the_georgia_theatre" ... [1/3] "01_intro_like_i_am.mkv": integrated: -16.2 LUFS / -7.8 LU [2/3] "02_good_one_coming_on.mkv": integrated: -15.9 LUFS / -8.1 LU [3/3] "03_up_in_smoke.mkv": integrated: -15.6 LUFS / -8.4 LU [ALBUM]: integrated: -15.9 LUFS / -8.1 LU done.
You may request XML output by means of the --xml option:
$ bs1770gain ~/2012_live_at_the_georgia_theatre --xml <bs1770gain> <album folder="2012_live_at_the_georgia_theatre"> <track total="3" number="1" file="01_intro_like_i_am.mkv"> <integrated lufs="-16.2" lu="-6.8" /> </track> <track total="3" number="2" file="02_good_one_coming_on.mkv"> <integrated lufs="-15.9" lu="-7.1" /> </track> <track total="3" number="3" file="03_up_in_smoke.mkv"> <integrated lufs="-15.6" lu="-7.4" /> </track> <summary total="3"> <integrated lufs="-15.9" lu="-7.1" /> </summary> </album> </bs1770gain>
In general, if we want to analyze properties out of intergrated loudness, maximum shortterm loudness, maximum momentary loudness, loudness range, maximum sample peak, or maximum true peak we have to choose the appropriate command line switches out of -i/--integrated, -s/--shortterm, -m/--momentary, -r/--range, -p/--samplepeak, and -t/--truepeak, respectivley. Assuming we&re interested in all of these properties at once we have to issue following command:
$ bs1770gain ~/2012_live_at_the_georgia_theatre -ismrpt /home/home/2012_live_at_the_georgia_theatre analyzing "2012_live_at_the_georgia_theatre" ... [1/3] "01_intro_like_i_am.mkv": integrated: -16.2 LUFS / -6.8 LU shortterm: -12.3 LUFS / -10.7 LU momentary: -12.3 LUFS / -10.7 LU range: 4.9 LUFS sample peak: -2.2 SPFS / 0.772912 true peak: -2.2 TPFS / 0.774780 [2/3] "02_good_one_coming_on.mkv": integrated: -15.9 LUFS / -7.1 LU shortterm: -12.0 LUFS / -11.0 LU momentary: -12.0 LUFS / -11.0 LU range: 5.9 LUFS sample peak: -2.9 SPFS / 0.714886 true peak: -2.9 TPFS / 0.714886 [3/3] "03_up_in_smoke.mkv": integrated: -15.6 LUFS / -7.4 LU shortterm: -12.3 LUFS / -10.7 LU momentary: -12.3 LUFS / -10.7 LU range: 5.4 LUFS sample peak: -2.8 SPFS / 0.726805 true peak: -2.8 TPFS / 0.726805 [ALBUM]: integrated: -15.9 LUFS / -7.1 LU shortterm: -12.0 LUFS / -11.0 LU momentary: -12.0 LUFS / -11.0 LU range: 5.3 LUFS sample peak: -2.2 SPFS / 0.772912 true peak: -2.2 TPFS / 0.774780 done.
If we want to analyze just a short part of the files (say starting at 1 minute and lasting 30 seconds) we may issue the following command utilizing the -b/--begin and -d/--duration options:
$ bs1770gain ~/2012_live_at_the_georgia_theatre -b 1:00 -d 30 /home/home/2012_live_at_the_georgia_theatre analyzing "2012_live_at_the_georgia_theatre" ... [1/3] "01_intro_like_i_am.mkv": integrated: -17.0 LUFS / -6.0 LU [2/3] "02_good_one_coming_on.mkv": integrated: -15.4 LUFS / -7.6 LU [3/3] "03_up_in_smoke.mkv": integrated: -16.0 LUFS / -7.0 LU [ALBUM]: integrated: -16.1 LUFS / -6.9 LU done.
With the help of BS1770GAIN we can adjust the loudness on the fly. There are two ways to achieve this:
In each case we have to instruct BS1770GAIN where to write the output files by means of the -o/--output switch which has to point to the output folder. If we want BS1770GAIN to really apply the gain and not just to write tags to the files we also have to supply the -a/--apply switch. Two examples follow in order to illustrate this.
The first example shows how to just write REPLAYGAIN tags to the output files. In this case we only have to supply the -o/--output switch:
$ bs1770gain ~/2012_live_at_the_georgia_theatre -o ./test /home/home/number-3/2012_live_at_the_georgia_theatre analyzing "2012_live_at_the_georgia_theatre" ... [1/3] "01_intro_like_i_am.mkv": integrated: -16.2 LUFS / -6.8 LU [2/3] "02_good_one_coming_on.mkv": integrated: -15.9 LUFS / -7.1 LU [3/3] "03_up_in_smoke.mkv": integrated: -15.6 LUFS / -7.4 LU [ALBUM]: integrated: -15.9 LUFS / -7.1 LU remuxing "2012_live_at_the_georgia_theatre" ... [1/3] "01_intro_like_i_am.mkv" ... done. [2/3] "02_good_one_coming_on.mkv" ... done. [3/3] "03_up_in_smoke.mkv" ... done. done.
We can convince ourselves that there are indeed REPLAYGAIN tags written to the files and that the video and the audio streams are not altered. To that means we make use of the -l/--list switch:
The second example deals with really applying the gain. For that order we not only have to supply the -o/--output switch but also the -a/--apply switch:$ bs1770gain ./test/2012_live_at_the_georgia_theatre -l ./test/2012_live_at_the_georgia_theatre Input #0, matroska,webm, from &./test/2012_live_at_the_georgia_theatre/01_intro_like_i_am.mkv&: Metadata: title : Intro / Like I Am REPLAYGAIN_TRACK_GAIN: -6.81 LU CREATION_TIME : 2013-02-09 13:41:04 ARTIST : Blackberry Smoke ALBUM : Live At The Georgia Theatre YEAR : 2012 DISC : 1/1 track : 1 GENRE : Rock REPLAYGAIN_ALBUM_GAIN: -7.05 LU REPLAYGAIN_ALGORITHM: ITU-R BS.1770 REPLAYGAIN_REFERENCE_LOUDNESS: -23.00 ENCODER : Lavf56.15.101 Duration: 00:05:15.36, start: 0.033000, bitrate: 7516 kb/s Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, smpte170m), 720x480 [SAR 32:27 DAR 16:9], max. 8700 kb/s, SAR 186:157 DAR 279:157, 59.94 fps, 59.94 tbr, 1k tbn, 59.94 tbc (default) Stream #0:1: Audio: ac3, 48000 Hz, stereo, fltp, 448 kb/s (default) Input #0, matroska,webm, from &./test/2012_live_at_the_georgia_theatre/02_good_one_coming_on.mkv&: Metadata: title : Good One Coming On REPLAYGAIN_TRACK_GAIN: -7.05 LU CREATION_TIME : 2013-02-09 13:46:45 ARTIST : Blackberry Smoke ALBUM : Live At The Georgia Theatre YEAR : 2012 DISC : 1/1 track : 2 GENRE : Rock REPLAYGAIN_ALBUM_GAIN: -7.05 LU REPLAYGAIN_ALGORITHM: ITU-R BS.1770 REPLAYGAIN_REFERENCE_LOUDNESS: -23.00 ENCODER : Lavf56.15.101 Duration: 00:03:37.27, start: 0.033000, bitrate: 7741 kb/s Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, smpte170m), 720x480 [SAR 32:27 DAR 16:9], max. 8700 kb/s, SAR 186:157 DAR 279:157, 59.94 fps, 59.94 tbr, 1k tbn, 59.94 tbc (default) Stream #0:1: Audio: ac3, 48000 Hz, stereo, fltp, 448 kb/s (default) Input #0, matroska,webm, from &./test/2012_live_at_the_georgia_theatre/03_up_in_smoke.mkv&: Metadata: title : Up In Smoke REPLAYGAIN_TRACK_GAIN: -7.37 LU CREATION_TIME : 2013-02-09 10:09:16 ARTIST : Blackberry Smoke ALBUM : Live At The Georgia Theatre YEAR : 2012 DISC : 1/1 track : 3 GENRE : Rock REPLAYGAIN_ALBUM_GAIN: -7.05 LU REPLAYGAIN_ALGORITHM: ITU-R BS.1770 REPLAYGAIN_REFERENCE_LOUDNESS: -23.00 ENCODER : Lavf56.15.101 Duration: 00:03:33.77, start: 0.033000, bitrate: 8151 kb/s Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, smpte170m), 720x480 [SAR 32:27 DAR 16:9], max. 8700 kb/s, SAR 186:157 DAR 279:157, 59.94 fps, 59.94 tbr, 1k tbn, 59.94 tbc (default) Stream #0:1: Audio: ac3, 48000 Hz, stereo, fltp, 448 kb/s (default)
$ bs1770gain ~/2012_live_at_the_georgia_theatre -ao ./test /home/home/number-3/2012_live_at_the_georgia_theatre analyzing "2012_live_at_the_georgia_theatre" ... [1/3] "01_intro_like_i_am.mkv": integrated: -16.2 LUFS / -6.8 LU [2/3] "02_good_one_coming_on.mkv": integrated: -15.9 LUFS / -7.1 LU [3/3] "03_up_in_smoke.mkv": integrated: -15.6 LUFS / -7.4 LU [ALBUM]: integrated: -15.9 LUFS / -7.1 LU transcoding "2012_live_at_the_georgia_theatre" ... [1/3] "01_intro_like_i_am.mkv" ... done. [2/3] "02_good_one_coming_on.mkv" ... done. [3/3] "03_up_in_smoke.mkv" ... done. done.
An obvious difference to the previous example is that BS1770GAIN now uses the term transcoding instead of remuxing. The reason for that is that the streams are now altered and no REPLAYGAIN-tags appear if we make the contents of the transcoded files visible by means of the -l/--list switch:
$ bs1770gain ./test/2012_live_at_the_georgia_theatre -l ./test/2012_live_at_the_georgia_theatre Input #0, matroska,webm, from &./test/2012_live_at_the_georgia_theatre/01_intro_like_i_am.mkv&: Metadata: title : Intro / Like I Am GENRE : Rock CREATION_TIME : 2013-02-09 13:41:04 ARTIST : Blackberry Smoke ALBUM : Live At The Georgia Theatre YEAR : 2012 DISC : 1/1 track : 1 ENCODER : Lavf56.15.101 Duration: 00:05:16.87, start: 0.033000, bitrate: 8626 kb/s Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, smpte170m), 720x480 [SAR 32:27 DAR 16:9], max. 8700 kb/s, SAR 186:157 DAR 279:157, 59.94 fps, 59.94 tbr, 1k tbn, 59.94 tbc (default) Stream #0:1: Audio: flac, 48000 Hz, stereo, s32 (24 bit) (default) Input #0, matroska,webm, from &./test/2012_live_at_the_georgia_theatre/02_good_one_coming_on.mkv&: Metadata: title : Good One Coming On GENRE : Rock CREATION_TIME : 2013-02-09 13:46:45 ARTIST : Blackberry Smoke ALBUM : Live At The Georgia Theatre YEAR : 2012 DISC : 1/1 track : 2 ENCODER : Lavf56.15.101 Duration: 00:03:38.77, start: 0.033000, bitrate: 8827 kb/s Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, smpte170m), 720x480 [SAR 32:27 DAR 16:9], max. 8700 kb/s, SAR 186:157 DAR 279:157, 59.94 fps, 59.94 tbr, 1k tbn, 59.94 tbc (default) Stream #0:1: Audio: flac, 48000 Hz, stereo, s32 (24 bit) (default) Input #0, matroska,webm, from &./test/2012_live_at_the_georgia_theatre/03_up_in_smoke.mkv&: Metadata: title : Up In Smoke GENRE : Rock CREATION_TIME : 2013-02-09 10:09:16 ARTIST : Blackberry Smoke ALBUM : Live At The Georgia Theatre YEAR : 2012 DISC : 1/1 track : 3 ENCODER : Lavf56.15.101 Duration: 00:03:35.27, start: 0.033000, bitrate: 9266 kb/s Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, smpte170m), 720x480 [SAR 32:27 DAR 16:9], max. 8700 kb/s, SAR 186:157 DAR 279:157, 59.94 fps, 59.94 tbr, 1k tbn, 59.94 tbc (default) Stream #0:1: Audio: flac, 48000 Hz, stereo, s32 (24 bit) (default)
The most important observation is that the audio stream now is a 24 bit FLAC and no longer an AC3.
It may happen that it is not appropriate to base the gain on the measurement of the integrated loudness but insteed on the maximum shorterm loudness or on the maximum momentary loudness. For that means there is the -u/--use switch which has to be supplied with the method to use, i.e. integrated, shorterm, or momentary. The following illustrates this:
$ bs1770gain ~/2012_live_at_the_georgia_theatre -o ./test -u shortterm /home/home/number-3/2012_live_at_the_georgia_theatre analyzing "2012_live_at_the_georgia_theatre" ... [1/3] "01_intro_like_i_am.mkv": shortterm: -12.3 LUFS / -10.7 LU [2/3] "02_good_one_coming_on.mkv": shortterm: -12.0 LUFS / -11.0 LU [3/3] "03_up_in_smoke.mkv": shortterm: -12.3 LUFS / -10.7 LU [ALBUM]: shortterm: -12.0 LUFS / -11.0 LU remuxing "2012_live_at_the_georgia_theatre" ... [1/3] "01_intro_like_i_am.mkv" ... done. [2/3] "02_good_one_coming_on.mkv" ... done. [3/3] "03_up_in_smoke.mkv" ... done. done.
We can imagine the ITU-R BS.1770 measurement device as a blackbox where time after time portions of the audio with the same length
The measurement device does some sophisticated calculation on the audio blocks currently inside with the loudness as the result. We don&t want to go into all the details here but it should be clear that the result depends at least on the following:
The momentary device has the following properties:
This gives rise to a variety of possible parameters if one takes into account that it is possible to customize measurement devices themselfs (cf. "experimental options" under "command line syntax" below).
Finally we give an example on how to RG tag with the non-standard measure shortterm mean loudness:
$ ./bs1770gain ~/2012_live_at_the_georgia_theatre -o ./test -u shortterm-mean /home/home/2012_live_at_the_georgia_theatre analyzing "2012_live_at_the_georgia_theatre" ... [1/3] "01_intro_like_i_am.mkv": shortterm mean: -16.2 LUFS / -6.8 LU [2/3] "02_good_one_coming_on.mkv": shortterm mean: -16.0 LUFS / -7.0 LU [3/3] "03_up_in_smoke.mkv": shortterm mean: -15.6 LUFS / -7.4 LU [ALBUM]: shortterm mean: -16.0 LUFS / -7.0 LU remuxing "2012_live_at_the_georgia_theatre" ... [1/3] "01_intro_like_i_am.mkv" ... done. [2/3] "02_good_one_coming_on.mkv" ... done. [3/3] "03_up_in_smoke.mkv" ... done. done.
root@root-pc MINGW32 ~/bs1770gain # bs1770gain -h bs1770gain.exe 0.6.7, Copyright (C) Peter Belkner 2014-2020. Nanos gigantum humeris insidentes. #TeamWhite http://bs1770gain.sourceforge.net/ Compiled for Windows 32 bit by means of gcc 9.2.0 on Windows 6.1.7601 (Service Pack 1) expecting libavutil: 56.42.100, libswresample: 3.6.100, libavcodec: 58.74.100, libavformat: 58.41.100, libswscale: 5.6.100, libpostproc: 55.6.100, and libavfilter: 7.77.100. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Usage: bs1770gain.exe [options] <file/dir> [<file/dir> ...] Options: -v,--version: print this message and exit -h,--help[=<topic>]?: print this message and exit (optional argument <topic> out of "codec" or "suffix") -i,--integrated: calculate integrated loudness -s,--shortterm: calculate maximum shortterm loudness -m,--momentary: calculate maximum momentary loudness -r,--range: calculate loudness range -p,--sample-peak: calculate maximum sample peak -t,--true-peak: calculate maximum true peak -b <timestamp>,--begin=<timestamp>: begin decoding at timestamp (in microseconds, format: hh:mm:ss.ms) -d <duration>,--duration=<duration>: let decoding last duration (in microseconds, format: hh:mm:ss.ms) -u <method>,--use=<method>: base replaygain calculation on <method> (with respect to the -a/--apply and -o/--output options. available methods: integrated (default), momentary, or shortterm experimental methods: momentary-mean (synonym for "integrated"), momentary-maximum (synonym for "momentary"), shortterm-mean, or shortterm-maximum (synonym for "shortterm") -a [<weight>]/--apply[=<weight>]: apply the EBU/ATSC/RG album gain (in conjunction with the -o/--output option.) when <weight> out of [0.0 .. 1.0] is provided: album gain plus <weight>*(track gain - album gain). -o <folder>,--output=<folder>: write replaygain tags or apply the EBU/ATSC/RG gain, respectively, and output to <folder>. specify either option -o/--output or option --overwrite but not both. -f <file>,--file=<file>: write analysis to an utf-8 log file --utf-16[=<file>]: write an utf-16 log file instead of an utf-8 log file (<file> can be omitted when provided by means of the -f/--file option.) --ebu: calculate replay gain according to EBU R128 (-23.0 LUFS, default) --atsc: calculate replay gain according to ATSC A/85 (-24.0 LUFS) --replaygain: calculate replay gain according to ReplayGain 2.0 (-18.0 LUFS) --track-tags: write track tags --album-tags: write album tags --tag-prefix=<prefix>: instead of "REPLAYGAIN", use <prefix> as replaygain tag prefix --unit=<unit>: write results and tags with <unit> out of "ebu" or "db" --audio=<index>/--ai=<index>: select audio index (corresponds to [0:<index>] in FFmpeg listing, cf. -l/--list option) --video=<index>/--vi=<index>: select video index (corresponds to [0:<index>] in FFmpeg listing, cf. -l/--list option) --matrix:<matrix>: remix to <matrix> out of front-left, front-right, front-center, low-frequency, back-left, back-right, front-left-of-center, front-right-of-center, back-center, side-left, side-right, top-center, top-front-left, top-front-center, top-front-right, top-back-left, top-back-center, top-back-right, stereo-left, stereo-right, wide-left, wide-right, surround-direct-left, surround-direct-right, low-frequency-2, layout-mono, layout-stereo, layout-2point1, layout-2-1, layout-surround, layout-3point1, layout-4point0, layout-4point1, layout-2-2, layout-quad, layout-5point0, layout-5point1, layout-5point0-back, layout-5point1-back, layout-6point0, layout-6point0-front, layout-hexagonal, layout-6point1, layout-6point1-back, layout-6point1-front, layout-7point0, layout-7point0-front, layout-7point1, layout-7point1-wide, layout-7point1-wide-back, layout-octagonal, layout-hexadecagonal, or layout-stereo-downmix --stereo: shorthand for --matrix=layout-stereo --drc=<float>: set AC3 dynamic range compression (DRC) -x [<extension>]?, --extension[=<extension>]?: enable extension out of rename: rename files according to TITLE tag csv: read metadata from per-folder CSV file "folder.csv" copy: copy non-audio files from source to destination folder tags: automatically add the TRACK and DISC tags all: all of the above (can be omitted) --suffix=<suffix>: output to <basename>.<suffix> (only useful in conjunction with option -o/--output) --loglevel=<level>: set FFmpeg loglevel to <level> out of quiet, panic, fatal, error, warning, info, verbose, debug, or trace --xml: print results in xml format --time: print out duration of program invocation --norm=<float>: norm loudness to float. --overwrite: replace any source file by its respective target file. specify either option -o/--output or option --overwrite but not both. WARNING: use this option with extrem care. The source files will definitely be lost!!! For this reason using this option is discouraged. It's provided just for completeness. --codec=<name>: use audio codec "<name>" for output default: "flac".) --temp-prefix=<prefix>: create temporary files with prefix "<prefix>" default: ".".) --suppress-hierarchy: suppress printing results up the hierarchy. --suppress-progess: suppress printing processing progress Experimental options: 1) momentary block --momentary-mean: calculate mean loudness based on momentary block (same as --integrated) --momentary-maximum: calculate maximum loudness based on momentary block (same as --momentary) --momentary-range: calculate loudness range based on momentary block --momentary-length=<ms>: length of momentary block in milliseconds (default: 400) --momentary-overlap=<percent>: overlap of momentary block in percent (default: 75) --momentary-mean-gate=<gate>: silence gate for mean measurement of momentary block (default: -10.0) --momentary-range-gate=<gate>: silence gate for range measurement of momentary block (default: -20.0) --momentary-range-lower-bound=<float>: lower bound for range measurement of momentary block (default: 0.1) --momentary-range-upper-bound=<float>: upper bound for range measurement of momentary block (default: 0.95) 2) shortterm block --shortterm-mean: calculate mean loudness based on shortterm block --shortterm-maximum: calculate maximum loudness based on shortterm block (same as --shortterm) --shortterm-range: calculate loudness range based on shortterm block (same as --range) --shortterm-length=<ms>: length of shortterm block in milliseconds (default: 3000) --shortterm-overlap <percent>: overlap of shortterm block in percent (default: 67) --shortterm-mean-gate=<gate>: silence gate for mean measurement of shortterm block (default: -10.0) --shortterm-range-gate=<gate>: silence gate for range measurement of shortterm block (default: -20.0) --shortterm-range-lower-bound=<float>: lower bound for range measurement of shortterm block (default: 0.1) --shortterm-range-upper-bound=<float>: upper bound for range measurement of shortterm block (default: 0.95) Command line arguments may appear in any order. root@root-pc MINGW32 ~/bs1770gain # _
Results for the EBU R128 test vector:
root@root-pc MINGW32 ~/bs1770gain # bs1770gain ./ebu-loudness-test-setv03/*3341*.wav scanning 9 analyzing ... [1/9] seq-3341-1-16bit.wav integrated (momentary mean): -22.96 LUFS / -0.04 LU [2/9] seq-3341-2011-8_seq-3342-6-24bit-v02.wav integrated (momentary mean): -23.00 LUFS / 0.00 LU [3/9] seq-3341-2-16bit.wav integrated (momentary mean): -32.96 LUFS / 9.96 LU [4/9] seq-3341-3-16bit-v02.wav integrated (momentary mean): -23.02 LUFS / 0.02 LU [5/9] seq-3341-4-16bit-v02.wav integrated (momentary mean): -23.02 LUFS / 0.02 LU [6/9] seq-3341-5-16bit-v02.wav integrated (momentary mean): -22.99 LUFS / -0.01 LU [7/9] seq-3341-6-5channels-16bit.wav integrated (momentary mean): -23.02 LUFS / 0.02 LU [8/9] seq-3341-6-6channels-WAVEEX-16bit.wav integrated (momentary mean): -23.02 LUFS / 0.02 LU [9/9] seq-3341-7_seq-3342-5-24bit.wav integrated (momentary mean): -22.99 LUFS / -0.01 LU [COLLECTION] integrated (momentary mean): -23.16 LUFS / 0.16 LU done. root@root-pc MINGW32 ~/bs1770gain # _
root@root-pc MINGW32 ~/bs1770gain # bs1770gain ./ebu-loudness-test-setv03/*3342*.wav -r scanning 6 analyzing ... [1/6] seq-3341-2011-8_seq-3342-6-24bit-v02.wav integrated (momentary mean): -23.00 LUFS / 0.00 LU (shortterm) loudness range: 15.25 LRA [2/6] seq-3341-7_seq-3342-5-24bit.wav integrated (momentary mean): -22.99 LUFS / -0.01 LU (shortterm) loudness range: 4.82 LRA [3/6] seq-3342-1-16bit.wav integrated (momentary mean): -22.60 LUFS / -0.40 LU (shortterm) loudness range: 10.00 LRA [4/6] seq-3342-2-16bit.wav integrated (momentary mean): -16.82 LUFS / -6.18 LU (shortterm) loudness range: 5.00 LRA [5/6] seq-3342-3-16bit.wav integrated (momentary mean): -20.03 LUFS / -2.97 LU (shortterm) loudness range: 19.99 LRA [6/6] seq-3342-4-16bit.wav integrated (momentary mean): -24.50 LUFS / 1.50 LU (shortterm) loudness range: 15.00 LRA [COLLECTION] integrated (momentary mean): -21.18 LUFS / -1.82 LU (shortterm) loudness range: 16.46 LRA done. root@root-pc MINGW32 ~/bs1770gain # _