magicgoose / simple_dr_meter

An (optimized) implementation of the music DR measurement (compliant with http://dr.loudness-war.info/), it supports CUE sheets and is faster than all currently available alternatives (at the time of writing, not sure about now)
GNU General Public License v3.0
20 stars 3 forks source link

Test the accuracy and speed of ffmpeg's built in `drmeter` filter, perhaps use it for the metric calculation #4

Open magicgoose opened 6 years ago

magicgoose commented 6 years ago

https://www.ffmpeg.org/ffmpeg-filters.html#drmeter

magicgoose commented 6 years ago

Surprisingly, when I use ffmpeg's drmeter filter, it's consistently ~1.2x slower. Looks like it's not ready yet.

$ time ffmpeg -hide_banner -i test.flac -af drmeter -map 0:a -f wav -y /dev/null
…
real    0m3.046s

$ time simple_dr_meter --no-log test.flac
…
real    0m2.573s

test.flac is about 1 hour long, stereo, in CDDA resolution.

1nikolas commented 4 years ago

I tried the drmeter filter on ffmpeg but it seems that its not accurate. Sometimes it works just fine (compared to the official tt meter app), both left and right values are correct. But sometimes it just doesn't work. Either one of the values it off by 1 or 2 or just both are wrong. I tried many files and codecs but the result kept being random.

Here are some photos where I tested all dr meters I could find side by side (with the exact same file)

received_363778917932129 received_225068745491061 received_1730023577140211 received_229086075022254

Perhaps if someone knows C can fix it? Here is the file https://github.com/FFmpeg/FFmpeg/blob/master/libavfilter/af_drmeter.c

richardpl commented 2 years ago

I get constantly drmeter filter speed faster that this python code. I also improved precision issues in filter itself.

magicgoose commented 2 years ago

@richardpl that's good to hear! In that case maybe I could finally switch to ffmpeg for this task and drastically reduce python dependencies (numpy, etc).

ocococococ commented 1 year ago

Me too, I would like to reduce a lot of dependencies in my own audio tools. Hence, I also tried ffmpeg built-in drmeter and can conclude the same as 1nikolas above. And with some audio files, it even produces negative values ! So, sometimes ago, I created a ticket here https://trac.ffmpeg.org/ticket/10232 to report the problem with a sample file. But so far, no answer.

sergeevabc commented 9 months ago

Any news, folks?

magicgoose commented 9 months ago

not really, I mostly lost interest in this topic but occasionally when I'm curious to check those values for some reason, this script of mine still works fine (important to remember that these values do not correlate very well with the actual perceived distortion, etc. although when it's <= 3 then it would almost guarantee obvious problems...)

sergeevabc commented 9 months ago

Windows command to calculate DR if anyone needs it:

$ ffmpeg -i input.flac -vn -af drmeter -f null -
ocococococ commented 9 months ago

The ffmpeg bug mentioned here (https://trac.ffmpeg.org/ticket/10232) seems indeed fixed. I've just installed ffmpeg 6.1.1 on my mac and no more negative DR values.

sergeevabc commented 9 months ago

Which parts of the report can be collected with FFMPEG, and which parts still require Python? DR is possible to get via drmeter, what about Peak and RMS values? I see that ffmpeg -i input.flac -vn -af astats -f null - returns Overall section where Peak level dB matches the result from the report, but RMS level dB does not.