Build fails with FFmpeg 6.0
Overview
FFmpeg 6.0 was released on February 28th. PyAV currently doesn't build against this version due to removal of several deprecated features, including the flags AV_CODEC_CAP_TRUNCATED, AV_CODEC_CAP_AUTO_THREADS, AV_CODEC_CAP_INTRA_ONLY, AV_CODEC_CAP_LOSSLESS, and AVFMT_FLAG_PRIV_OPT.
Expected behavior
I would expect to be able to successfully build against FFmpeg 6.0.
Actual behavior
The build fails with FFmpeg 6.0.
Build report (full log here):
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -g -ffile-prefix-map=/build/python/src=/usr/src/debug/python -flto=auto -ffat-lto-objects -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -g -ffile-prefix-map=/build/python/src=/usr/src/debug/python -flto=auto -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -g -ffile-prefix-map=/build/python/src=/usr/src/debug/python -flto=auto -fPIC -I/usr/include/python3.10 -c src/av/container/core.c -o build/temp.linux-x86_64-cpython-310/src/av/container/core.o
src/av/container/core.c: In function ‘__pyx_pf_2av_9container_4core_9Container___cinit__’:
src/av/container/core.c:4452:18: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
4452 | __pyx_t_11 = av_guess_format(NULL, __pyx_v_name, NULL);
| ^
src/av/container/core.c:4729:5: warning: ‘io_close’ is deprecated [-Wdeprecated-declarations]
4729 | __pyx_v_self->ptr->io_close = __pyx_f_2av_9container_4core_pyav_io_close;
| ^~~~~~~~~~~~
In file included from /usr/include/libavdevice/avdevice.h:57,
from src/av/container/core.c:791:
/usr/include/libavformat/avformat.h:1677:12: note: declared here
1677 | void (*io_close)(struct AVFormatContext *s, AVIOContext *pb);
| ^~~~~~~~
src/av/container/core.c:4957:90: warning: passing argument 1 of ‘__pyx_f_2av_6format_build_container_format’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
4957 | __pyx_t_3 = ((PyObject *)__pyx_f_2av_6format_build_container_format(__pyx_v_self->ptr->iformat, __pyx_v_self->ptr->oformat)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 276, __pyx_L1_error)
| ~~~~~~~~~~~~~~~~~^~~~~~~~~
src/av/container/core.c:4957:90: note: expected ‘struct AVInputFormat *’ but argument is of type ‘const struct AVInputFormat *’
src/av/container/core.c:4957:118: warning: passing argument 2 of ‘__pyx_f_2av_6format_build_container_format’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
4957 | __pyx_t_3 = ((PyObject *)__pyx_f_2av_6format_build_container_format(__pyx_v_self->ptr->iformat, __pyx_v_self->ptr->oformat)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 276, __pyx_L1_error)
| ~~~~~~~~~~~~~~~~~^~~~~~~~~
src/av/container/core.c:4957:118: note: expected ‘struct AVOutputFormat *’ but argument is of type ‘const struct AVOutputFormat *’
src/av/container/core.c: In function ‘__pyx_pymod_exec_core’:
src/av/container/core.c:9043:36: error: ‘AVFMT_FLAG_PRIV_OPT’ undeclared (first use in this function); did you mean ‘AVFMT_FLAG_IGNIDX’?
9043 | __pyx_t_3 = __Pyx_PyInt_From_int(AVFMT_FLAG_PRIV_OPT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 160, __pyx_L1_error)
| ^~~~~~~~~~~~~~~~~~~
| AVFMT_FLAG_IGNIDX
src/av/container/core.c:9043:36: note: each undeclared identifier is reported only once for each function it appears in
error: command '/usr/bin/gcc' failed with exit code 1
Investigation
I recently updated to FFmpeg 6.0, and PyAV does not build anymore. I looked into the changes made in FFmpeg 6.0 and it appears that at a minimum, some flags PyAV references have been removed.
Reproduction
- Install FFmpeg 6.0
- Attempt to build PyAV with
python setup.py build
Versions
- OS: Arch Linux
- PyAV runtime: v10.0.0, commit 6982d818
- PyAV build: (suggested command just prints "running config")
- FFmpeg:
ffmpeg version n6.0 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 12.2.1 (GCC) 20230201
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-version3 --enable-vulkan
libavutil 58. 2.100 / 58. 2.100
libavcodec 60. 3.100 / 60. 3.100
libavformat 60. 3.100 / 60. 3.100
libavdevice 60. 1.100 / 60. 1.100
libavfilter 9. 3.100 / 9. 3.100
libswscale 7. 1.100 / 7. 1.100
libswresample 4. 10.100 / 4. 10.100
libpostproc 57. 1.100 / 57. 1.100
Research
I have done the following:
-
Checked the PyAV documentation -
Searched on Google -
Searched on Stack Overflow -
Looked through old GitHub issues -
Asked on PyAV Gitter (it's a 404) -
... and waited 72 hours for a response.