Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Announcements and Chat > General Discussion

Reply
 
Thread Tools Search this Thread Display Modes
Old 12th February 2024, 15:26   #1  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 989
FFmpeg arnndn filter has bugs?

Test files: https://we.tl/t-TrGUOgj5IN

Command:
Code:
ffmpeg.exe -i out-full.wav -filter_complex [0:a]arnndn=m=sh.rnnn[s0] -map [s0] out-full.sh.wav
Original:


1 case) Spectrograms of result look exactly same on i5-2500M and i7-13700K:


2 case) But for i7-8700K and Ryzen 5 5500 results look like this [both have similar look, but not same]:


Anyone knows what is going on? Or how to debug it?

I tried:
Code:
ffmpeg.exe -i out-full.wav -filter_complex [0:a]arnndn=m=sh.rnnn[s0] -map [s0] o_0.wav -cpuflags 0
For "1" case it didn't had influence, for "2" case it produced ~slightly different spectrograms.

Tried FFmpeg v5.1.2 vs v6.1.1, no influence on "1" case, for "2" case spectrograms ~slightly different.

Last edited by VoodooFX; 12th February 2024 at 15:29.
VoodooFX is offline   Reply With Quote
Old 12th February 2024, 17:36   #2  |  Link
richardpl
Registered User
 
Join Date: Jan 2012
Posts: 271
That second image looks wrong, -cpuflags allows to select some CPU SIMD instructions instead of using all available on CPU.
Perhaps some of SIMD code is buggy in ffmpeg on specific SIMD set for certain CPUs.
Probably AVX2 and higher (AVX512, etc) related. Dunno if float vector dsp is buggy or just FFT TX code.
If on linux you could run perf (on ffmpeg cli with debug symbols not stripped) or similar to inspect which functions get executed on which CPUs.
richardpl is offline   Reply With Quote
Old 12th February 2024, 17:57   #3  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 989
Shouldn't "-cpuflags 0" disable all CPU instructions?

"i5-2500M" - doesn't have avx2 [it's oldest cpu from all tested], but i7-13700K has it and it has same output.

Quote:
Originally Posted by richardpl View Post
That second image looks wrong
I actually like case "1" behavior, it works well on normal audios (out-full.wav is muffled poor quality, probably vhs recording), when in case "2" it performs weak denoise and is very inconsistant.

Quote:
Originally Posted by richardpl View Post
If on linux you could run perf (on ffmpeg cli with debug symbols not stripped) or similar to inspect which functions get executed on which CPUs.
Could you post an exact command and what cli to run?

Last edited by VoodooFX; 12th February 2024 at 18:29.
VoodooFX is offline   Reply With Quote
Old 12th February 2024, 19:08   #4  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 989
Btw I've tested:

Code:
ffmpeg.exe -i out-full.wav -filter_complex [0:a]arnndn=m=sh.rnnn[s0] -map [s0] o_1.wav -cpuflags +mmx+sse+sse2
Similar results as with "-cpuflags 0".
VoodooFX is offline   Reply With Quote
Old 12th February 2024, 20:14   #5  |  Link
richardpl
Registered User
 
Join Date: Jan 2012
Posts: 271
With that specific .wav file I get much better results with this one:
Code:
afftdn=nr=22:tn=1:tr=0:om=o
instead of
Quote:
arnndn=m=sh.rnnn
If you have linux like OS: run: perf record <rest of ffmpeg command>

To get performance results of above run: perf report

The ffmpeg app and dynamic linked ffmpeg libs (libavfilter, libavutil and others) need to have debug symbols to have results meaningful.
richardpl is offline   Reply With Quote
Old 12th February 2024, 21:34   #6  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 989
Not interested in afftdn. [I didn't noticed positive effects for Whisper]

Quote:
Originally Posted by richardpl View Post
The ffmpeg app and dynamic linked ffmpeg libs (libavfilter, libavutil and others) need to have debug symbols to have results meaningful.
I've no idea how to do it, I guess that's where my participation on this ends.

EDIT:
Later I'll check where ffmpeg bugs should be reported.

Last edited by VoodooFX; 12th February 2024 at 21:42.
VoodooFX is offline   Reply With Quote
Old 13th February 2024, 18:21   #7  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 989
Found the culprit of the bug -> Stereo.
With mono input on all CPUs spectrogram looks exactly as the "1" case.

Those RNN models are trained on 48000 mono wavs, first I assumed that audio needs to be pre-converted to that, but ffmpeg didn't complained on input with different Hz/channels and tests on i5-2500M showed no difference on results.

Btw, I don't see input Hz influence on the results with all CPUs.
Still a mystery left why stereo works on i5-2500M and i7-13700K, but doesn't work on i7-8700K and Ryzen 5 5500.
VoodooFX is offline   Reply With Quote
Old 13th February 2024, 19:11   #8  |  Link
richardpl
Registered User
 
Join Date: Jan 2012
Posts: 271
Try with arnndn=m=sh.rnnn:threads=1
richardpl is offline   Reply With Quote
Old 13th February 2024, 20:07   #9  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 989
Quote:
Originally Posted by richardpl View Post
Try with arnndn=m=sh.rnnn:threads=1
That fixes it too, on stereo input the results are same as with mono input.
VoodooFX is offline   Reply With Quote
Old 13th February 2024, 22:12   #10  |  Link
richardpl
Registered User
 
Join Date: Jan 2012
Posts: 271
That is really silly bug.
richardpl is offline   Reply With Quote
Old 13th February 2024, 22:20   #11  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 989
There is ticket -> https://trac.ffmpeg.org/ticket/10863#ticket

Last edited by VoodooFX; 15th February 2024 at 01:34.
VoodooFX is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 18:24.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.