Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
magicgoose opened this issue Apr 22, 2018 · 10 comments
Assignees

Comments

@magicgoose
Copy link
Owner

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

@magicgoose magicgoose self-assigned this Apr 22, 2018
@magicgoose
Copy link
Owner Author

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
Copy link

1nikolas commented Apr 24, 2020

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
Copy link

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

@magicgoose
Copy link
Owner Author

@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
Copy link

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
Copy link

Any news, folks?

@magicgoose
Copy link
Owner Author

magicgoose commented Jan 27, 2024

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
Copy link

sergeevabc commented Jan 27, 2024

Windows command to calculate DR if anyone needs it:

$ ffmpeg -i input.flac -vn -af drmeter -f null -

@ocococococ
Copy link

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
Copy link

sergeevabc commented Feb 2, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants