Opened 2 years ago

Closed 17 months ago

Last modified 14 months ago

#11078 closed defect (fixed)

Speex decoding speed regression?

Reported by: Ronald Owned by:
Priority: important Component: avcodec
Version: git-master Keywords: speex
Cc: Ronald, MasterQuestionable, escape0707, Yuzu Vita Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: yes

Description (last modified by Ronald)

Summary of the bug:
ffplay plays .spx very slowly
How to reproduce:

% ffplay test.spx
built on arch linux
ffplay version n7.0.1 Copyright (c) 2003-2024 the FFmpeg developers
built with gcc 14.1.1 (GCC) 20240522
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-frei0r --enable-gmp --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libdvdnav --enable-libdvdread --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libharfbuzz --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librsvg --enable-librubberband --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-mbedtls --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-vapoursynth --enable-version3 --enable-vulkan
libavutil      59.  8.100 / 59.  8.100
libavcodec     61.  3.100 / 61.  3.100
libavformat    61.  1.100 / 61.  1.100
libavdevice    61.  1.100 / 61.  1.100
libavfilter    10.  1.100 / 10.  1.100
libswscale      8.  1.100 /  8.  1.100
libswresample   5.  1.100 /  5.  1.100
libpostproc    58.  1.100 / 58.  1.100

Attachments (1)

test.spx (3.2 KB ) - added by Ronald 2 years ago.
It plays the pronunciation for "hello".

Download all attachments as: .zip

Change History (17)

by Ronald, 2 years ago

Attachment: test.spx added

It plays the pronunciation for "hello".

comment:1 by Ronald, 2 years ago

In an old version (about one or two weeks ago) of ffplay, it plays .spx correctly.
vlc plays .spx correctly.
A sample .spx file is in attachment.

Last edited 2 years ago by Ronald (previous) (diff)

comment:2 by Ronald, 2 years ago

Description: modified (diff)

comment:3 by Ronald, 23 months ago

Priority: normalcritical

comment:4 by Ronald, 23 months ago

Cc: Ronald added

comment:5 by Ronald, 23 months ago

Priority: criticalimportant

comment:6 by MasterQuestionable, 23 months ago

Cc: MasterQuestionable added
Component: ffplayavcodec
Keywords: regression speex added
Summary: ffplay plays .spx very slowlySpeex decoding speed regression?

͏    Speex appears to be a much defunct codec. ("obsoleted by Opus")

͏    Please help ascertain the exact regression window, if you deem it important.
͏    (simple revert may be applicable..?)

comment:7 by Ronald, 23 months ago

If defunct, removing it is better than making it buggy.

comment:8 by MasterQuestionable, 23 months ago

͏    Half-broken better than completely-broken for this case. Supposedly.
͏    Haven't analyzed in detail, but it seems to affect realtime playback (not transcoding)?

comment:9 by escape0707, 22 months ago

Cc: escape0707 added

comment:10 by shenlebantongying, 17 months ago

Cannot we just delete the native speex codec?

FFmpeg currently has 2 speex decoder.

 A....D speex                Speex
 A....D libspeex             libspeex Speex (codec speex)

The native one (speex) has been broken since the release of 7.0. Either nobody really cares or it doesn't worth the time and no one is motivated to fix it.

Having a working one is better than having a broken one. The libspeex one simply works.

comment:11 by shenlebantongying, 17 months ago

The exact error is in libavcodec/speexdec.c -> parse_speex_extradata where the frame_size calculation is wrong.

comment:12 by MasterQuestionable, 17 months ago

Analyzed by developer: set

͏    Would you propose the fix directly? (GitHub direct commit)
͏    Alike: https://trac.ffmpeg.org/ticket/5514#comment:22

͏    Meanwhile "-c:a libspeex" (as input option (before ͏"-i") ) should workaround.


͏    Known that there are several other buggy codecs too.
͏    "aac", "opus", "vorbis", ...
͏    Maybe the better fix is to change the default decoder?

Last edited 17 months ago by MasterQuestionable (previous) (diff)

comment:13 by shenlebantongying, 17 months ago

Hi, I made a patch by poking around last night.

https://ffmpeg.org/pipermail/ffmpeg-devel/2025-January/338959.html

I am not sure about correctness because I have almost no relevant knowledge.

However, it does fix the test files in the bug reports. Someone more competent maybe can take a look and take over to do it properly.

Maybe the better fix is to change the default decoder?

This seems more realistic.

comment:14 by James, 17 months ago

Keywords: regression removed
Resolution: fixed
Status: newclosed
Version: 7.0git-master

comment:15 by shenlebantongying, 17 months ago

Thank you, James! I tested locally, it works :)

However, at the exact same location and also frame_size related, there are other test files that don't work in another ticket #11054.

I put a code change in #11054 that only works on the specific test files.

Last edited 17 months ago by shenlebantongying (previous) (diff)

comment:16 by Yuzu Vita, 14 months ago

Cc: Yuzu Vita added
Note: See TracTickets for help on using tickets.