R128GAIN: An EBU R128 compliant loudness scanner |
![]() ![]() |
R128GAIN: An EBU R128 compliant loudness scanner |
Nov 7 2012, 08:15
Post
#476
|
|
![]() Group: Members Posts: 398 Joined: 13-June 10 Member No.: 81467 |
|
|
|
|
Nov 7 2012, 08:44
Post
#477
|
|
|
Group: Members Posts: 36 Joined: 31-December 10 Member No.: 86953 |
Thank you for the quick reply.
Do you think you can fix R128GAIN the way it will work also with embedded artwork? I would prefer not to strip artwork from all my flac-files. Thanks a lot Jean |
|
|
|
Nov 7 2012, 09:27
Post
#478
|
|
![]() Group: Members Posts: 398 Joined: 13-June 10 Member No.: 81467 |
|
|
|
|
Nov 7 2012, 10:01
Post
#479
|
|
|
Group: Members Posts: 36 Joined: 31-December 10 Member No.: 86953 |
Thank you and good luck
|
|
|
|
Nov 9 2012, 16:29
Post
#480
|
|
|
Group: Members Posts: 5 Joined: 25-September 12 Member No.: 103390 |
Just realized that when run with the --a85 option the Loudness result is still notated in LUFS - although the same thing, I think it should be reported as LKFS in accordance with ATSC A/85
Thanks |
|
|
|
Nov 11 2012, 21:19
Post
#481
|
|
![]() Group: Members Posts: 398 Joined: 13-June 10 Member No.: 81467 |
Version 1.0-alpha-7-1 released:
Home: http://r128gain.sourceforge.net/What's new?
![]() CODE $ r128gain --help
An EBU R128 (http://tech.ebu.ch/loudness) compliant loudness scanner. For details refer to "http://r128gain.sourceforge.net/". Usage: r128gain [options] (file|directory)+ [-o <directory> [<format>]] Options: --r128 Run in EBU R128-2011 compliance mode (default). --r128-2011 Run in EBU R128-2011 compliance mode (default). --r128-2010 Run in EBU R128-2010 compliance mode. --a85 Run in ATSC A/85:2011 compliance mode. --a85-2011 Run in ATSC A/85:2011 compliance mode. --rg2 Run in ReplayGain2 compliance mode. --rg Run in ReplayGain compliance mode. --reference=<float> Set reference loudness in LUFS. --r128-compatible Calibrate output according to EBU R128. --rg-compatible Calibrate output according to ReplayGain. --db Use dB as unit rather then LU/TP. --partition=<int> BS.1770 overlap (overlap in % = (1 - 1/partition) * 100%, default: 4, i.e. 75% overlap). --gate=<float> BS.1770 gate (-10.0 .. -8.0, default: -10.0). --rg-calibration=<float> Aequivalent to use for ReplayGain loudness (default: -18.0). --no-peak Don't calculate the maximum peak. --sample-peak Calculate the maxium peak without up-sampling. --true-peak Calculate the maxium peak at 192 kHz (default). --range=on,--range Calculate loudness range (default). --range=off,--no range Don't calculate loudness range. --tags=[rg|bwf] Write ReplayGain (default) or BWF tags. --fast Switch off up-sampling and don't calculate loudness range. --mono=off Treat mono as stereo (default). --mono=on,--mono Don't treat mono as stereo. --quiet Supress output to stdout. --progress=on Display progress (default). --progress=off Don't display progress. --traditional Format output traditionally. --cpown Copy owner attributes (experimental). --cpmod Copy access rights (experimental). --command=<string> Run command on each track. --overwrite Overwrite already existing output files. --in-place Overwrite original files (not recommended). --loglevel=<integer> Set FFmpeg loglevel. --regression Calculate linear regression between EBU R128 and ReplayGain. --duration Print out duration. --version Display version information. --ffmpeg=<path> Directory of the FFmpeg shared libraries. --sox=<path> Directory of the SoX shared libraries. --lame=<path> Directory of the Lame shared libraries. --magick=<path> Directory of the ImageMagick shared libraries. --help Display this information. Format: mkv Wrap into MKV container (recommended). flac Encode into FLAC (not recommend). lame [album|track [<float>]] Convert into MP3 and apply album (default) or track gain with quality (default: 2.0). $ _ |
|
|
|
Nov 11 2012, 22:08
Post
#482
|
|
|
Group: Members Posts: 36 Joined: 31-December 10 Member No.: 86953 |
Hi,
with the new version, R128GAIN did not crash anymore while treating flac files with embedded artwork (on a sample of 20 files). Thank you very much for your responsiveness. Best regards Jean |
|
|
|
Nov 19 2012, 18:06
Post
#483
|
|
![]() Group: Members Posts: 398 Joined: 13-June 10 Member No.: 81467 |
There was a report over there at the FFSoX Player thread regarding an issue with FFmpeg's OOG decoder. That issue also affects R128GAIN, hence you should upgrade to version 1.0-alpha-7-2:
http://sourceforge.net/projects/r128gain/files/r128gain/1.0/ |
|
|
|
Nov 21 2012, 02:54
Post
#484
|
|
|
Group: Members Posts: 8 Joined: 21-November 12 Member No.: 104659 |
First, thank you for the excellent implementation of EBU-R128. After watching the youtube videos on the Loudness Wars from 2011, I'm convinced that R128 is best measure for loudness of general material that we have.
I recently purchased The Lord of the Rings extended blu-ray set, and ran into a problem. As you might know, the three films are split into two discs each. The soundtrack is DTS MA 6.1 24-bit, which results in very large files when combined from the two discs. Due to the size of soundtracks, I always use FLAC to help audio processing tools deal with the file sizes. Unfortunately though, it appears that r128gain has difficulty with FLAC files over 4GB in size. Once the progress reaches 100%, it remains there for a long time before failing due to a malloc error. However, SoX does not have this limitation for processing gain on FLAC files greater than 4GB in size (in this case a 6.92GB file). I was able to circumvent this issue by having r128gain process the two parts as an album, and then use SoX to apply the gain to the whole FLAC soundtrack. I realize that having FLAC files greater than 4GB is pretty uncommon, but if r128gain could handle them natively, I believe others would benefit in the future. Again, thank you for this project as I know how much effort it takes to do these sorts of projects. |
|
|
|
Nov 21 2012, 03:58
Post
#485
|
|
|
Group: Members Posts: 14 Joined: 1-August 12 Member No.: 101914 |
@ pbelkner -
Thanks for everything thus far and all the hard work. I'm not sure but I thought that R128Gain worked on MP4 files...not sure if there was some change in FFMpeg or what...or if I'm just recalling correctly. At present I don't see any tags set or anything in the atoms...which I think is the only place tags are placed on MP4's (.mp4, .m4a, .m4v, .m4b) AtomicParsley should display all atom information in a MP4 container. CODE AtomicParsley.exe path\to.mp4 -t Which should display something like: QUOTE Atom "----" [replaygain_track_gain] contains: -9.07 dB Atom "----" [replaygain_album_gain] contains: -9.07 dB Atom "----" [replaygain_album_peak] contains: 1.116816 Atom "----" [replaygain_track_peak] contains: 1.116816 Or QUOTE Atom "----" [replaygain_track_gain] contains: 0.53 Atom "----" [replaygain_track_peak] contains: 0.27 Atom "----" [replaygain_track_minmax] contains: 96,179 The last one is what is written by AACGain...the first one clue...just an example I seen on the web. Maybe the following lib might be of use: TagLib Again many thanks for all that you have done. |
|
|
|
Nov 21 2012, 10:12
Post
#486
|
|
![]() Group: Members Posts: 1150 Joined: 4-May 04 From: France Member No.: 13875 |
Am I doing it right?
CODE ./r128gain --rg-compatible --in-place --tags=rg ./album.flac "album.flac" is a 74 minutes album. That command took 264 seconds to complete on 2.2 GHz mobile Core i7, vs. 19 seconds for the equivalent metaflac command, and 13 seconds for fb2k. That's 14-20 times slower -------------------- caudec -c lossyTAK -q S *.flac
|
|
|
|
Nov 21 2012, 17:59
Post
#487
|
|
![]() Group: Members Posts: 398 Joined: 13-June 10 Member No.: 81467 |
Am I doing it right? CODE ./r128gain --rg-compatible --in-place --tags=rg ./album.flac "album.flac" is a 74 minutes album. That command took 264 seconds to complete on 2.2 GHz mobile Core i7, vs. 19 seconds for the equivalent metaflac command, and 13 seconds for fb2k. That's 14-20 times slower In order to avoid comparing apples with beans you should provide the "--fast" option. The "--fast" option switches off calculating the loudness range and calculating true peak which is on by default and not done by the other tools. Especially true peak calculation is really time consuming because of up-sampling. |
|
|
|
Nov 21 2012, 18:54
Post
#488
|
|
![]() Group: Members Posts: 1150 Joined: 4-May 04 From: France Member No.: 13875 |
I see. The equivalent would actually be the following command line (--fast suppresses peak calculation):
CODE ./r128gain --rg-compatible --sample-peak --range=off --tags=rg --in-place ./album.flac That command completes in 30 seconds. Still a ways off from metaflac and fb2k, but much better. I have to say, the default settings are so slow, they're downright off-putting. A few observations:
-------------------- caudec -c lossyTAK -q S *.flac
|
|
|
|
Nov 23 2012, 10:43
Post
#489
|
|
![]() Group: Members Posts: 398 Joined: 13-June 10 Member No.: 81467 |
I'm not sure but I thought that R128Gain worked on MP4 files...not sure if there was some change in FFMpeg or what...or if I'm just recalling correctly. This has never worked and by looking into the respective FFmpeg muxer "libavformat/movenc.c" it seems to be impossible (at least for now). That's the reason why "r128gain" offers the MKV format: The untouched audio and video streams taken from the MP4 container are just wrapped into a MKV container which can be tagged as intended. |
|
|
|
Nov 25 2012, 20:51
Post
#490
|
|
![]() Group: Members Posts: 398 Joined: 13-June 10 Member No.: 81467 |
Version 1.0-alpha-7-3 released:
Home: http://r128gain.sourceforge.net/What's new?
|
|
|
|
Nov 26 2012, 22:10
Post
#491
|
|
|
Group: Members Posts: 12 Joined: 1-August 12 Member No.: 101938 |
Hi Peter,
thanks for the update indeed! Version 1.0-alpha-7-3 released: Home: http://r128gain.sourceforge.net/ Your comments are much appreciated too. In fact, I would much appreciate if you would consider to increase the scanner performance (decrease the CPU+HDD consumption time) since this is my main reason to not convert my entire music library from RG to EBU. Happy coding, xTobix |
|
|
|
Nov 28 2012, 00:11
Post
#492
|
|
|
Group: Members Posts: 8 Joined: 21-November 12 Member No.: 104659 |
QUOTE Unfortunately though, it appears that r128gain has difficulty with FLAC files over 4GB in size. Once the progress reaches 100%, it remains there for a long time before failing due to a malloc error. However, SoX does not have this limitation for processing gain on FLAC files greater than 4GB in size (in this case a 6.92GB file). I did some more digging into this issue, and I was mistaken. It turns out the problem isn't the file size, but the number of samples that the file contains. If there are more than 2^29 (536.87M) samples, then r128gain hits 100% and hangs. To reproduce the issue, use SoX to create a stereo 24-bit pinknoise file: contains 533M samples and finishes CODE SoX -S -n -c 2 works.flac synth 3:10:00 pinknoise contains 547M samples and hangs CODE SoX -S -n -c 2 fails.flac synth 3:15:00 pinknoise I believe the issue is simply a 32-bit integer being used for counting the number 4x oversampling samples to process. My 2 cents. |
|
|
|
Nov 28 2012, 18:59
Post
#493
|
|
|
Group: Members Posts: 15 Joined: 1-October 05 From: New York, NY Member No.: 24823 |
hi. just tried this for the first time, very impressive. i am able to successfully scan:
CODE Problem Event Name: APPCRASH Application Name: r128gain.exe Application Version: 0.0.0.0 Application Timestamp: 50b266f2 Fault Module Name: avformat-54.dll Fault Module Version: 0.0.0.0 Fault Module Timestamp: 50b2545c Exception Code: c0000094 Exception Offset: 00232a9b OS Version: 6.1.7601.2.1.0.256.48 Locale ID: 1033 Additional Information 1: 0a9e Additional Information 2: 0a9e372d3b4ad19135b953a78882e789 Additional Information 3: 0a9e Additional Information 4: 0a9e372d3b4ad19135b953a78882e789 I followed the instructions on the project home page QUOTE In order to upgrade to full FFmpeg support (i.e. to all FFmpeg supported formats and codecs, unfortunately not including Wavpack) do the following:
What am I doing wrong? thank you --jay |
|
|
|
Nov 30 2012, 00:59
Post
#494
|
|
|
Group: Members Posts: 14 Joined: 1-August 12 Member No.: 101914 |
@ jaynyc -
I posted about this just a few posts above yours...however there is a work around...well haven't tried it but should work. What needs to be done for the time being is to process the file with R128Gain, then take that information and pass it to AACGain. CODE r128gain.exe --r128-2011 --true-peak --db "C:\test.mp4" --command="aacgain.exe /r /f /g %TGDB% \"%NAME%\""
|
|
|
|
Dec 2 2012, 19:05
Post
#495
|
|
![]() Group: Members Posts: 398 Joined: 13-June 10 Member No.: 81467 |
What am I doing wrong? Nothing. I've tried to reproduce the crash but was unable. According to your report the program crashes in "libavformat", hence future versions of FFmpeg may avoid this. But anyway, even if the program doesn't crash it is currently unable to write tags to MP4. You may consider Nologic's advice: CODE r128gain.exe --r128-2011 --true-peak --db "C:\test.mp4" --command="aacgain.exe /r /f /g %TGDB% \"%NAME%\"" This post has been edited by pbelkner: Dec 2 2012, 19:05 |
|
|
|
Dec 2 2012, 19:27
Post
#496
|
|
![]() Group: Members Posts: 398 Joined: 13-June 10 Member No.: 81467 |
Writing tags to a flac file seems to completely replace the existing vorbis comments block, without using existing padding, thus forcing a full rewrite of the entire file. That's highly inefficient, and padding blocks were meant to avoid exactly that. Use them! In fact, I would much appreciate if you would consider to increase the scanner performance (decrease the CPU+HDD consumption time) since this is my main reason to not convert my entire music library from RG to EBU. I believe the issue is simply a 32-bit integer being used for counting the number 4x oversampling samples to process. My 2 cents. Most if not all of these issues are introduced by the frameworks on which "r128gain" is based. Fortunately we can expect them to disappear as time evolves. In the meantime some specialized tools may help out, as e.g. "flac1770": http://www.hydrogenaudio.org/forums/index....showtopic=98163 |
|
|
|
Dec 4 2012, 01:55
Post
#497
|
|
|
Group: Members Posts: 131 Joined: 3-October 02 From: Santa Monica, CA Member No.: 3472 |
How do I get R128Gain to work with MP3s on Linux/Ubuntu? All of the help I've ssen for MP3s references Win32 builds of FFMPEG which I'm assuming would not work on Linux. Is there a way to get R128Gain to use my current or new install of FFMPEG or Libav (since I believe that's what Ubunutu now uses)?
Thanks in advance for any input. -------------------- Sorry, I have nothing witty to say here.
|
|
|
|
Dec 4 2012, 08:09
Post
#498
|
|
![]() Group: Members Posts: 398 Joined: 13-June 10 Member No.: 81467 |
How do I get R128Gain to work with MP3s on Linux/Ubuntu? All of the help I've ssen for MP3s references Win32 builds of FFMPEG which I'm assuming would not work on Linux. Is there a way to get R128Gain to use my current or new install of FFMPEG or Libav (since I believe that's what Ubunutu now uses)? Thanks in advance for any input. You have two options:
|
|
|
|
Dec 4 2012, 19:28
Post
#499
|
|
|
Group: Members Posts: 8 Joined: 21-November 12 Member No.: 104659 |
QUOTE Most if not all of these issues are introduced by the frameworks on which "r128gain" is based. Fortunately we can expect them to disappear as time evolves. I was able to reproduce the hanging issue outside r128gain by running: CODE sox -V -S -r 48000 -b 24 -n -n synth 3:10:00 pinknoise rate 96000 rate 192000 So I dove into the SoX source code and located the problem in the rate effect. They are improperly casting size_t to an int which fails at the 2^31 boundary for integers. To fix the issue I created a patch file. sox-14.4.0.patch: CODE diff -cr sox-14.4.0/src/rate.c sox-14.4.0/src-update/rate.c *** sox-14.4.0/src/rate.c Tue Dec 27 22:15:32 2011 --- sox-14.4.0/src-update/rate.c Tue Dec 4 11:04:47 2012 *************** *** 397,403 **** size_t remaining = samples_out - p->samples_out; sample_t * buff = calloc(1024, sizeof(*buff)); ! if ((int)remaining > 0) { while ((size_t)fifo_occupancy(fifo) < remaining) { rate_input(p, buff, (size_t) 1024); rate_process(p); --- 397,403 ---- size_t remaining = samples_out - p->samples_out; sample_t * buff = calloc(1024, sizeof(*buff)); ! if (samples_out > p->samples_out) { while ((size_t)fifo_occupancy(fifo) < remaining) { rate_input(p, buff, (size_t) 1024); rate_process(p); and added it to r128gain's Makefile: CODE .PRECIOUS: unpack/$(SOX)/configure unpack/$(SOX)/configure: $(DOWNLOAD)/$(SOX).tar.bz2 mkdir -p unpack tar xfvj $< -C unpack cd unpack; patch -p0 -i $(SRC)/patch/$(SOX).patch <---- added touch $@ I also submitted a bug report to the SoX sourceforge team. In the meantime you are welcome to use this patch file if you wish. Thanks again for r128gain, it is a great tool. |
|
|
|
Dec 5 2012, 03:07
Post
#500
|
|
|
Group: Members Posts: 131 Joined: 3-October 02 From: Santa Monica, CA Member No.: 3472 |
How do I get R128Gain to work with MP3s on Linux/Ubuntu? All of the help I've ssen for MP3s references Win32 builds of FFMPEG which I'm assuming would not work on Linux. Is there a way to get R128Gain to use my current or new install of FFMPEG or Libav (since I believe that's what Ubunutu now uses)? Thanks in advance for any input. You have two options:
Since I am using Ubuntu I am unfortuantely stuck with Libav. Trying option number two I get the following error: CODE '/home/chris/Downloads/r128gain-1.0-alpha-7-3/r128gain' --rg2 --ffmpeg=/usr/lib/x86_64-linux-gnu/ --overwrite '/home/chris/Desktop/(2003) Glass Wars' SoX sucessfully loaded. Error loading FFmpeg. Falling back to SoX. /home/chris/Desktop/(2003) Glass Wars formats: no handler for file extension `mp3' formats: no handler for file extension `mp3' formats: no handler for file extension `mp3' formats: no handler for file extension `mp3' formats: no handler for file extension `mp3' formats: no handler for file extension `mp3' formats: no handler for file extension `mp3' Done. When I tried downloading FFMPEG files from here and replacing the files in the r128gain-tools folder I get the following error: CODE '/home/chris/Downloads/r128gain-1.0-alpha-7-3/r128gain' --rg2 --overwrite '/home/chris/Desktop/(2003) Glass Wars' SoX sucessfully loaded. Error loading FFmpeg. Falling back to SoX. /home/chris/Desktop/(2003) Glass Wars formats: no handler for file extension `mp3' formats: no handler for file extension `mp3' formats: no handler for file extension `mp3' formats: no handler for file extension `mp3' formats: no handler for file extension `mp3' formats: no handler for file extension `mp3' formats: no handler for file extension `mp3' Done. Any suggestions? -------------------- Sorry, I have nothing witty to say here.
|
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 20th June 2013 - 04:12 |