alexkay / spek

Acoustic spectrum analyser
http://spek.cc
GNU General Public License v3.0
2.66k stars 262 forks source link

Replace deprecated FFmpeg APIs to support FFmpeg 5.x #232

Closed MikeWang000000 closed 1 year ago

alexkay commented 2 years ago

Thanks Mike! make check is failing on a few samples, I'll investigate and follow up.

matteobin commented 1 year ago

Dear Alex, I would need this to be merged to build Spek on Debian unstable, because unstable FFmpeg version is 5.1.2.

We need to hurry, if we want to bring Spek back to Debian 12, because testing is soft freezing in February. Please, it's just a small step.

Thank you!

alexkay commented 1 year ago

@matteobin, I'll either fix these issues or merge the patch in as is before the new year. Sorry for delay :sweat:

alexkay commented 1 year ago

I merged a lightly edited version of this, see b956c1fd78cea3a79d0cbfa91e9d5c1b0a71229e.

I'm going to keep this open until we find a solution to a few formats not working. See reports in #218 and MikeWang000000/spek-X/issues/4.

They match the failed test cases too:

% make check
...
audio info: 1ch-96000Hz-24bps.ape
audio read: 1ch-96000Hz-24bps.ape
FAIL: samples, expected: 9600, actual: 4608
audio info: 1ch-96000Hz-24bps.flac
audio read: 1ch-96000Hz-24bps.flac
audio info: 1ch-96000Hz-24bps.wv
audio read: 1ch-96000Hz-24bps.wv
[mp3 @ 0x562d899a9fc0] Format mp3 detected only with low score of 25, misdetection possible!
audio info: 2ch-44100Hz-128cbr.mp3
audio read: 2ch-44100Hz-128cbr.mp3
[mp3float @ 0x562d899c5f80] Could not update timestamps for skipped samples.
[mp3float @ 0x562d899c5f80] Could not update timestamps for discarded samples.
audio info: 2ch-44100Hz-16bps.m4a
audio read: 2ch-44100Hz-16bps.m4a
audio info: 2ch-44100Hz-16bps.wav
audio read: 2ch-44100Hz-16bps.wav
[mp3 @ 0x562d899c6e00] Format mp3 detected only with low score of 25, misdetection possible!
audio info: 2ch-44100Hz-320cbr.mp3
audio read: 2ch-44100Hz-320cbr.mp3
[mp3float @ 0x562d899c7580] Could not update timestamps for skipped samples.
[mp3float @ 0x562d899c7580] Could not update timestamps for discarded samples.
[mp3 @ 0x562d899ad740] Format mp3 detected only with low score of 25, misdetection possible!
audio info: 2ch-44100Hz-V0.mp3
audio read: 2ch-44100Hz-V0.mp3
[mp3float @ 0x562d899c2580] Could not update timestamps for skipped samples.
[mp3float @ 0x562d899c2580] Could not update timestamps for discarded samples.
[mp3 @ 0x562d899c4140] Format mp3 detected only with low score of 25, misdetection possible!
audio info: 2ch-44100Hz-V2.mp3
audio read: 2ch-44100Hz-V2.mp3
[mp3float @ 0x562d899c4b40] Could not update timestamps for skipped samples.
[mp3float @ 0x562d899c4b40] Could not update timestamps for discarded samples.
audio info: 2ch-44100Hz-q100.m4a
audio read: 2ch-44100Hz-q100.m4a
FAIL: samples, expected: 5120, actual: 0
FAIL: power, expected: 0, actual: -nan
audio info: 2ch-44100Hz-q5.ogg
audio read: 2ch-44100Hz-q5.ogg
FAIL: samples, expected: 4672, actual: 0
FAIL: power, expected: 0, actual: -nan
[mpc8 @ 0x562d899e5c80] Multiple frames in a packet.
audio info: 2ch-44100Hz-std.mpc
audio read: 2ch-44100Hz-std.mpc
[mpc8 @ 0x562d899d49c0] Multiple frames in a packet.
FAIL: samples, expected: 5760, actual: 1152
audio info: 2ch-44100Hz-v1.wma
audio read: 2ch-44100Hz-v1.wma
FAIL: samples, expected: 6144, actual: 0
FAIL: power, expected: 0, actual: -nan
audio info: 2ch-44100Hz-v2.wma
audio read: 2ch-44100Hz-v2.wma
FAIL: samples, expected: 6144, actual: 0
FAIL: power, expected: 0, actual: -nan
[ac3 @ 0x562d899be9c0] Format ac3 detected only with low score of 1, misdetection possible!
[ac3 @ 0x562d899be9c0] Estimating duration from bitrate, this may be inaccurate
audio info: 2ch-44100Hz.ac3
audio read: 2ch-44100Hz.ac3
[dts @ 0x562d899cab40] Estimating duration from bitrate, this may be inaccurate
audio info: 2ch-44100Hz.dts
audio read: 2ch-44100Hz.dts
audio info: 2ch-48000Hz-16bps.ape
audio read: 2ch-48000Hz-16bps.ape
FAIL: samples, expected: 4800, actual: 4608
audio info: 2ch-48000Hz-16bps.flac
audio read: 2ch-48000Hz-16bps.flac
audio info: 2ch-48000Hz-16bps.wv
audio read: 2ch-48000Hz-16bps.wv
audio info: no.file 
audio read: no.file 
fft const
fft sine
vercmp
11/480 tests failed
FAIL: test
matteobin commented 1 year ago

Should we release a new version to simplify Debian packaging?

alexkay commented 1 year ago

Should we release a new version to simplify Debian packaging?

Yes, give me a few days.

alexkay commented 1 year ago

d96a6e58ec9140f2b0ae6b244dc404ce6fe8ffac should fix decoding for m4a, ogg, and a few other formats. Going to close this. A new release will be cut in a day or two.

alexkay commented 1 year ago

I revamped the entire decoding process, following updated FFmpeg docs. 1cb3e9dd14012114aefc1b2348573257fcfd4e21 fixes all test cases.

MikeWang000000 commented 1 year ago

Hi Alex, there're still some failed test cases under macOS Apple Silicon:

make check log (click me) ``` Making check in data Making check in icons Making check in 16x16 make[3]: Nothing to be done for `check'. Making check in 22x22 make[3]: Nothing to be done for `check'. Making check in 24x24 make[3]: Nothing to be done for `check'. Making check in 32x32 make[3]: Nothing to be done for `check'. Making check in 48x48 make[3]: Nothing to be done for `check'. Making check in scalable make[3]: Nothing to be done for `check'. make[3]: Nothing to be done for `check-am'. make[2]: Nothing to be done for `check-am'. Making check in man make[1]: Nothing to be done for `check'. Making check in po make[1]: Nothing to be done for `check'. Making check in src make[1]: Nothing to be done for `check'. Making check in tests /Library/Developer/CommandLineTools/usr/bin/make test perf make[2]: `test' is up to date. make[2]: `perf' is up to date. /Library/Developer/CommandLineTools/usr/bin/make check-TESTS ------------- audio info: 1ch-96000Hz-24bps.ape audio read: 1ch-96000Hz-24bps.ape audio info: 1ch-96000Hz-24bps.flac audio read: 1ch-96000Hz-24bps.flac audio info: 1ch-96000Hz-24bps.wv audio read: 1ch-96000Hz-24bps.wv [mp3 @ 0x11de04470] Format mp3 detected only with low score of 25, misdetection possible! audio info: 2ch-44100Hz-128cbr.mp3 audio read: 2ch-44100Hz-128cbr.mp3 [mp3float @ 0x11de05470] Could not update timestamps for skipped samples. [mp3float @ 0x11de05470] Could not update timestamps for discarded samples. audio info: 2ch-44100Hz-16bps.m4a audio read: 2ch-44100Hz-16bps.m4a audio info: 2ch-44100Hz-16bps.wav audio read: 2ch-44100Hz-16bps.wav [mp3 @ 0x11de04470] Format mp3 detected only with low score of 25, misdetection possible! audio info: 2ch-44100Hz-320cbr.mp3 audio read: 2ch-44100Hz-320cbr.mp3 [mp3float @ 0x11de05470] Could not update timestamps for skipped samples. [mp3float @ 0x11de05470] Could not update timestamps for discarded samples. [mp3 @ 0x11de04470] Format mp3 detected only with low score of 25, misdetection possible! audio info: 2ch-44100Hz-V0.mp3 audio read: 2ch-44100Hz-V0.mp3 [mp3float @ 0x11de05460] Could not update timestamps for skipped samples. [mp3float @ 0x11de05460] Could not update timestamps for discarded samples. [mp3 @ 0x11de04470] Format mp3 detected only with low score of 25, misdetection possible! audio info: 2ch-44100Hz-V2.mp3 audio read: 2ch-44100Hz-V2.mp3 [mp3float @ 0x11de05460] Could not update timestamps for skipped samples. [mp3float @ 0x11de05460] Could not update timestamps for discarded samples. audio info: 2ch-44100Hz-q100.m4a audio read: 2ch-44100Hz-q100.m4a audio info: 2ch-44100Hz-q5.ogg audio read: 2ch-44100Hz-q5.ogg [vorbis @ 0x10de05390] Could not update timestamps for discarded samples. [mpc8 @ 0x10de049c0] Multiple frames in a packet. audio info: 2ch-44100Hz-std.mpc audio read: 2ch-44100Hz-std.mpc [mpc8 @ 0x10de04f50] Multiple frames in a packet. audio info: 2ch-44100Hz-v1.wma audio read: 2ch-44100Hz-v1.wma audio info: 2ch-44100Hz-v2.wma audio read: 2ch-44100Hz-v2.wma [ac3 @ 0x10de04080] Format ac3 detected only with low score of 1, misdetection possible! [ac3 @ 0x10de04080] Estimating duration from bitrate, this may be inaccurate audio info: 2ch-44100Hz.ac3 audio read: 2ch-44100Hz.ac3 [dts @ 0x10de04080] Estimating duration from bitrate, this may be inaccurate audio info: 2ch-44100Hz.dts audio read: 2ch-44100Hz.dts audio info: 2ch-48000Hz-16bps.ape audio read: 2ch-48000Hz-16bps.ape audio info: 2ch-48000Hz-16bps.flac audio read: 2ch-48000Hz-16bps.flac audio info: 2ch-48000Hz-16bps.wv audio read: 2ch-48000Hz-16bps.wv audio info: no.file audio read: no.file fft const fft sine FAIL: silence, expected: 1, actual: 0 FAIL: silence, expected: 1, actual: 0 FAIL: silence, expected: 1, actual: 0 vercmp 3/480 tests failed FAIL: test PASS: perf =================== 1 of 2 tests failed =================== make[2]: *** [check-TESTS] Error 1 make[1]: *** [check-am] Error 2 make: *** [check-recursive] Error 1 ```
--- a/tests/test-fft.cc
+++ b/tests/test-fft.cc
@@ -62,7 +62,7 @@ static void test_sine()
                 if (i == k) {
                     continue;
                 }
-                if (plan->get_output(i) > -150.0f) {
+                if (plan->get_output(i) > -149.0f) {
                     silence = false;
                     break;
                 }

Making the change above, all tests are passed. Could this be an issue due to loss of precision?

make check log (-149.0f) (click me) ``` Making check in data Making check in icons Making check in 16x16 make[3]: Nothing to be done for `check'. Making check in 22x22 make[3]: Nothing to be done for `check'. Making check in 24x24 make[3]: Nothing to be done for `check'. Making check in 32x32 make[3]: Nothing to be done for `check'. Making check in 48x48 make[3]: Nothing to be done for `check'. Making check in scalable make[3]: Nothing to be done for `check'. make[3]: Nothing to be done for `check-am'. make[2]: Nothing to be done for `check-am'. Making check in man make[1]: Nothing to be done for `check'. Making check in po make[1]: Nothing to be done for `check'. Making check in src make[1]: Nothing to be done for `check'. Making check in tests /Library/Developer/CommandLineTools/usr/bin/make test perf make[2]: `test' is up to date. make[2]: `perf' is up to date. /Library/Developer/CommandLineTools/usr/bin/make check-TESTS ------------- audio info: 1ch-96000Hz-24bps.ape audio read: 1ch-96000Hz-24bps.ape audio info: 1ch-96000Hz-24bps.flac audio read: 1ch-96000Hz-24bps.flac audio info: 1ch-96000Hz-24bps.wv audio read: 1ch-96000Hz-24bps.wv [mp3 @ 0x157604470] Format mp3 detected only with low score of 25, misdetection possible! audio info: 2ch-44100Hz-128cbr.mp3 audio read: 2ch-44100Hz-128cbr.mp3 [mp3float @ 0x157605470] Could not update timestamps for skipped samples. [mp3float @ 0x157605470] Could not update timestamps for discarded samples. audio info: 2ch-44100Hz-16bps.m4a audio read: 2ch-44100Hz-16bps.m4a audio info: 2ch-44100Hz-16bps.wav audio read: 2ch-44100Hz-16bps.wav [mp3 @ 0x157604470] Format mp3 detected only with low score of 25, misdetection possible! audio info: 2ch-44100Hz-320cbr.mp3 audio read: 2ch-44100Hz-320cbr.mp3 [mp3float @ 0x157605470] Could not update timestamps for skipped samples. [mp3float @ 0x157605470] Could not update timestamps for discarded samples. [mp3 @ 0x157604470] Format mp3 detected only with low score of 25, misdetection possible! audio info: 2ch-44100Hz-V0.mp3 audio read: 2ch-44100Hz-V0.mp3 [mp3float @ 0x157605460] Could not update timestamps for skipped samples. [mp3float @ 0x157605460] Could not update timestamps for discarded samples. [mp3 @ 0x157604470] Format mp3 detected only with low score of 25, misdetection possible! audio info: 2ch-44100Hz-V2.mp3 audio read: 2ch-44100Hz-V2.mp3 [mp3float @ 0x157605460] Could not update timestamps for skipped samples. [mp3float @ 0x157605460] Could not update timestamps for discarded samples. audio info: 2ch-44100Hz-q100.m4a audio read: 2ch-44100Hz-q100.m4a audio info: 2ch-44100Hz-q5.ogg audio read: 2ch-44100Hz-q5.ogg [vorbis @ 0x157605980] Could not update timestamps for discarded samples. [mpc8 @ 0x1576050d0] Multiple frames in a packet. audio info: 2ch-44100Hz-std.mpc audio read: 2ch-44100Hz-std.mpc [mpc8 @ 0x157605550] Multiple frames in a packet. audio info: 2ch-44100Hz-v1.wma audio read: 2ch-44100Hz-v1.wma audio info: 2ch-44100Hz-v2.wma audio read: 2ch-44100Hz-v2.wma [ac3 @ 0x157604560] Format ac3 detected only with low score of 1, misdetection possible! [ac3 @ 0x157604560] Estimating duration from bitrate, this may be inaccurate audio info: 2ch-44100Hz.ac3 audio read: 2ch-44100Hz.ac3 [dts @ 0x157604560] Estimating duration from bitrate, this may be inaccurate audio info: 2ch-44100Hz.dts audio read: 2ch-44100Hz.dts audio info: 2ch-48000Hz-16bps.ape audio read: 2ch-48000Hz-16bps.ape audio info: 2ch-48000Hz-16bps.flac audio read: 2ch-48000Hz-16bps.flac audio info: 2ch-48000Hz-16bps.wv audio read: 2ch-48000Hz-16bps.wv audio info: no.file audio read: no.file fft const fft sine vercmp 480 tests passed PASS: test PASS: perf ================== All 2 tests passed ================== ```
matteobin commented 1 year ago

The issue reported by @MikeWang000000 is causing a build failure on Debian arm64 repository: https://buildd.debian.org/status/fetch.php?pkg=spek&arch=arm64&ver=0.8.5%2Bdfsg-1&stamp=1674401278&raw=0

I'm going to use Mike's patch to momentarily fix this issue.