Cannot install ha-av after upgrading to Python 3.10.9

Creating a bug report/issue

Required Information

  • DietPi version | G_DIETPI_VERSION_CORE=8
    G_DIETPI_VERSION_SUB=13
    G_DIETPI_VERSION_RC=2
    G_GITBRANCH=‘master’
    G_GITOWNER=‘MichaIng’
    G_LIVE_PATCH_STATUS[0]=‘applied’

  • Distro version | bullseye 1

  • Kernel version | Linux VanDerMedPlay 5.15.84-v7+ #1613 SMP Thu Jan 5 11:59:48 GMT 2023 armv7l GNU/Linux

  • SBC model | RPI2

  • SD card used | (SanDisk ultra)

Additional Information (if applicable)

  • Software title | HomeAssistant
  • Was the software title installed freshly or updated/migrated? Yes
  • Can this issue be replicated on a fresh installation of DietPi? ?

Steps to reproduce

I did a reinstall of HomeAssistant to upgrade the virtual Python environment to 3.10.9

Expected behaviour

During the reinstall of HomeAsstant it isn’t possible to install ha-av due to de requirement that ffmpeg isn’t version > 5 (current version is 4.2.2)

Actual behaviour

I need to upgrade ffmpeg to version 5 or version 5.1
How can I force this so ha-av can be installed?.

Would it be possible to share the entire error message you are facing?

EDIT

Debian ffmpeg package v5.1.2 is available on Debian Bookworm only. Debian -- Package Search Results -- ffmpeg

Currently I cannot search in my log (not home) but I saw this treat in the HA Community: Unable to install package ha-av==10.0.0b4 - #4 by NeoPolus - Configuration - Home Assistant Community

This is the changelog for ha-av 10.0.0.0: PyAV/CHANGELOG.rst at bc4eedd5fc474e0f25b22102b2771fe5a42bb1c7 · PyAV-Org/PyAV · GitHub

  • add support for FFmpeg 5.0 and 5.1 (:issue:817).
  • Drop support for FFmpeg < 4.3.

I tested with the installation of the previous version ha-av 9.x and this worked, but on the first reboot of the system HA install ha-av version 10.0.0 wich fails. (ha-av version 10.0.0.0 is now a requirement of HA).

Too bad, an apt Debian package ffmpeg v5 will not become available before Debian Bookworm. Probably you would need to build ffmpeg v5 yourself from source.

Can you help me to achive this?

Maybe it’s even possible to use a static build, so you don’t have to build it by your own? They provide abuild for ARMhf:
https://johnvansickle.com/ffmpeg/

See this for installation guide (keep in mind that you have to modify the commands to your actual file name)

A static version of ffmpeg (5.1.1) is installed, but the installattion of ha-av is still failing. This a a part of the log:

2023-01-20 11:09:27.306 ERROR (SyncWorker_9) [homeassistant.util.package] Unable to install package ha-av==10.0.0: error: subprocess-exited-with-error
  
  × Building wheel for ha-av (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [5063 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-armv7l-cpython-310
      creating build/lib.linux-armv7l-cpython-310/av
      copying av/deprecation.py -> build/lib.linux-armv7l-cpython-310/av
      copying av/datasets.py -> build/lib.linux-armv7l-cpython-310/av
      copying av/about.py -> build/lib.linux-armv7l-cpython-310/av
      copying av/__main__.py -> build/lib.linux-armv7l-cpython-310/av
      copying av/__init__.py -> build/lib.linux-armv7l-cpython-310/av
      creating build/lib.linux-armv7l-cpython-310/av/video
      copying av/video/__init__.py -> build/lib.linux-armv7l-cpython-310/av/video
      creating build/lib.linux-armv7l-cpython-310/av/subtitles
      copying av/subtitles/__init__.py -> build/lib.linux-armv7l-cpython-310/av/subtitles
      creating build/lib.linux-armv7l-cpython-310/av/sidedata
      copying av/sidedata/__init__.py -> build/lib.linux-armv7l-cpython-310/av/sidedata
      creating build/lib.linux-armv7l-cpython-310/av/filter
      copying av/filter/__init__.py -> build/lib.linux-armv7l-cpython-310/av/filter
      creating build/lib.linux-armv7l-cpython-310/av/data
      copying av/data/__init__.py -> build/lib.linux-armv7l-cpython-310/av/data
      creating build/lib.linux-armv7l-cpython-310/av/container
      copying av/container/__init__.py -> build/lib.linux-armv7l-cpython-310/av/container
      creating build/lib.linux-armv7l-cpython-310/av/codec
      copying av/codec/__init__.py -> build/lib.linux-armv7l-cpython-310/av/codec
      creating build/lib.linux-armv7l-cpython-310/av/bitstream
      copying av/bitstream/__init__.py -> build/lib.linux-armv7l-cpython-310/av/bitstream
      creating build/lib.linux-armv7l-cpython-310/av/audio
      copying av/audio/__init__.py -> build/lib.linux-armv7l-cpython-310/av/audio
      copying av/utils.pxd -> build/lib.linux-armv7l-cpython-310/av
      copying av/stream.pxd -> build/lib.linux-armv7l-cpython-310/av
      copying av/plane.pxd -> build/lib.linux-armv7l-cpython-310/av
      copying av/packet.pxd -> build/lib.linux-armv7l-cpython-310/av
      copying av/option.pxd -> build/lib.linux-armv7l-cpython-310/av
      copying av/logging.pxd -> build/lib.linux-armv7l-cpython-310/av
      copying av/frame.pxd -> build/lib.linux-armv7l-cpython-310/av
      copying av/format.pxd -> build/lib.linux-armv7l-cpython-310/av
      copying av/error.pxd -> build/lib.linux-armv7l-cpython-310/av
      copying av/enum.pxd -> build/lib.linux-armv7l-cpython-310/av
      copying av/dictionary.pxd -> build/lib.linux-armv7l-cpython-310/av
      copying av/descriptor.pxd -> build/lib.linux-armv7l-cpython-310/av
      copying av/bytesource.pxd -> build/lib.linux-armv7l-cpython-310/av
      copying av/buffer.pxd -> build/lib.linux-armv7l-cpython-310/av
      copying av/__init__.pxd -> build/lib.linux-armv7l-cpython-310/av
      copying av/video/stream.pxd -> build/lib.linux-armv7l-cpython-310/av/video
      copying av/video/reformatter.pxd -> build/lib.linux-armv7l-cpython-310/av/video
      copying av/video/plane.pxd -> build/lib.linux-armv7l-cpython-310/av/video
      copying av/video/frame.pxd -> build/lib.linux-armv7l-cpython-310/av/video
      copying av/video/format.pxd -> build/lib.linux-armv7l-cpython-310/av/video
      copying av/video/codeccontext.pxd -> build/lib.linux-armv7l-cpython-310/av/video
      copying av/video/__init__.pxd -> build/lib.linux-armv7l-cpython-310/av/video
      copying av/subtitles/subtitle.pxd -> build/lib.linux-armv7l-cpython-310/av/subtitles
      copying av/subtitles/stream.pxd -> build/lib.linux-armv7l-cpython-310/av/subtitles
      copying av/subtitles/codeccontext.pxd -> build/lib.linux-armv7l-cpython-310/av/subtitles
      copying av/subtitles/__init__.pxd -> build/lib.linux-armv7l-cpython-310/av/subtitles
      copying av/sidedata/sidedata.pxd -> build/lib.linux-armv7l-cpython-310/av/sidedata
      copying av/sidedata/motionvectors.pxd -> build/lib.linux-armv7l-cpython-310/av/sidedata
      copying av/sidedata/__init__.pxd -> build/lib.linux-armv7l-cpython-310/av/sidedata
      copying av/filter/pad.pxd -> build/lib.linux-armv7l-cpython-310/av/filter
      copying av/filter/link.pxd -> build/lib.linux-armv7l-cpython-310/av/filter
      copying av/filter/graph.pxd -> build/lib.linux-armv7l-cpython-310/av/filter
      copying av/filter/filter.pxd -> build/lib.linux-armv7l-cpython-310/av/filter
      copying av/filter/context.pxd -> build/lib.linux-armv7l-cpython-310/av/filter
      copying av/filter/__init__.pxd -> build/lib.linux-armv7l-cpython-310/av/filter
      copying av/data/stream.pxd -> build/lib.linux-armv7l-cpython-310/av/data
      copying av/data/__init__.pxd -> build/lib.linux-armv7l-cpython-310/av/data
      copying av/container/streams.pxd -> build/lib.linux-armv7l-cpython-310/av/container
      copying av/container/pyio.pxd -> build/lib.linux-armv7l-cpython-310/av/container
      copying av/container/output.pxd -> build/lib.linux-armv7l-cpython-310/av/container
      copying av/container/input.pxd -> build/lib.linux-armv7l-cpython-310/av/container
      copying av/container/core.pxd -> build/lib.linux-armv7l-cpython-310/av/container
      copying av/container/__init__.pxd -> build/lib.linux-armv7l-cpython-310/av/container
      copying av/codec/context.pxd -> build/lib.linux-armv7l-cpython-310/av/codec
      copying av/codec/codec.pxd -> build/lib.linux-armv7l-cpython-310/av/codec
      copying av/codec/__init__.pxd -> build/lib.linux-armv7l-cpython-310/av/codec
      copying av/bitstream/filter.pxd -> build/lib.linux-armv7l-cpython-310/av/bitstream
      copying av/bitstream/context.pxd -> build/lib.linux-armv7l-cpython-310/av/bitstream
      copying av/audio/stream.pxd -> build/lib.linux-armv7l-cpython-310/av/audio
      copying av/audio/resampler.pxd -> build/lib.linux-armv7l-cpython-310/av/audio
      copying av/audio/plane.pxd -> build/lib.linux-armv7l-cpython-310/av/audio
      copying av/audio/layout.pxd -> build/lib.linux-armv7l-cpython-310/av/audio
      copying av/audio/frame.pxd -> build/lib.linux-armv7l-cpython-310/av/audio
      copying av/audio/format.pxd -> build/lib.linux-armv7l-cpython-310/av/audio
      copying av/audio/fifo.pxd -> build/lib.linux-armv7l-cpython-310/av/audio
      copying av/audio/codeccontext.pxd -> build/lib.linux-armv7l-cpython-310/av/audio
      copying av/audio/__init__.pxd -> build/lib.linux-armv7l-cpython-310/av/audio
      running build_ext
      building 'av.utils' extension
      creating build/temp.linux-armv7l-cpython-310
      creating build/temp.linux-armv7l-cpython-310/src
      creating build/temp.linux-armv7l-cpython-310/src/av
      gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include -I/home/homeassistant/.pyenv/versions/3.10.9/include/python3.10 -c src/av/utils.c -o build/temp.linux-armv7l-cpython-310/src/av/utils.o
      In file included from /usr/include/arm-linux-gnueabihf/libavcodec/bsf.h:28,
                       from src/av/utils.c:820:
      /usr/include/arm-linux-gnueabihf/libavcodec/codec_id.h:46:6: error: redeclaration of ‘enum AVCodecID’
         46 | enum AVCodecID {
            |      ^~~~~~~~~
      In file included from src/av/utils.c:811:
      /usr/local/include/libavcodec/avcodec.h:215:6: note: originally defined here
        215 | enum AVCodecID {
            |      ^~~~~~~~~
      In file included from /usr/include/arm-linux-gnueabihf/libavcodec/bsf.h:28,
                       from src/av/utils.c:820:
      /usr/include/arm-linux-gnueabihf/libavcodec/codec_id.h:47:5: error: redeclaration of enumerator ‘AV_CODEC_ID_NONE’
         47 |     AV_CODEC_ID_NONE,
            |     ^~~~~~~~~~~~~~~~
      In file included from src/av/utils.c:811:
      /usr/local/include/libavcodec/avcodec.h:216:5: note: previous definition of ‘AV_CODEC_ID_NONE’ was here
        216 |     AV_CODEC_ID_NONE,
            |     ^~~~~~~~~~~~~~~~
      In file included from /usr/include/arm-linux-gnueabihf/libavcodec/bsf.h:28,
                       from src/av/utils.c:820:
      /usr/include/arm-linux-gnueabihf/libavcodec/codec_id.h:50:5: error: redeclaration of enumerator ‘AV_CODEC_ID_MPEG1VIDEO’
         50 |     AV_CODEC_ID_MPEG1VIDEO,
            |     ^~~~~~~~~~~~~~~~~~~~~~
      In file included from src/av/utils.c:811:
      /usr/local/include/libavcodec/avcodec.h:219:5: note: previous definition of ‘AV_CODEC_ID_MPEG1VIDEO’ was here
        219 |     AV_CODEC_ID_MPEG1VIDEO,
            |     ^~~~~~~~~~~~~~~~~~~~~~
      In file included from /usr/include/arm-linux-gnueabihf/libavcodec/bsf.h:28,
                       from src/av/utils.c:820:
      /usr/include/arm-linux-gnueabihf/libavcodec/codec_id.h:51:5: error: redeclaration of enumerator ‘AV_CODEC_ID_MPEG2VIDEO’
         51 |     AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
            |     ^~~~~~~~~~~~~~~~~~~~~~
      In file included from src/av/utils.c:811:
      /usr/local/include/libavcodec/avcodec.h:220:5: note: previous definition of ‘AV_CODEC_ID_MPEG2VIDEO’ was here
        220 |     AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
            |     ^~~~~~~~~~~~~~~~~~~~~~
      In file included from /usr/include/arm-linux-gnueabihf/libavcodec/bsf.h:28,
                       from src/av/utils.c:820:
      /usr/include/arm-linux-gnueabihf/libavcodec/codec_id.h:52:5: error: redeclaration of enumerator ‘AV_CODEC_ID_H261’
         52 |     AV_CODEC_ID_H261,
            |     ^~~~~~~~~~~~~~~~
      In file included from src/av/utils.c:811:
      /usr/local/include/libavcodec/avcodec.h:221:5: note: previous definition of ‘AV_CODEC_ID_H261’ was here
        221 |     AV_CODEC_ID_H261,
            |     ^~~~~~~~~~~~~~~~
      In file included from /usr/include/arm-linux-gnueabihf/libavcodec/bsf.h:28,
                       from src/av/utils.c:820:
      /usr/include/arm-linux-gnueabihf/libavcodec/codec_id.h:53:5: error: redeclaration of enumerator ‘AV_CODEC_ID_H263’
         53 |     AV_CODEC_ID_H263,
            |     ^~~~~~~~~~~~~~~~
      In file included from src/av/utils.c:811:
      /usr/local/include/libavcodec/avcodec.h:222:5: note: previous definition of ‘AV_CODEC_ID_H263’ was here
        222 |     AV_CODEC_ID_H263,
            |     ^~~~~~~~~~~~~~~~
      In file included from /usr/include/arm-linux-gnueabihf/libavcodec/bsf.h:28,
                       from src/av/utils.c:820:
      /usr/include/arm-linux-gnueabihf/libavcodec/codec_id.h:54:5: error: redeclaration of enumerator ‘AV_CODEC_ID_RV10’
         54 |     AV_CODEC_ID_RV10,
            |     ^~~~~~~~~~~~~~~~
      In file included from src/av/utils.c:811:
      /usr/local/include/libavcodec/avcodec.h:223:5: note: previous definition of ‘AV_CODEC_ID_RV10’ was here
        223 |     AV_CODEC_ID_RV10,
            |     ^~~~~~~~~~~~~~~~
      In file included from /usr/include/arm-linux-gnueabihf/libavcodec/bsf.h:28,
                       from src/av/utils.c:820:
      /usr/include/arm-linux-gnueabihf/libavcodec/codec_id.h:55:5: error: redeclaration of enumerator ‘AV_CODEC_ID_RV20’
         55 |     AV_CODEC_ID_RV20,
            |     ^~~~~~~~~~~~~~~~
      In file included from src/av/utils.c:811:
      /usr/local/include/libavcodec/avcodec.h:224:5: note: previous definition of ‘AV_CODEC_ID_RV20’ was here
        224 |     AV_CODEC_ID_RV20,
            |     ^~~~~~~~~~~~~~~~
      In file included from /usr/include/arm-linux-gnueabihf/libavcodec/bsf.h:28,
                       from src/av/utils.c:820:
      /usr/include/arm-linux-gnueabihf/libavcodec/codec_id.h:56:5: error: redeclaration of enumerator ‘AV_CODEC_ID_MJPEG’
         56 |     AV_CODEC_ID_MJPEG,
            |     ^~~~~~~~~~~~~~~~~
      In file included from src/av/utils.c:811:
      /usr/local/include/libavcodec/avcodec.h:225:5: note: previous definition of ‘AV_CODEC_ID_MJPEG’ was here
        225 |     AV_CODEC_ID_MJPEG,
            |     ^~~~~~~~~~~~~~~~~
      In file included from /usr/include/arm-linux-gnueabihf/libavcodec/bsf.h:28,
                       from src/av/utils.c:820:
      /usr/include/arm-linux-gnueabihf/libavcodec/codec_id.h:57:5: error: redeclaration of enumerator ‘AV_CODEC_ID_MJPEGB’
         57 |     AV_CODEC_ID_MJPEGB,
            |     ^~~~~~~~~~~~~~~~~~
      In file included from src/av/utils.c:811:
      /usr/local/include/libavcodec/avcodec.h:226:5: note: previous definition of ‘AV_CODEC_ID_MJPEGB’ was here
        226 |     AV_CODEC_ID_MJPEGB,
            |     ^~~~~~~~~~~~~~~~~~
      In file included from /usr/include/arm-linux-gnueabihf/libavcodec/bsf.h:28,
                       from src/av/utils.c:820:
      /usr/include/arm-linux-gnueabihf/libavcodec/codec_id.h:58:5: error: redeclaration of enumerator ‘AV_CODEC_ID_LJPEG’
         58 |     AV_CODEC_ID_LJPEG,


note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for ha-av
ERROR: Could not build wheels for ha-av, which is required to install pyproject.toml-based projects
2023-01-20 11:09:27.484 ERROR (MainThread) [homeassistant.setup] Setup failed for stream: Requirements for stream not found: ['ha-av==10.0.0'].

Sorry I have no idea what these errors mean. Maybe you try to build it by yourself then.
They have a guide for this in their wiki: https://trac.ffmpeg.org/wiki/CompilationGuide

ok I did a simple test on my RPi3B+ 32bit ARMv7 and could install ha-av without issues.

homeassistant@DietPi3:~$ pip3 install ha-av
Collecting ha-av
  Using cached ha-av-10.0.0.tar.gz (2.5 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: ha-av
  Building wheel for ha-av (pyproject.toml) ... done
  Created wheel for ha-av: filename=ha_av-10.0.0-cp310-cp310-linux_armv7l.whl size=7263972 sha256=7c20cdc957be1846aa645716943c4a710f8da6b1c2594e9149549c32ac255da4
  Stored in directory: /home/homeassistant/.cache/pip/wheels/fd/43/57/29b57c67284a1e95ebc4fc6699fa289fda5d3ee700e8425eec
Successfully built ha-av
Installing collected packages: ha-av
Successfully installed ha-av-10.0.0
homeassistant@DietPi3:~$

What Version of ffmpeg do you have?

ffmpeg was not required to build ha-av.

So I Could revert to the default Dietpi ffmpeg Version?
What Version of Python do You have?
My errors came Up after reinstall Home Assistant to upgrade Pyhton.

DietPi don’t have a dedicated ffmpeg version. We use the one available from global Debian repository.
And I don’t have installed ffmpeg at all.

I did a clean fresh install of HA on my demo RPi3B+ 32bit. Therefore, it’s Python 3.10. Once HA completed, I switched to HA user, activated dedicated pyenv and run ha-av python install.

I need ffmpeg for my camera’s in HA. Should I try Another reinstall of HA? I Don’t know what else I Could try. Eventually an upgrade of HA? There is a newer Version then the One I have at this moment.

ok I did a clean new install again on my demo system RPi3B+ 32bit. This time I installed ffmpeg as well. But still installation of ha-av is working fine without issues. Following steps I did:

dietpi-software install 7 # FFmpeg
apt install libxml2-dev libxslt1-dev g++ libswresample-dev libswscale-dev libavfilter-dev libavdevice-dev libavcodec-dev pkg-config -y
dietpi-software install 157 # Home Assistant
# Run htop and wait until the CPU usage of the homeassistant processes goes down to nearly zero.
systemctl restart home-assistant
# Run htop and wait until the CPU usage of the homeassistant processes goes down to nearly zero
sudo -u homeassistant bash # switch to HA user
. /home/homeassistant/pyenv-activate.sh
pip3 install ha-av
exit # switch back to root user
systemctl restart home-assistant

Only thing I’m not able to test is the real HA integration as I don’t have any cameras or whatever is needed.

Many thanks for trying to reproduce my problem, but I’m still not able to build ha-av…

I also tried to rebuild grpcio-tools and grpcio with these steps in the venv:

pip3 install cython

export GRPC_BUILD_WITH_BORING_SSL_ASM=false
export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=true
export GRPC_PYTHON_BUILD_WITH_CYTHON=true
export GRPC_PYTHON_DISABLE_LIBC_COMPATIBILITY=true
export GRPC_PYTHON_LDFLAGS="-lpthread -Wl,-wrap,memcpy -static-libgcc"
pip3 install --upgrade grpcio-tools --force-reinstall --no-binary=grpcio-tools
pip3 install --upgrade grpcio --force-reinstall --no-binary=grpcio

After waiting for almost a day of building this isn’t also the solution…

I did some tests and removed ffmpeg with DietPi software gui
Also some related ffmpeg packages I uninstalled (apt remove libxml2-dev libxslt1-dev g++ libswresample-dev libswscale-dev libavfilter-dev libavdevice-dev libavcodec-dev -y)

After that when I try to build ha-av then I got that the error that libavcodec-dev package is mssing:

 creating build/temp.linux-armv7l-cpython-310/src
      creating build/temp.linux-armv7l-cpython-310/src/av
      gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/include -I/home/homeassistant/.pyenv/versions/3.10.9/include/python3.10 -c src/av/utils.c -o build/temp.linux-armv7l-cpython-310/src/av/utils.o
      src/av/utils.c:820:10: fatal error: libavcodec/bsf.h: File or folder does not exist
        820 | #include "libavcodec/bsf.h"
            |          ^~~~~~~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for ha-av
Failed to build ha-av
ERROR: Could not build wheels for ha-av, which is required to install pyproject.toml-based projects


After installing  libavcodec-dev (apt install libavcodec-dev -y) when I build ha-av I got a long list of these erros:

 In file included from src/av/utils.c:811:
      /usr/local/include/libavcodec/avcodec.h:561:5: note: previous definition of ‘AV_CODEC_ID_GREMLIN_DPCM’ was here
        561 |     AV_CODEC_ID_GREMLIN_DPCM,
            |     ^~~~~~~~~~~~~~~~~~~~~~~~
      In file included from /usr/include/arm-linux-gnueabihf/libavcodec/bsf.h:28,
                       from src/av/utils.c:820:
      /usr/include/arm-linux-gnueabihf/libavcodec/codec_id.h:410:5: error: redeclaration of enumerator ‘AV_CODEC_ID_MP2’
        410 |     AV_CODEC_ID_MP2 = 0x15000,
            |     ^~~~~~~~~~~~~~~
      In file included from src/av/utils.c:811:
      /usr/local/include/libavcodec/avcodec.h:564:5: note: previous definition of ‘AV_CODEC_ID_MP2’ was here
        564 |     AV_CODEC_ID_MP2 = 0x15000,
            |     ^~~~~~~~~~~~~~~
      In file included from /usr/include/arm-linux-gnueabihf/libavcodec/bsf.h:28,
                       from src/av/utils.c:820:

So there must be something with the libavcodec-dev package?

I see you posted as well on Unable to install package ha-av==10.0.0b4 - Configuration - Home Assistant Community

Yes the package libavcodec-dev is needed, as it contains the required bsf.h file.

I can install libavcodec-dev without error. When I remove libavcodec-dev and install it again I have these erros when building ha-av. from above.
It’s just like there 's something from the past that generate duplicates.

You need to keep libavcodec-dev installed. Otherwise your build is not going to work.