BS1770GAIN

Last updated on 230611-0935

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/

Content

  1. News
  2. Introduction
  3. Usage
  4. Command Line Syntax
  5. Test Cases

1. News

'
Date Release Notes
2020-03-16
pinned
 
  • Because we’ve the impression that bs1770gain has been dropped from all (tracked) Linux repositories (except Chocolatey which btw is not a Linux repository) we’ve decided to move Packaging Status from this main page to a secondary page. − 2020-05-05: openSUSE Tumbleweed is breaking out from the boycott (“lockdown”.) − 2020-10-22: As far as we can see, videohelp.org seems to be the only re-distributor still re-distributing us even from our new home.
  • Cf. e.g. Removal of bs1770gain from repo:

    • Package contains right-extremist views in project changelog and as string in package
    • Discussed in https://github.com/termux/termux-packages/issues/4455
    • bs1770gain is not widely downloaded, but enhances the python package beets. There are so far no available replacement packages that work with beets

     
  • On some beets related mailing list you might read
     
    What does this guy wants to tell us by stating "I am Terran, born in Germany by pure chance"? The only thing that makes some kind of sense to us is reading it as
    Have mercy! Even if born in Germany I'm not a German, not an evil evil Naaaaazi just like this Racist. Mercy, mercy! I'm a proud Terran!
    Such people are obviously sick. Unfortunately, in Germany 80%−90% of the people are affected by folie à deux (due to 75 years of post WWII re-education) and locked into self-hatred.

  • 2020-03-17 − There's a tendency in open source software development we don't support and which is illustrated by the following examples (the revolution eats its children): We'd like to call this tendency "erasure of influential individuals names" replacing the erased names by the term "the community" those strongly hinting that said tendency is a form of pure communism. Looking back we've the impression that the text The Cathedral and the Bazaar tried to give kinda theoretical (not to say ideological) excuse regarding that tendency. The agenda is, of course, pushed forward not by an abstract "community" but by sick individuals like the one quoted above and the one quoted below (most likely never in their live having written a single line of C-code.)
  • 2020-06-03 − As it seems our days at Sourceforge are counted. At least we’ve received a respective ultimatum:
    Isn‘t it funny that this is happening at the exact same time as Donald J. Trump is going to crack down all that commie scum?
  • 2020-06-08 − These days where anything and everything has a motto it remains Sorceforge’s secret why prohibiting a motto in favor of one’s own people. Anyway, we’re going to leave: In order to comply formally with their ”policies“ this page will simply be replaced by something similar to dummy-doc/index.html.
  • 2020-06-14 − The project has been moved to http://pbelkner.de/.
  • 2020-06-30 − We’ve changed the above tag: #TeamWhite#WLM.

    (C) by FOCUS Online
  • 2020-07-03Google puts us on page 3 hidden below a stack of unsupported Linux distributions (doing nothing other than spreading their Commie-agenda all over the world):
    2020-07-04 − Meanwhile its completely vanished.
  • 2020-07-04 − By pure accident we've just discovered an interesting discussion dating back already to fall 2018:

    The discussion was continued elsewhere:
    Is someone believing that a real woman made out of flesh and blood is really writing such BS? At least we're not. We see an (anonymous) Twitter account driven by a Commie activist who is eagerly awaiting (for whatever reason − most likely nothing other than $$$) Europe looking like this:

    Meanwhile the video displayed here has been removed by YouTube instead stating “This video is no longer available because the YoutTube account associated with this has been terminated”. The video (formerly available at URL "https://www.youtube.com/watch?v=0X5jYHNlkXI") was showing a negro openly roasting a cat in the streets of some small Italian town.

    Thank you Paul for finding the clear words.

    BTW: You should really have a look at the Commie-activist's Twitter-account in order to learn what kind of BS it is spreading: Indeed, we've never ever known a woman claiming to be a Command line enthusiast

    Dear “Claudia”, this was a little bit over the top. Hah, hah, hah …

  • 2020-07-10 − Wow, this morning Google puts us on page one! It's a bit volatile yet, but anyway, here we are …
  • 2020-07-15 − We've learnd a word being en vogue these days and being new to us: cancel culture.
  • 2023-06-06 − #Stolzmonat
  • 2023-06-04 − #Stolzmonat
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
  • Introduces option --script=<script to run instead of muxing>.
  • On Windows <script to run instead of muxing> should be a "bat"-file otherwise a shell script, e.g.
    root@root-pc MINGW32 ~/bs1770gain
    # cat script.bat
    @echo off
    ffmpeg -hide_banner -loglevel panic -i %BS1770GAIN_SOURCE% -filter:a "volume=%BS1770GAIN_INTEGRATED_RELATIVE%dB" -y %BS1770GAIN_TARGET%
    
    root@root-pc MINGW32 ~/bs1770gain
    # cat script.sh
    ffmpeg -hide_banner -loglevel panic -i ${BS1770GAIN_SOURCE} -filter:a "volume=${BS1770GAIN_INTEGRATED_RELATIVE}dB" -y ${BS1770GAIN_TARGET}
    
    root@root-pc MINGW32 ~/bs1770gain
    
    Please note that using "ffmpeg" is not mandatory. Here it serves as a mere example.
  • On Windows it is assumed that there is a command interpreter at "C:\Windows\system32\cmd.exe" otherwise a shell interpreter at "/bin/sh".
  • The following environment variables are provided (as long as their calculation is required due to parameterization):
    • BS1770GAIN_SOURCE,
    • BS1770GAIN_TARGET,
    • BS1770GAIN_LU,
    • BS1770GAIN_LRA,
    • BS1770GAIN_OVERWRITE,
    • BS1770GAIN_NORM,
    • BS1770GAIN_TRACK_INTEGRATED aka BS1770GAIN_INTEGRATED,
    • BS1770GAIN_TRACK_INTEGRATED_RELATIVE aka BS1770GAIN_INTEGRATED_RELATIVE,
    • BS1770GAIN_TRACK_MOMENTARY_MEAN aka BS1770GAIN_MOMENTARY_MEAN,
    • BS1770GAIN_TRACK_MOMENTARY_MEAN_RELATIVE aka BS1770GAIN_MOMENTARY_MEAN_RELATIVE,
    • BS1770GAIN_TRACK_MOMENTARY_MAXIMUM aka BS1770GAIN_MOMENTARY_MAXIMUM,
    • BS1770GAIN_TRACK_MOMENTARY_MAXIMUM_RELATIVE aka BS1770GAIN_MOMENTARY_MAXIMUM_RELATIVE,
    • BS1770GAIN_TRACK_MOMENTARY_RANGE aka BS1770GAIN_MOMENTARY_RANGE,
    • BS1770GAIN_TRACK_SHORTTERM aka BS1770GAIN_SHORTTERM,
    • BS1770GAIN_TRACK_SHORTTERM_RELATIVE aka BS1770GAIN_SHORTTERM_RELATIVE,
    • BS1770GAIN_TRACK_SHORTTERM_MEAN aka BS1770GAIN_SHORTTERM_MEAN,
    • BS1770GAIN_TRACK_SHORTTERM_MEAN_RELATIVE aka BS1770GAIN_SHORTTERM_MEAN_RELATIVE,
    • BS1770GAIN_TRACK_SHORTTERM_MAXIMUM aka BS1770GAIN_SHORTTERM_MAXIMUM,
    • BS1770GAIN_TRACK_SHORTTERM_MAXIMUM_RELATIVE aka BS1770GAIN_SHORTTERM_MAXIMUM_RELATIVE,
    • BS1770GAIN_TRACK_SHORTTERM_RANGE aka BS1770GAIN_SHORTTERM_RANGE,
    • BS1770GAIN_TRACK_SAMPLEPEAK_ABSOLUTE aka BS1770GAIN_SAMPLEPEAK_ABSOLUTE,
    • BS1770GAIN_TRACK_SAMPLEPEAK_RELATIVE aka BS1770GAIN_SAMPLEPEAK_RELATIVE,
    • BS1770GAIN_TRACK_TRUEPEAK_ABSOLUTE aka BS1770GAIN_TRUEPEAK_ABSOLUTE,
    • BS1770GAIN_TRACK_TRUEPEAK_RELATIVE aka BS1770GAIN_TRUEPEAK_RELATIVE,
    • BS1770GAIN_ALBUM_INTEGRATED,
    • BS1770GAIN_ALBUM_INTEGRATED_RELATIVE,
    • BS1770GAIN_ALBUM_MOMENTARY_MEAN,
    • BS1770GAIN_ALBUM_MOMENTARY_MEAN_RELATIVE,
    • BS1770GAIN_ALBUM_MOMENTARY_MAXIMUM,
    • BS1770GAIN_ALBUM_MOMENTARY_MAXIMUM_RELATIVE,
    • BS1770GAIN_ALBUM_MOMENTARY_RANGE,
    • BS1770GAIN_ALBUM_SHORTTERM,
    • BS1770GAIN_ALBUM_SHORTTERM_RELATIVE,
    • BS1770GAIN_ALBUM_SHORTTERM_MEAN,
    • BS1770GAIN_ALBUM_SHORTTERM_MEAN_RELATIVE,
    • BS1770GAIN_ALBUM_SHORTTERM_MAXIMUM,
    • BS1770GAIN_ALBUM_SHORTTERM_MAXIMUM_RELATIVE,
    • BS1770GAIN_ALBUM_SHORTTERM_RANGE,
    • BS1770GAIN_ALBUM_SAMPLEPEAK_ABSOLUTE,
    • BS1770GAIN_ALBUM_SAMPLEPEAK_RELATIVE,
    • BS1770GAIN_ALBUM_TRUEPEAK_ABSOLUTE, and
    • BS1770GAIN_ALBUM_TRUEPEAK_RELATIVE.
  • Option --script might be combined with option --threads, i.e. executing the script in parallel should be possible.
  • Introduces option --shell=<path to interpreter>. The interpreter is assumed to provide an option "-c" for executing scripts and to require POSIX path conventions.
  • Option --shell might come in handy especially when you’re on Windows, using "msys2" and not very comfortable with the capabilties of "bat"-files and their syntax. Then you might prefer e.g.
    bs1770gain <path to input> -o <path to output directory> --script=./script.sh --shell=/bin/sh.exe
    or respectively from the Windows "cmd"-box
    bs1770gain <path to input> -o <path to output directory> --script=%cd%\script.sh --shell=<path to msys2 installation>\usr\bin\sh.exe
    Please note that a full path to the script as well as to the shell is required.
  • Fixes an issue with remuxing Alexis pointed us to and which might have been occurred under certain circumstances. Thanks a lot Alexis!
2020-07-26 0.8.2 This is a maintenence release affecting mostly the Windows builds:
  • Introduces the (not very useful) option --skip-scan.
  • Fixes a long standing bug on Windows regarding options --file=<file name>/--utf-8=<file name>/--utf-16=<file name>.
  • With the Windows-console, we had best experiences when setting it up to display narrow (8 bit) characters while just writing wide (16 bit) characters to it. In order to achieve this the whole program had to be transformed (re-factured.) Anyway, with German OEM installed we still don’t know wether it is even possible to write say kyrillic letters to the Windows-console.
  • Fixes an issue on Windows which had already been slipped through some time ago, i.e. under certain circumstances option -a/--apply was not working any longer.
  • Fixes some minor glitches we came across.
  • 2020-07-28: The MacOS binary release is available from AdRY's Sourceforge project.
2020-07-10 0.8.1 Jointly with AdRY the following was achieved:
  • Re-structuring the build process in order to allow for bundeling third party shared objects with the application (as it was already usual with the Windows releases.)
  • Allow for dynamically loading shared objects on MacOS.
  • AdRY has created a project on Sourceforge for providing MacOS binary releases. The MacOS binary release will appear a few days deferred.
  • 2020-07-14: The MacOS binary release is available from AdRY's Sourceforge project.
2020-06-24 0.8.0
  • This is a special pbelkner.de welcome edition (not to say: bye, bye Sourceforge.) Hence a minor version bump!
  • Alexis reported the issue that on his Mac with libpthread not being installed the configure script was broken. Such a set-up was resulting in a corrupt build. Thanks a lot Alexis for letting us know!
  • The options regarding parallel processing have been changed slightly. Now by default from time to time there’s some sparse printing indicating that the program is still working.
2020-05-29 0.7.0 Essentially the same as 0.7.0-β4.
2020-05-11 0.7.0-β4
  • Improved configuration w.r.t. pthreads.
  • Adapted source code respectively.
2020-05-06 0.7.0-β3 Fixed some synchronization issues.
2020-05-06 0.7.0-β2
  • Hadrien was letting us know that he wants bs1770gain to have an option like --quiet supressing any output except error messages because he runs bs1770gain in conjunction with option --overwrite from a multithreaded environment.
  • This brought us to the idea to support multiple threads from within bs1770gain itself: option --threads=<number of threads> was born.
  • Currently option --threads=<number of threads> just makes sense when used in conjunction with options -o/--output or --overwrite and may result in a significant performance gain (it's meant for mass replay-gain tagging):
    root@root-pc MINGW32 ~/bs1770gain
    # rm -rf ./zz && bs1770gain /e/MEDIA/audio/classic/heart/1978_magazine/ --time --quiet -o ./zz
    Duration: 39.477 sec.
    
    root@root-pc MINGW32 ~/bs1770gain
    # rm -rf ./zz && bs1770gain /e/MEDIA/audio/classic/heart/1978_magazine/ --time --threads=8 -o ./zz
    Duration: 8.911 sec.
    
    root@root-pc MINGW32 ~/bs1770gain
    # _
  • Fixed a flaw with option -x rename.
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
  • AdRY pointed us to an issue with 5.0/5.1 this release should fix. Thanks a lot AdRY!
  • Option --lfe was dropped because it was nothing other than a placebo.
  • Determinig the LFE channel is hard-wired following the description given at http://lists.xiph.org/pipermail//flac-dev/2013-January/003569.html, i.e. there's no LFE channel if there are less than six channels, otherwise the LFE channel is the fourth one (preceeded by FL, FR, and FC.)
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): Discontinued because we're fed up with U.S. politics.
2019-11-22   Impeachment circus (track one of two concurrent ‐ viva la "resistence"!): Discontinued because we're fed up with U.S. politics.
2019-12-13   Brexit: Discontinued because we're fed up with U.S. politics.
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
  • Removed some odd asymmetry from source code.
  • Should have no influence on user experience.
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:
  • bs1770gain attempts to lift the output tree in that it purges the tree starting from the root as long as it is degenerated to a list until for the first time a real branch or a leaf appears.
  • The root cause for the Invalid write bug was (hopefully) found in said lifting's implementation.
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
  • Fixed an Invalid write bug (thanks Debian.)
  • For static builds, removed testing for sufficient glib's version (in order to support building @Debian.)
  • Note: Unfortunately currently our VM for Debian 10 i686 is broken. Might be an issue with QEMU or the current kernel of Debian 10 i686 or the interplay of the two. Hence there's no binary for Debian 10 i686.
2019-09-15 0.6.2-β1 Restored option --time.
2019-09-14  
  • Could someone, please, let us know why Nanos gigantum humeris insidentes #TeamWhite is considered hate speech? Whom it's telling us to hate???
  • Arch Linux recently (2019-09-13) removed it from the copyright notice by a patch called "remove-hate.patch":
    [peter@arch-linux-amd64 tmp]$ asp checkout bs1770gain
    Cloning into ’bs1770gain’
    done.
    [peter@arch-linux-amd64 tmp]$ ls ./bs177gain/repos/community-x86_64/
    PKGBUILD remove-hate.patch
    [peter@arch-linux-amd64 tmp]$ cat ./bs177gain/repos/community-x86_64/remove-hate.patch
    diff -aur bs1770gain-0.6.0/libbg/bgx.c bs1770gain-0.6.0.new/libbg/bgx.c
    --- bs1770gain-0.6.0/libbg/bgx.c  2019-08-13 08:09:47.000000000 +0200
    +++ bs1770gain-0.6.0.new/libbg/bgx.c  2019-09-13 20:13:48.828606603 +0200
    @@ -37,16 +37,12 @@
      * turn with "libff.a".) finally serving as bs1770gain's implementation.
      */
     #if 1 // [
    -#if 1 // [
     #define BS1770GAIN_TEAM_WHITE \
         " #TeamWhite"
     #else // ] [
     #define BS1770GAIN_TEAM_WHITE \
         ""
     #endif // ]
    -#define BS1770GAIN_NANOS_GIGANTUM_HUMERIS_INSIDENTES \
    -    "Nanos gigantum humeris insidentes." BS1770GAIN_TEAM_WHITE "\n"
    -#endif // ]
    
     ///////////////////////////////////////////////////////////////////////////////
    [peter@arch-linux-amd64 tmp]$ _
  • Indeed it's telling us to (again) respect ourselfs!
  • update 2019-09-15: Do we really have to consider creatures pushing innocent children in front of a train human beings? A great German military theorist, Carl von Clausewitz, once said: War is Politics by other Means. These days we're attemted to say: Peace is War by other Means, update 2019-09-28: cf. here. (Please note that we don't consider the alien creatures responsible for the crimes at first hand the enemy. They're simply used by those as human appearing weapon. It's nothing other then the usual brain-fuck.) Everybody should seriously ask himself on which side of the (invisible) front he's on (also you guys over there @Arch Linux.)
  • update 2019-09-15:
2019-09-12 0.6.1
  • Some users pointed us to an issue with files where album art is embedded as PNG. Under certain circumstances (especially when using our binary builds) those files where not processed as expected. Thanks a lot A B and Eugene!
  • As the cause for that un-expected behaviour we spotted libavcodec and libavformat re-distributed with the release. They where not build to properly support PNG. This is fixed by libavcodec and libavformat re-distributed with this release are now statically linked to a decent version of libpng.
  • On Linux, we tested the prior release with one of our early adopters, Arch Linux. As expected, there's no problem with PNG's because of the more complete FFmpeg coming with the system.
  • Please note that we provide binary Linux builds just for the i686 and x86_i64 architectures. The main obstacle for using our Linux binary builds is libc's version:
    • the Debian 9 builds need libc at least v2.24 installed,
    • the Debian 10 builds need libc at least v2.28 installed.
    When in doubt choose the most conservative build, i.e. Debian 9 (running also on Debian 10 but not vice versa.)
  • Windows users should regularly upgrade the FFmpeg DLLs from a Zeranoe's shared build corresponding to their architecture.
  • Some minor code clean-up has also been done.
2019-09-05 0.6.0
  • Essentialy the same as v0.6.0-β34.
  • This major update became necessary because of the following reasons:
    • We wanted to get rid of all the FFmpeg functions having become deprecated througout the years. We wanted to avoid that some fine day they're all purged off of FFmpeg and there we are with empty hands having slept all the time. (The most prominent example is the decoding/encoding API having undegone a major change.)
    • We wanted to get rid of SoX because as it seems its not maintained any longer (last updated in February 2015) and all we needed from SoX (re-sampling) is available more prominently from FFmpeg itself.
  • We ended up with developing large parts (most) of bs1770gain from scratch. For what have been done in particular cf. the notes to
  • Many thanks to everyone having contributed to this β-phase! (Cf. below notes.)
2019-08-13 0.6.0-β34
  • Copying embedded album art as requested by Damiano has finally been solved.
  • It was just one line of code missing (cf. here.)
  • This little episode demonstrates what a great framework FFmpeg really is.
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
bs1770gain 0.6.0-beta-33, Copyright (C) Peter Belkner 2014-2019.
Nanos gigantum humeris insidentes. #TeamWhite
http://bs1770gain.sourceforge.net/
Compiled for Linux by means of gcc 8.3.0 on
       nodename:  debian-10,
        release:  4.19.0-5-686-pae,
        version:  #1 SMP Debian 4.19.37-5+deb10u1 (2019-07-19),
        machine:  i686,
expecting
           libc:  2.28 (stable),
      libavutil:  56.33.100,
  libswresample:  3.6.100,
     libavcodec:  58.55.100,
    libavformat:  58.30.100,
     libswscale:  5.6.100,
    libpostproc:  55.6.100, and
    libavfilter:  7.58.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.
Error: Attmpting to dynamically load FFmpeg shared objects by means of an out-dated libc: expecting 2.28, found 2.24. (bgx.c:1193:main)
peter@debian-9:~/msys2/bs1770gain$
2019-08-12 0.6.0-β32
  • There still was a glitch with v0.6.0-β30 (w.r.t. the -o/--output option.)
  • Undocumented v0.6.0-β31 served private communications.
2019-08-11 0.6.0-β30
  • Damiano pointed us to the issue that it not any longer was possible to mass-process files (i.e. literally thousands.) Thanks a lot Damiano!
  • In order to make it possible with the new architecture we'd to introduce a data structure encapsulating branching in the directory structure of the underlying file system to some extend reminding us on de Broglie–Bohm theory's pilot wave. Hence it's called the pilot.
  • With Damiano we made the experience that it's not possible to just download one out auf the Linux binary builds fitting to ones architecture and expecting it to run. Indeed it might not work! As a cause for preventing loading the FFmpeg shared objects we spotted libc. Because of that bs1770gain now is equipped with some information from compile time.
    • This information is provided by means of option --version. This option is processed before attempting to load the FFmpeg shared objects. In the following example please note libc's version 2.24:
      peter@debian-9:~/msys2/bs1770gain$ ./linux/debian-9-i686/bs1770gain --version
      bs1770gain 0.6.0-beta-30, Copyright (C) Peter Belkner 2014-2019.
      Nanos gigantum humeris insidentes. #TeamWhite
      http://bs1770gain.sourceforge.net/
      Compiled for Linux by means of gcc 6.3.0 on
             nodename:  debian-9,
              release:  4.9.0-9-686-pae,
              version:  #1 SMP Debian 4.9.168-1+deb9u4 (2019-07-19),
              machine:  i686,
      expecting
                 libc:  2.24 (stable),
            libavutil:  56.33.100,
        libswresample:  3.6.100,
           libavcodec:  58.55.100,
          libavformat:  58.30.100,
           libswscale:  5.6.100,
          libpostproc:  55.6.100, and
          libavfilter:  7.58.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.
      peter@debian-9:~/msys2/bs1770gain$
    • You might double check whether libc installed on your system is sufficient:
      peter@debian-9:~/msys2/bs1770gain$ ldd --version
      ldd (Debian GLIBC 2.24-11+deb9u4) 2.24
      Copyright (C) 2016 Free Software Foundation, Inc.
      This is free software; see the source for copying conditions.  There is NO
      warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
      Written by Roland McGrath and Ulrich Drepper.
      peter@debian-9:~/msys2/bs1770gain$
  • In case you're attempting to run bs1770gain build on a system with a higher libc version as installed on your system you may experience an error like the following:
    peter@debian-9:~/msys2/bs1770gain$ ./linux/debian-10-i686/bs1770gain --version --help=codec
    bs1770gain 0.6.0-beta-30, Copyright (C) Peter Belkner 2014-2019.
    Nanos gigantum humeris insidentes. #TeamWhite
    http://bs1770gain.sourceforge.net/
    Compiled for Linux by means of gcc 8.3.0 on
           nodename:  debian-10,
            release:  4.19.0-5-686-pae,
            version:  #1 SMP Debian 4.19.37-5+deb10u1 (2019-07-19),
            machine:  i686,
    expecting
               libc:  2.28 (stable),
          libavutil:  56.33.100,
      libswresample:  3.6.100,
         libavcodec:  58.55.100,
        libavformat:  58.30.100,
         libswscale:  5.6.100,
        libpostproc:  55.6.100, and
        libavfilter:  7.58.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.
    Warning: libc might be out-dated: expecting 2.28, found 2.24. (bgx.c:1242:main)
      Might prevent loading FFmpeg shared objects. Good luck!
    Error: loading /mnt/hgfs/d/msys64/home/root/bs1770gain/linux/debian-10-i686/bs1770gain-tools/libavutil.so.56. (ff_dynload.c:1407:avutil_load)
    Error: wrong version of avutil: expecting 56, found 0 at "/mnt/hgfs/d/msys64/home/root/bs1770gain/linux/debian-10-i686/bs1770gain-tools/". (bgx.c:1262:main)
    peter@debian-9:~/msys2/bs1770gain$
  • Undocumented versions 0.6.0-β26 through 0.6.0-β29 served private communications.
  • Damiano further pointed out that embedded album art is not processed as expected. Because as far as we can see this is not a new issue it's left for a future release. It's the same as with the request by Hadrien who proposed parallelization. This release should just focus on reproducing (and improving) functionality based on a changed architecture.
2019-07-13 0.6.0-β25
  • Ross pointed us to an issue regarding option --stereo. This particular option might be usful in a command like
    bs1770gain <path to input file> --stereo [-ao <path to output directory>]?
    Thanks a lot Ross!
  • While at it introduced a generalization to option --stereo: option --matrix=<matrix> supporting re-matrixing to a channel format <matrix> out of the ones supported by FFmpeg (cf. bs1770gain's help message.) This way option --stereo is just shorthand for option --matrix=layout_stereo (update 2019-08-11: with v0.6.030 underscores where replaced by minus signs, i.e. since that release it should read --matrix=layout-stereo.)
  • Improved dealing with some error messages and warnings.
  • Improved dealing with option --extension=csv. Please note that with this particular option a per-folder CSV file (with tabulator as separator) named "folder.csv" is supported for importing tag values. The CSV file's first line (the header line) has to list the names of the tags to be imported starting with a column labelled file. All subsequent rows have to first list the basename of a file from that particular folder and than the values corresponding to the respective tag listed in the header line.
  • Might be considered a second release candidate.
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
  • This β-release implements option --unit.
  • Without option --unit:
    root@root-pc MINGW32 ~/bs1770gain
    # bs1770gain ~/aerosmith/1973_make_it/01_make_it.flac -t
    analyzing ...
    [1/1] 01_make_it.flac
       integrated (momentary mean): -12.68 LUFS / -10.32 LU
      truepeak (relative/absolute): -0.39 TPFS / 0.956359
    [COLLECTION]
       integrated (momentary mean): -12.68 LUFS / -10.32 LU
      truepeak (relative/absolute): -0.39 TPFS / 0.956359
    done.
    
    root@root-pc MINGW32 ~/bs1770gain
    # bs1770gain ~/aerosmith/1973_make_it/01_make_it.flac -t --atsc
    analyzing ...
    [1/1] 01_make_it.flac
       integrated (momentary mean): -12.68 dBFS / -11.32 dB
      truepeak (relative/absolute): -0.39 dBFS / 0.956359
    [COLLECTION]
       integrated (momentary mean): -12.68 dBFS / -11.32 dB
      truepeak (relative/absolute): -0.39 dBFS / 0.956359
    done.
    
    root@root-pc MINGW32 ~/bs1770gain
    #
  • With option --unit:
    root@root-pc MINGW32 ~/bs1770gain
    # bs1770gain ~/aerosmith/1973_make_it/01_make_it.flac -t --unit=db
    analyzing ...
    [1/1] 01_make_it.flac
       integrated (momentary mean): -12.68 dBFS / -10.32 dB
      truepeak (relative/absolute): -0.39 dBFS / 0.956359
    [COLLECTION]
       integrated (momentary mean): -12.68 dBFS / -10.32 dB
      truepeak (relative/absolute): -0.39 dBFS / 0.956359
    done.
    
    root@root-pc MINGW32 ~/bs1770gain
    # bs1770gain ~/aerosmith/1973_make_it/01_make_it.flac -t --atsc --unit=ebu
    analyzing ...
    [1/1] 01_make_it.flac
       integrated (momentary mean): -12.68 LUFS / -11.32 LU
      truepeak (relative/absolute): -0.39 TPFS / 0.956359
    [COLLECTION]
       integrated (momentary mean): -12.68 LUFS / -11.32 LU
      truepeak (relative/absolute): -0.39 TPFS / 0.956359
    done.
    
    root@root-pc MINGW32 ~/bs1770gain
    #
2019-06-27  
2019-06-27 0.6.0-β20
  • This β-release marks a major update in functionality by introducing options --suffix=<suffix> and --codec=<codec>. Both options are useful in conjunction with the -a/--apply option only, i.e. just with transcoding and applying the gain obtained from the analysis. This might be useful for people producing (Youtube) videos.as e.g. our "gatekeeper" to Debian, Petter Reinholdtsen: Measuring and adjusting the loudness of a TV channel using bs1770gain.
  • Without option --suffix=<suffix> the input is transcoded to FLAC and possibly wrapped into MKV or MKA, respectively (as usual):
    root@root-pc MINGW32 ~/bs1770gain
    # bs1770gain ~/peter_frampton/2000_live_in_detroit_dvd/02_lying.mkv -ao xx
    analyzing ...
    [1/1] 02_lying.mkv
      integrated (momentary mean): -24.38 LUFS / 1.38 LU
    [COLLECTION]
      integrated (momentary mean): -24.38 LUFS / 1.38 LU
    remuxing ...
    [1/1] 02_lying.mkv
    done.
    
    root@root-pc MINGW32 ~/bs1770gain
    # ffmpeg -i ./xx/02_lying.mkv
    ffmpeg version N-94125-gd33414d2ad Copyright (c) 2000-2019 the FFmpeg developers
      built with gcc 9.1.0 (Rev3, Built by MSYS2 project)
      configuration: --extra-ldflags='-static-libgcc -static-libstdc++ -static'
      libavutil      56. 29.100 / 56. 29.100
      libavcodec     58. 53.100 / 58. 53.100
      libavformat    58. 28.101 / 58. 28.101
      libavdevice    58.  7.100 / 58.  7.100
      libavfilter     7. 55.100 /  7. 55.100
      libswscale      5.  4.101 /  5.  4.101
      libswresample   3.  4.100 /  3.  4.100
      libpostproc    55.  4.100 / 55.  4.100
    [mpeg2video @ 01f49dc0] ignoring pic cod ext after 0
    Input #0, matroska,webm, from './xx/02_lying.mkv':
      Metadata:
        title           : Lying
        REPLAYGAIN_REFERENCE_LOUDNESS: -23.0 LUFS
        ARTIST          : Peter Frampton
        ALBUM           : Live In Detroit (DVD)
        YEAR            : 2000
        DISC            : 1/1
        track           : 2
        GENRE           : Rock
        VIDEO_CROP      : 698:572:8:2
        REPLAYGAIN_ALGORITHM: BS.1770
        ENCODER         : Lavf58.28.101
      Duration: 00:06:27.72, start: 0.000000, bitrate: 8100 kb/s
        Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, top first)
        Metadata:
          DURATION        : 00:06:27.720000000
        Stream #0:1: Audio: flac, 48000 Hz, stereo, s32 (24 bit) (default)
        Metadata:
          DURATION        : 00:06:27.552000000
    At least one output file must be specified
    
    root@root-pc MINGW32 ~/bs1770gain
    #
  • By means of option --suffix=<suffix> the input is remuxed accordingly and the audio transcoded to a default codec obtained from libavformat.
    root@root-pc MINGW32 ~/bs1770gain
    # bs1770gain ~/peter_frampton/2000_live_in_detroit_dvd/02_lying.mkv -ao xx --suffix=mp4
    analyzing ...
    [1/1] 02_lying.mkv
      integrated (momentary mean): -24.38 LUFS / 1.38 LU
    [COLLECTION]
      integrated (momentary mean): -24.38 LUFS / 1.38 LU
    remuxing ...
    [1/1] 02_lying.mp4
    done.
    
    root@root-pc MINGW32 ~/bs1770gain
    # ffmpeg -i ./xx/02_lying.mp4
    ffmpeg version N-94125-gd33414d2ad Copyright (c) 2000-2019 the FFmpeg developers
      built with gcc 9.1.0 (Rev3, Built by MSYS2 project)
      configuration: --extra-ldflags='-static-libgcc -static-libstdc++ -static'
      libavutil      56. 29.100 / 56. 29.100
      libavcodec     58. 53.100 / 58. 53.100
      libavformat    58. 28.101 / 58. 28.101
      libavdevice    58.  7.100 / 58.  7.100
      libavfilter     7. 55.100 /  7. 55.100
      libswscale      5.  4.101 /  5.  4.101
      libswresample   3.  4.100 /  3.  4.100
      libpostproc    55.  4.100 / 55.  4.100
    [mpeg2video @ 0065a0c0] ignoring pic cod ext after 0
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './xx/02_lying.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2mp41
        title           : Lying
        artist          : Peter Frampton
        album           : Live In Detroit (DVD)
        encoder         : Lavf58.28.101
        genre           : Rock
        track           : 2
        disc            : 1/1
      Duration: 00:06:27.60, start: 0.000000, bitrate: 6648 kb/s
        Stream #0:0(und): Video: mpeg2video (Main) (mp4v / 0x7634706D), yuv420p(tv, top first)
        Metadata:
          handler_name    : VideoHandler
        Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
        Metadata:
          handler_name    : SoundHandler
    At least one output file must be specified
    
    root@root-pc MINGW32 ~/bs1770gain
    #
    root@root-pc MINGW32 ~/bs1770gain
    # bs1770gain ~/peter_frampton/2000_live_in_detroit_dvd/02_lying.mkv -ao xx --suffix=mkv
    analyzing ...
    [1/1] 02_lying.mkv
      integrated (momentary mean): -24.38 LUFS / 1.38 LU
    [COLLECTION]
      integrated (momentary mean): -24.38 LUFS / 1.38 LU
    remuxing ...
    [1/1] 02_lying.mkv
    done.
    
    root@root-pc MINGW32 ~/bs1770gain
    # ffmpeg -i ./xx/02_lying.mkv
    ffmpeg version N-94125-gd33414d2ad Copyright (c) 2000-2019 the FFmpeg developers
      built with gcc 9.1.0 (Rev3, Built by MSYS2 project)
      configuration: --extra-ldflags='-static-libgcc -static-libstdc++ -static'
      libavutil      56. 29.100 / 56. 29.100
      libavcodec     58. 53.100 / 58. 53.100
      libavformat    58. 28.101 / 58. 28.101
      libavdevice    58.  7.100 / 58.  7.100
      libavfilter     7. 55.100 /  7. 55.100
      libswscale      5.  4.101 /  5.  4.101
      libswresample   3.  4.100 /  3.  4.100
      libpostproc    55.  4.100 / 55.  4.100
    [mpeg2video @ 01d99d40] ignoring pic cod ext after 0
    Input #0, matroska,webm, from './xx/02_lying.mkv':
      Metadata:
        title           : Lying
        REPLAYGAIN_REFERENCE_LOUDNESS: -23.0 LUFS
        ARTIST          : Peter Frampton
        ALBUM           : Live In Detroit (DVD)
        YEAR            : 2000
        DISC            : 1/1
        track           : 2
        GENRE           : Rock
        VIDEO_CROP      : 698:572:8:2
        REPLAYGAIN_ALGORITHM: BS.1770
        ENCODER         : Lavf58.28.101
      Duration: 00:06:27.72, start: 0.000000, bitrate: 6707 kb/s
        Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, top first)
        Metadata:
          DURATION        : 00:06:27.720000000
        Stream #0:1: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default)
        Metadata:
          DURATION        : 00:06:27.552000000
    At least one output file must be specified
    
    root@root-pc MINGW32 ~/bs1770gain
    #
  • By means of option --codec=<codec> the audio codec to which to transcode may be chosen:
    # bs1770gain ~/peter_frampton/2000_live_in_detroit_dvd/02_lying.mkv -ao xx --codec=wavpack
    analyzing ...
    [1/1] 02_lying.mkv
      integrated (momentary mean): -24.38 LUFS / 1.38 LU
    [COLLECTION]
      integrated (momentary mean): -24.38 LUFS / 1.38 LU
    remuxing ...
    [1/1] 02_lying.mkv
    done.
    
    root@root-pc MINGW32 ~/bs1770gain
    # ffmpeg -i ./xx/02_lying.mkv
    ffmpeg version N-94125-gd33414d2ad Copyright (c) 2000-2019 the FFmpeg developers
      built with gcc 9.1.0 (Rev3, Built by MSYS2 project)
      configuration: --extra-ldflags='-static-libgcc -static-libstdc++ -static'
      libavutil      56. 29.100 / 56. 29.100
      libavcodec     58. 53.100 / 58. 53.100
      libavformat    58. 28.101 / 58. 28.101
      libavdevice    58.  7.100 / 58.  7.100
      libavfilter     7. 55.100 /  7. 55.100
      libswscale      5.  4.101 /  5.  4.101
      libswresample   3.  4.100 /  3.  4.100
      libpostproc    55.  4.100 / 55.  4.100
    [mpeg2video @ 02019dc0] ignoring pic cod ext after 0
    Input #0, matroska,webm, from './xx/02_lying.mkv':
      Metadata:
        title           : Lying
        REPLAYGAIN_REFERENCE_LOUDNESS: -23.0 LUFS
        ARTIST          : Peter Frampton
        ALBUM           : Live In Detroit (DVD)
        YEAR            : 2000
        DISC            : 1/1
        track           : 2
        GENRE           : Rock
        VIDEO_CROP      : 698:572:8:2
        REPLAYGAIN_ALGORITHM: BS.1770
        ENCODER         : Lavf58.28.101
      Duration: 00:06:27.72, start: 0.000000, bitrate: 8143 kb/s
        Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, top first)
        Metadata:
          DURATION        : 00:06:27.720000000
        Stream #0:1: Audio: wavpack, 48000 Hz, stereo, s32p (24 bit) (default)
        Metadata:
          DURATION        : 00:06:27.552000000
    At least one output file must be specified
    
    root@root-pc MINGW32 ~/bs1770gain
    #
  • It's up to the user supplying useful combinations of options --suffix=<suffix> and --codec=<codec>. Valid values can be obtained by means of options --help=suffix and --help=codec, respectively.
2019-06-26 0.6.0-β17
through
0.6.0-β19
  • Kyle pointed us to an issue with 8 channels. We've to emphasize we're convinced that no prior version was able to process 8 channels. (Anyway, we're not going to re-test versions already history.)
  • Adriano wants to use bs170gain in a filter chain. That's why there's a --suppress-progress option stripping any superflous information from the console output.
2019-06-24 0.6.0-β14
through
0.6.0-β16
  • Adriano pointed us to a sever bug when processing WAV files (cf. AVCodecContext::channel_layout 0 for WAV files.)
  • Adriano proposed that there shoud be a means for suppressing results up the hierarchy. That's why there's a --suppress-hierarchy option.
  • Kyle (from South Korea) pointed us to an issue with files where FFmpeg is unable to extract a duration.
    Note: In case of missing duration it is impossible to display the processing progress in percent. Instead it is given in (absolute) seconds.
  • Thanks a lot Adriano and Kyle!
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:
  • Alexis reported that attempting to build on macOS aborts with a compilation error. Thanks a lot Alexis!
  • Diimaan reported an issue with loading the shared FFmpeg objects. Thanks a lot Diimaan!
    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:
    • SoX is history. Prior versions of bs1770gain relied on libsox for re-sampling. This version does re-sampling by means of ffmpeg's libswresample.
    • The renovation's major goal was getting rid of libsox. While at it we invented new data structures better fitting the problem domain. Finally we ended up replacing the libffsox and the bs1770gain layers by respective libff and libbg layers.
    • The responsibility of the libff layer is providing building blocks for accessing the ffmpeg libraries, i.e.
      • libavfilter (not needed by prior versions),
      • libpostproc (not needed by prior versions),
      • update 2019-06-11: libswscale (not needed by prior versions),
      • libavformat,
      • libavcodec,
      • libswresample (not needed by prior versions), and
      • libavutil.
    • For re-muxing in conjunction with transcoding the audio stream (by means of the -a/--apply option) bs1770gain now relies on libavfilter which in turn needs libpostproc update 2019-06-14: and libswscale.
    • The responsibility of the libbg layer is on one hand accessing the ffmpeg libraries (via the libff layer) and on the other hand accessing the lib1770 layer implementing the BS.1770 algorithm (which mainly has been untouched except fixing a minor bug preventing aggregation up the hierarchie.)
    • A great deal of time was spend improving NLS (especially for the Windows version. Please note that we've tried hard to find a solution for the cmd-box which is not UTF-8 aware wheras the MSYS2 shell indeed is - bs1770gain decides whether run from cmd-box or shell by examining the LANG environment variable and respectively relies on a 8 bit OEM or UTF-8 character representation when writing to cmd-box or shell. To make things worse a 16 bit wide character representaion is needed when writing to a file ... Note: We've tested with some cyrillic alphabet completely outside the lower half of the ASCII table - The best we could achieve with the cmd-box on our system is producing question marks - German OEM page is not able to display cyrillic letters - for you guys over there in Russia hopefully everything is fine except you have german umlauts in your file names ...)
    • The -b/--begin and -d/--duration options should work now as expected. (update 2019-06-16: In order to make this working we needed to implement a workaroud for dealing with issue 7864 or issue 4905, respectively.)
    2019-06-06  

    Please note that this is a re-upload. The original video was deleted by Youtube. The re-upload featured the following comment by Black Forest (meanwhile completely overwritten): "This video is like a short movie. The pictures and the music tell us a story. My interpretation: There is a lonely man in a cold city. The city is cold to this man because there are mainly foreign shops and foreign fast food restaurants. And the gigantic supermarket is a symbol of capitalism. The shop center, too. The culture of the man was stolen from him. We see the stolen culture of this man in the last - dreamlike episode - of the video. The beautiful pictures of a lost country. Pictures of a blond beautiful culture that is lost. Hmmm. I really hope that you are OK, Mister Ratatoskr? Anyway: The Dessau event drags me down. But it makes no sense to discuss this here. There Is a Light That Never Goes Out - The Smiths". You might wonder what the flickering is when moving to the dreamlike episode and overshadowing most of it: it's the bombing of a German city viewed from the allied bombing fleet. You find information about what most likely is meant by Dessau event here (in German.)

    2019-04-04
    • Just recently we discovered that this program leaks some memory in libavformat when run in apply mode and muxing into a matroska container:
      peter@debian-9:~/bs1770gain$ valgrind --leak-check=yes bs1770gain little_feat/1977_rockpalast/04_day_at_the_dog_races.mkv -ao xx
      ==2322== Memcheck, a memory error detector
      ==2322== Copyright (C) 2002-2015, and GNU GPL&d, by Julian Seward et al.
      ==2322== Using Valgrind-3.12.0.SVN and LibVEX; rerun with -h for copyright info
      ==2322== Command: bs1770gain little_feat/1977_rockpalast/04_day_at_the_dog_races.mkv -ao xx
      ==2322==
      analyzing ...
      ;[1/1] "04_day_at_the_dog_races.mkv":
            integrated:  -21.82 LUFS / -1.18 LU
      transcoding ...
        [1/1] "04_day_at_the_dog_races.mkv"
      done.
      ==2322==
      ==2322== HEAP SUMMARY:
      ==2322==     in use at exit: 3,445 bytes in 20 blocks
      ==2322==   total heap usage: 1,874,633 allocs, 1,874,613 frees, 3,062,595,861 bytes allocated
      ==2322==
      ==2322== 100 (12 direct, 88 indirect) bytes in 1 blocks are definitely lost in loss record 11 of 17
      ==2322==    at 0x482F584: memalign (vg_replace_malloc.c:857)
      ==2322==    by 0x482F69B: posix_memalign (vg_replace_malloc.c:1020)
      ==2322==    by 0x4E91E67: av_malloc (in /home/peter/bs1770gain/autoconf/bin/bs1770gain-tools/libavutil.so.56)
      ==2322==    by 0x4E9214A: av_mallocz (in /home/peter/bs1770gain/autoconf/bin/bs1770gain-tools/libavutil.so.56)
      ==2322==    by 0x4E79BFA: av_buffer_ref (in /home/peter/bs1770gain/autoconf/bin/bs1770gain-tools/libavutil.so.56)
      ==2322==    by 0x5091F47: ???
      ==2322==    by 0x64CC712: ???
      ==2322==    by 0x6520DD5: ???
      ==2322==    by 0x110BA8: av_interleaved_write_frame (ffsox_dynload2.c:641)
      ==2322==    by 0x118015: ffsox_stream_interleaved_write (ffsox_stream.c:55)
      ==2322==    by 0x1173F4: frame_writer_encode (ffsox_frame_writer.c:163)
      ==2322==    by 0x1176F7: frame_writer_run (ffsox_frame_writer.c:242)
      ==2322== 
      ==2322== 110 (12 direct, 98 indirect) bytes in 1 blocks are definitely lost in loss record 12 of 17
      ==2322==    at 0x482D1BC: malloc (vg_replace_malloc.c:298)
      ==2322==    by 0x482F4E0: realloc (vg_replace_malloc.c:785)
      ==2322==    by 0x4E91ECB: av_realloc (in /home/peter/bs1770gain/autoconf/bin/bs1770gain-tools/libavutil.so.56)
      ==2322==    by 0x5090FEA: ???
      ==2322==    by 0x50910A1: ???
      ==2322==    by 0x509184D: ???
      ==2322==    by 0x5091F30: ???
      ==2322==    by 0x64CC712: ???
      ==2322==    by 0x6520DD5: ???
      ==2322==    by 0x110BA8: av_interleaved_write_frame (ffsox_dynload2.c:641)
      ==2322==    by 0x118015: ffsox_stream_interleaved_write (ffsox_stream.c:55)
      ==2322==    by 0x1173F4: frame_writer_encode (ffsox_frame_writer.c:163)
      ==2322== 
      ==2322== LEAK SUMMARY:
      ==2322==    definitely lost: 24 bytes in 2 blocks
      ==2322==    indirectly lost: 186 bytes in 3 blocks
      ==2322==      possibly lost: 0 bytes in 0 blocks
      ==2322==    still reachable: 3,235 bytes in 15 blocks
      ==2322==         suppressed: 0 bytes in 0 blocks
      ==2322== Reachable blocks (those to which a pointer was found) are not shown.
      ==2322== To see them, rerun with: --leak-check=full --show-leak-kinds=all
      ==2322==
      ==2322== For counts of detected and suppressed errors, rerun with: -v
      ==2322== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
      peter@debian-9:~/bs1770gain$
    • The issue is already reported.
    • Update 2019-04-11: The issue is fixed (cf. ticket 7827) and the fix is available with the daily snapshot. (Cf. the following threads from FFmpeg-devel:
      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
      • User Hadrien wrote "I've found that bs1770gain wasn't liking '\'s in dirnames" and provided a patch this β-release incorporates.
      • Again modified slightly the build process.
      2018-10-19 0.5.1 Brought back to life building the project with autotools.
      2018-09-02 0.5.0
      • Essentialy the same as v0.5.0-β5.
      • BTW: We noticed that we've forgotten to upload v0.5.0-β4. Hence for completeness we uploaded it joint with v0.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
      • Remuxing files with more then one stream (i.e. video files) was broken. This β-release fixes the issue.
      2018-08-09 0.5.0-β4
      • With v0.5.0-β1 we introduced guarding bs1770gain against being run with incompatible FFmpeg and SoX libraries. At least this was the goal. In case of the FFmpeg libraries the test was done against the full version consiting of major, minor, and micro version numbers. This was by far to much. As far as we know just a bump of the major version number indicates some change in binary compatibility. This release relexas the test to FFmpeg major version number.
      • BTW:
        • Around the time v0.5.0-β1 was released we received the following mail from some Debian official:

        • To be honest, dear Daniel: We're simply not interested in "how a Debian or Free Software user who isn't European is meant to react." We develop open source software and we're from Europe. We're interested in how we as native Europeans feel when overrun by the third world: To us the message of the above mail is nothing else then a typical instance of anti-white "racism" (by no means it is in accordance with the saccharine "sweet" words published by Debian.) To us the idea of developing open source software was always (and possibly will ever) be educational similar to academia and sience. Add the internet and you're in a position to bring it to the smallest village all over the world. In the ages of the internet there's really not the slidest reason for someone interested in open source software leaving his home somewhere in the world coming to Europe for some silly promise made by those (not by us of course, cf. below) obviously nobody ever can keep and that way destroying all the infrastucture we've created here in Europe in the course of thousands of years (just for a free lunch nobody is able to deliver to the whole world anyway.) Contrary to those (who are no native inhabitants of Europe, or to express it by a contemporary fake term they've invented for us goyim: they're refugees themselfs) we, the native inhabitants of Europe, clearly state: Make no mistake, stay at home and learn, learn, learn! Learn as much as you can!
        • We're convinced that the so called refugee crisis is an event staged by those (according to a well known politician a small, rootless, international clique) literally nobody is even allowed to call by their very name (at least here in Europe; cf. the fairytale Rumpelstiltskin: we have to break the spell and again have to learn to call the chosen people by their very name as it was usual for centuries and just nowadys is "prohibided" by some strange "laws" like §130 Volksverhetzung dictated by themselfs) in order to make their wet dream of a new world order become true (either in the clothes of nominal communism or in the clothes of crypto-communism aka liberalism - two sides of the very same coin anyway) and finally make those the masters of the world: liberté, égalité, fraternité for everyone except those who have chosen themselfs to be the masters (update 2019-01-11: cf. also here and here.)
      2018-08-05 0.5.0-β3
      • User Martin reported that the Windows build of prior versions is broken in that when called from a Windows cmd box rather than from MSYS2 it might come up with a message box like
      • Hence this release is of interest just for Windows users in that it fixes the issue.
      • Many thanks, Martin!
      2018-08-02 0.5.0-β2
      • User Michal reported that bs1770gain v0.5.0-β1 is crashing when run with Opus samples.
      • As root cause we could identify that (deprecated) avcodec_decode_audio4() crashes when flushed with AV_CODEC_ID_OPUS.
      • As a workaround flushing the decoder is avoided now for AV_CODEC_ID_OPUS.
      • There&s nothing preventing us from replacing deprectated API avcodec_decode_audio4() by the contemporary replacement API avcodec_send_packet()/avcodec_receive_frame (as already announced for several times. Of course, it&s easier said then done ...)
      • Thanks again Michal!
      2018-07-29 0.5.0-β1
      • Essentially this is a re-compilation against current FFmpeg. As it turned out bs100gain was showing unexpected behaviour when run with current (incompatible) FFmpeg libraries.
      • While at it we guarded bs1770gain against being run with incompatible FFmpeg and SoX libraries.
      • Fixed some bugs:
        • #881131: The bug was forced due to artifical test data faking zero channels:
          peter@debian-9-32:~/msys64/bs1770gain$ ~/bs1770gain/bin/bs1770gain ./bug-881131-channel-underflow/poc -o output
          analyzing ...
          [1/1] "poc": Error channel underflow (0 - should be 1 at min): ffsox_frame_reader_create() - "ffsox_frame_reader.c" (55).
          Error creating frame reader: ffsox_frame_reader_new() - "ffsox_frame_reader.c" (132).
          Error creating frame reader: ffsox_analyze() - "ffsox_analyze.c" (68).
          Error gathering track statistics - "bs1770gain_tree.c" (152).
          peter@debian-9-32:~/msys64/bs1770gain$ _
        • #881132: The bug was forced due to artifical test data faking a number of channels by far greater then the numer supported by FFmpeg:
          peter@debian-9-32:~/msys64/bs1770gain$ ~/bs1770gain/bin/bs1770gain ./bug-881132-channel-overflow/poc -o output
          analyzing ...
          [1/1] "poc": Error channel overflow (31 - should be 8 at max): ffsox_frame_reader_create() - "ffsox_frame_reader.c" (63).
          Error creating frame reader: ffsox_frame_reader_new() - "ffsox_frame_reader.c" (132).
          Error creating frame reader: ffsox_analyze() - "ffsox_analyze.c" (68).
          Error gathering track statistics - "bs1770gain_tree.c" (152).
          peter@debian-9-32:~/msys64/bs1770gain$ _
        • #883198: The bug was forced due to artifical test data fooling FFmpeg to come up with a zero codec id:
          peter@debian-9-32:~/msys64/bs1770gain$ ~/bs1770gain/bin/bs1770gain ./bug-883198-missing-codec-id/poc -o output
          analyzing ...
          [1/1] "poc": Error finding decoder: ffsox_frame_reader_create() - "ffsox_frame_reader.c" (48).
          Error creating frame reader: ffsox_frame_reader_new() - "ffsox_frame_reader.c" (132).
          Error creating frame reader: ffsox_analyze() - "ffsox_analyze.c" (68).
          Error gathering track statistics - "bs1770gain_tree.c" (152).
          peter@debian-9-32:~/msys64/bs1770gain$ _
      • Re-designed the dynamic loader module ("ffsox_dynload.c" vs. "ffsox_dynload2.c").
      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.
      • Fixed ignoring the --audio=<n> option.
      • Fixed crashing with files containing more than 5 audio streams.
      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
      • In "ffsox_frame_convert.c", replaced constant ~0ll by ~0ull (sould fix #811955).
      • Replaced av_free_packet() by av_packet_unref() (should fix #810563).
      2015-12-19 0.4.8
      • There&s a new option --norm=<float> allowing to set the reference loudness to some value apart from -23.0 (EBU R128), -24.0 (ATSC A/85), or -18.0 (ReplayGain 2.0).
      • Loudness values are written to the output console with two places after the decimal point.
      • Regarding the Windows version, added some support for unicode paths (i.e. non-OEM).
      2015-09-15 0.4.7 Fixed a serious bug regarding the -r option.
      2015-09-12 0.4.6
      • There&s a new option --xml for producing XML-output.
      • There&s a new option --stereo. The effect is that down-mix to stereo only happens if requested. The old version always silently down-mixes to stereo which is fixed now.
      • FFmpeg has bumped their version numbers, i.e is not binary compatible to the old version. The new binary release now requires avutil-55, swresample-2, avcodec-57, and avformat-57.
      2015-06-25 0.4.5 Various fixes mainly to make BS1770GAIN compile on various architectures.
      2015-06-22 0.4.4
      • Fixed "stuttering" videos.
      • Thanks to Petter Reinholdtsen there is now an official BS1770GAIN package available on Debian. Read about Petter's plans regarding BS1770GAIN.
      2015-06-15 0.4.3
      • Automake/Autoconf compatible source code distribution.
      • Several fixes.
      2015-06-08 0.4.2 Fixed memory leaks.
      2015-01-29 0.4.1 Several fixes.
      2015-01-14 0.4.0
      • Integrated BS.1770 analysis into the finite state machine.
      • Added automatic TRACK and DISC tags extension.
      • Added --extension <extension> option.
      • Several fixes.
      2015-01-08 0.3.2
      • Added another extension.
      • Several fixes.
      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
      • Fixed a critical bug breaking the whole program (thanks to Michal Šmucr).
      • Improved diagnostic of erroneous command line.
      2014-12-07 0.2.0 Added experimental options.
      2014-12-04 0.1.1
      • Compiled with -O2.
      • Slightly different error handling with getopt_long().
      • Added the FFmpeg and SoX shared objects / dynamic link libraries to the release.
      2014-12-01 0.1.0 Initial release.

      2. Introduction

      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

      BS1770GAIN implements the ITU-R BS.1770 loudness measurement algorithm and makes it accessable to a user in several ways as known from the EBU R128 standard, i.e.

      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.

      3. Usage

      3.1. Loudness Measurement

      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:

      $ 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.
      
      Immediatly BS1770GAIN gives us the (integrated) loudness of each track as well as of the whole album.

      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.
      

      3.2. Applying the Gain

      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:

      $ 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)
      
      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 ~/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.
      

      3.3. Experimental Options

      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

      Such portions of audio are called a block. We assume that at a given time at least one audio block is inside the measurement device, but in general there are more than one are there.

      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:

      EBU R128 defines two such measurement devices,

      The momentary device has the following properties:

      wheras the shorttime device has the following: After all we can calculate 6 measures from the two blocks, two of them are non-standard:

      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.
      

      4. Command Line Syntax

      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
      # _
      

      5. Test Cases

      Results for the EBU R128 test vector:


      Disclaimer: Mit Urteil vom 12. Mai 1998 − 312 O 85/98 − “Haftung für Links” hat das Landgericht (LG) Hamburg entschieden, daß man durch das Setzen eines Links, die Inhalte der gelinkten Seite ggf. mit zu verantworten hat. Dies kann − so das LG − nur dadurch verhindert werden, daß man sich ausdrücklich von diesen Inhalten distanziert. Hiermit distanzieren wir uns ausdrücklich von den verlinkten bzw. zitierten oder als Zitat übernommenen Seiten.