essentia icon indicating copy to clipboard operation
essentia copied to clipboard

Support ffmpeg version 5

Open mguentner opened this issue 3 years ago • 4 comments

While essentia is built using ffmpeg version 2, the dynamically linked library will point to something like /usr/lib/libavcodec.so.59. On recent ArchLinux and soon, a lot of of other distributions, ffmpeg is shipped in version 5.

libavcodec

When importing essentia in python, a linker error is thrown:

❯ python
Python 3.9.10 (main, Mar 12 2022, 17:44:28) 
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import essentia
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/.cache/pypoetry/virtualenvs/essentia-pulse-m4Vcd7y0-py3.9/lib/python3.9/site-packages/essentia/__init__.py", line 1, in <module>
    from . import _essentia
ImportError: /home/user/.cache/pypoetry/virtualenvs/essentia-pulse-m4Vcd7y0-py3.9/lib/python3.9/site-packages/essentia/_essentia.cpython-39-x86_64-linux-gnu.so: undefined symbol: avcodec_decode_audio4
>>> 

avcodec_decode_audio4 among other functions was deprecated for a long time and has been dropped in 5.0 so it needs to be replaced.

There are several other projects affected by this which have the details already documented:

  • https://github.com/osrf/gazebo/issues/3180
  • https://github.com/pytorch/pytorch/issues/72254

Relevant code in essentia, at least for avcodec_decode_audio4: https://github.com/MTG/essentia/blob/07d089fe0fea04cd654b24e2f518775322ff85bb/src/algorithms/io/audioloader.cpp#L264

libavresample

libavresample is also used which needs to be replaced as it has also been removed from ffmpeg.

mguentner avatar Apr 10 '22 11:04 mguentner

Just wanted to add that #1243 is also somewhat related to ffmpeg5 :grinning:.

CartoonFan avatar Apr 27 '22 19:04 CartoonFan

libavresample has been replaced in #811, the rest is pending.

dbogdanov avatar Jul 26 '22 12:07 dbogdanov

In addition to avcodec_decode_audio4, avcodec_encode_audio2 used in MonoWriter need to be replaced by avcodec_send_frame()/avcodec_receive_packet().

dbogdanov avatar Jul 26 '22 13:07 dbogdanov

Also relevant: #1154

dbogdanov avatar Jul 26 '22 13:07 dbogdanov