Ffmpeg compilation failed while compiling ffmpeg git at the point amf

Hi I am Rupesh from India and I brought a new system with AMD Ryzen zen3 5500GT and Asus prime B450 motherboard. I failed compiling the source code of ffmpeg which is downloaded from git at the point of AMF in Linux Operating System.

I have installed the following Linux Operating Systems

Arch Linux
Debian Linux Trixie
Fedora 41
Gentoo Linux

I have downloaded and installed all the packages related to sound, video and images which are necessary to compile install and run ffmpeg properly.

From the past four months I am using ffmpeg along with the above Linux Operating Systems.

At the starting point of compilation I have invoked the configure script of ffmpeg git source code through the following command

./configure --enable-amf

The configuration succeeded so I have issued the following command

make -j9

After sometime I got errors containing the words "amf"

One month back I have downloaded ffmpeg source code from git and configured and compiled successfully using the same commands.

As I received errors while compiling new ffmpeg source code obtained from git I have deleted the source code and copied old source code of ffmpeg which was obtained from git.

I am able to compile old source code of ffmpeg but I can't compile the latest version of ffmpeg which is obtained from git.

I am providing the commands which I entered previously and now below.

git clone https://github.com/FFmpeg/FFmpeg ffmpeg

tar -czvf ffmpeg.tar.gz ffmpeg

cd ffmpeg/

./configure --arch=x86_64 --cpu=znver3 --prefix=/opt/ffmpeg --enable-gpl  --disable-shared --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-librav1e --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg --enable-libfdk-aac --enable-nonfree --enable-vaapi --enable-vdpau --enable-opencl --enable-opengl --enable-hwaccels --enable-runtime-cpudetect --disable-cuda-sdk --enable-avfilter --enable-bzlib  --enable-libdrm --enable-libjxl --enable-libopenjpeg --enable-libplacebo --enable-librsvg --enable-librubberband --enable-libzmq --enable-pthreads --enable-vulkan --enable-amf  --disable-libmfx  > ../ffmpeg_output.txt

make -j9

sudo make install

I am providing the configuration command which I entered previously and now below.

./configure --arch=x86_64 --cpu=znver3 --prefix=/opt/ffmpeg --enable-gpl  --disable-shared --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-librav1e --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg --enable-libfdk-aac --enable-nonfree --enable-vaapi --enable-vdpau --enable-opencl --enable-opengl --enable-hwaccels --enable-runtime-cpudetect --disable-cuda-sdk --enable-avfilter --enable-bzlib  --enable-libdrm --enable-libjxl --enable-libopenjpeg --enable-libplacebo --enable-librsvg --enable-librubberband --enable-libzmq --enable-pthreads --enable-vulkan --enable-amf  --disable-libmfx  > ../ffmpeg_output.txt

I am also providing the last few lines of the compilation output below.

CC	libavcodec/acelp_filters.o
CC	libavcodec/acelp_pitch_delay.o
CC	libavcodec/acelp_vectors.o
CC	libavcodec/adpcm.o
CC	libavcodec/adpcm_data.o
CC	libavcodec/adpcmenc.o
In file included from libavcodec/ac3dec_float.c:40:
In function ‘spx_strategy’,
    inlined from ‘decode_audio_block’ at libavcodec/ac3dec.c:1144:24:
libavcodec/ac3dec.c:856:37: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  856 |             s->channel_uses_spx[ch] = get_bits1(bc);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
In file included from libavcodec/ac3dec_float.c:34:
libavcodec/ac3dec.h: In function ‘decode_audio_block’:
libavcodec/ac3dec.h:144:13: note: at offset 7 into destination object ‘channel_uses_spx’ of size 7
  144 |     uint8_t channel_uses_spx[AC3_MAX_CHANNELS]; ///< channel uses spectral extension        (chinspx)
      |             ^~~~~~~~~~~~~~~~
In file included from libavcodec/aacsbr.c:383:
libavcodec/aacsbr_template.c: In function ‘read_sbr_grid’:
libavcodec/aacsbr_template.c:729:57: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  729 |             ch_data->t_env[ch_data->bs_num_env - 1 - i] =
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
  730 |                 ch_data->t_env[ch_data->bs_num_env - i] - 2 * get_bits(gb, 2) - 2;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from libavcodec/aacsbr.c:31:
libavcodec/sbr.h:106:24: note: at offset [2147483649, 4294967295] into destination object ‘t_env’ of size 9
  106 |     uint8_t            t_env[9];
      |                        ^~~~~
libavcodec/aacsbr_template.c:729:57: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  729 |             ch_data->t_env[ch_data->bs_num_env - 1 - i] =
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
  730 |                 ch_data->t_env[ch_data->bs_num_env - i] - 2 * get_bits(gb, 2) - 2;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavcodec/sbr.h:106:24: note: at offset [2147483649, 4294967294] into destination object ‘t_env’ of size 9
  106 |     uint8_t            t_env[9];
      |                        ^~~~~
libavcodec/aacsbr_template.c:729:57: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  729 |             ch_data->t_env[ch_data->bs_num_env - 1 - i] =
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
  730 |                 ch_data->t_env[ch_data->bs_num_env - i] - 2 * get_bits(gb, 2) - 2;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavcodec/sbr.h:106:24: note: at offset [2147483649, 4294967293] into destination object ‘t_env’ of size 9
  106 |     uint8_t            t_env[9];
      |                        ^~~~~
libavcodec/aacsbr_template.c:729:57: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  729 |             ch_data->t_env[ch_data->bs_num_env - 1 - i] =
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
  730 |                 ch_data->t_env[ch_data->bs_num_env - i] - 2 * get_bits(gb, 2) - 2;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavcodec/sbr.h:106:24: note: at offset [2147483649, 4294967292] into destination object ‘t_env’ of size 9
  106 |     uint8_t            t_env[9];
      |                        ^~~~~
In file included from libavcodec/ac3dec_fixed.c:159:
In function ‘spx_strategy’,
    inlined from ‘decode_audio_block’ at libavcodec/ac3dec.c:1144:24:
libavcodec/ac3dec.c:856:37: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  856 |             s->channel_uses_spx[ch] = get_bits1(bc);
      |             ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
In file included from libavcodec/ac3dec_fixed.c:52:
libavcodec/ac3dec.h: In function ‘decode_audio_block’:
libavcodec/ac3dec.h:144:13: note: at offset 7 into destination object ‘channel_uses_spx’ of size 7
  144 |     uint8_t channel_uses_spx[AC3_MAX_CHANNELS]; ///< channel uses spectral extension        (chinspx)
      |             ^~~~~~~~~~~~~~~~
CC	libavcodec/adts_header.o
CC	libavcodec/adts_parser.o
CC	libavcodec/adx.o
CC	libavcodec/adx_parser.o
In file included from libavcodec/aacsbr_fixed.c:610:
libavcodec/aacsbr_template.c: In function ‘read_sbr_grid’:
libavcodec/aacsbr_template.c:729:57: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  729 |             ch_data->t_env[ch_data->bs_num_env - 1 - i] =
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
  730 |                 ch_data->t_env[ch_data->bs_num_env - i] - 2 * get_bits(gb, 2) - 2;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from libavcodec/aacsbr_fixed.c:60:
libavcodec/sbr.h:106:24: note: at offset [-2147483647, -1] into destination object ‘t_env’ of size 9
  106 |     uint8_t            t_env[9];
      |                        ^~~~~
libavcodec/aacsbr_template.c:729:57: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  729 |             ch_data->t_env[ch_data->bs_num_env - 1 - i] =
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
  730 |                 ch_data->t_env[ch_data->bs_num_env - i] - 2 * get_bits(gb, 2) - 2;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavcodec/sbr.h:106:24: note: at offset [-2147483647, -2] into destination object ‘t_env’ of size 9
  106 |     uint8_t            t_env[9];
      |                        ^~~~~
libavcodec/aacsbr_template.c:729:57: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  729 |             ch_data->t_env[ch_data->bs_num_env - 1 - i] =
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
  730 |                 ch_data->t_env[ch_data->bs_num_env - i] - 2 * get_bits(gb, 2) - 2;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavcodec/sbr.h:106:24: note: at offset [-2147483647, -3] into destination object ‘t_env’ of size 9
  106 |     uint8_t            t_env[9];
      |                        ^~~~~
libavcodec/aacsbr_template.c:729:57: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  729 |             ch_data->t_env[ch_data->bs_num_env - 1 - i] =
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
  730 |                 ch_data->t_env[ch_data->bs_num_env - i] - 2 * get_bits(gb, 2) - 2;
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavcodec/sbr.h:106:24: note: at offset [-2147483647, -4] into destination object ‘t_env’ of size 9
  106 |     uint8_t            t_env[9];
      |                        ^~~~~
CC	libavcodec/adxdec.o
CC	libavcodec/adxenc.o
CC	libavcodec/agm.o
CC	libavcodec/aic.o
CC	libavcodec/alac.o
CC	libavcodec/alac_data.o
CC	libavcodec/alacdsp.o
CC	libavcodec/alacenc.o
CC	libavcodec/aliaspixdec.o
CC	libavcodec/aliaspixenc.o
CC	libavcodec/allcodecs.o
CC	libavcodec/alsdec.o
CC	libavcodec/amfenc.o
CC	libavcodec/amfenc_av1.o
CC	libavcodec/amfenc_h264.o
In file included from /usr/include/AMF/core/Data.h:37,
                 from /usr/include/AMF/core/Buffer.h:37,
                 from /usr/include/AMF/core/Context.h:37,
                 from /usr/include/AMF/core/Factory.h:40,
                 from libavcodec/amfenc.h:22,
                 from libavcodec/amfenc_av1.c:23:
libavcodec/amfenc_av1.c: In function ‘amf_encode_init_av1’:
libavcodec/amfenc_av1.c:467:57: error: ‘AMF_VIDEO_ENCODER_AV1_ADAPTIVE_MINIGOP’ undeclared (first use in this function); did you mean ‘AMF_VIDEO_ENCODER_ADAPTIVE_MINIGOP’?
  467 |             AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_ADAPTIVE_MINIGOP, ((ctx->pa_adaptive_mini_gop == 0) ? false : true));
      |                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavcodec/amfenc_av1.c:467:57: note: each undeclared identifier is reported only once for each function it appears in
libavcodec/amfenc_av1.c:481:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
  481 |     AMFVariantStruct    is_adaptive_b_frames = { 0 };
      |     ^~~~~~~~~~~~~~~~
libavcodec/amfenc_av1.c:490:66: error: ‘AMF_VIDEO_ENCODER_AV1_CAP_BFRAMES’ undeclared (first use in this function); did you mean ‘AMF_VIDEO_ENCODER_CAP_BFRAMES’?
  490 |             res = encoder_caps->pVtbl->GetProperty(encoder_caps, AMF_VIDEO_ENCODER_AV1_CAP_BFRAMES, &var);
      |                                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                  AMF_VIDEO_ENCODER_CAP_BFRAMES
libavcodec/amfenc_av1.c:499:70: error: ‘AMF_VIDEO_ENCODER_AV1_MAX_CONSECUTIVE_BPICTURES’ undeclared (first use in this function); did you mean ‘AMF_VIDEO_ENCODER_MAX_CONSECUTIVE_BPICTURES’?
  499 |                         AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_MAX_CONSECUTIVE_BPICTURES, 3);
      |                                                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavcodec/amfenc_av1.c:510:74: error: ‘AMF_VIDEO_ENCODER_AV1_B_PIC_PATTERN’ undeclared (first use in this function); did you mean ‘AMF_VIDEO_ENCODER_B_PIC_PATTERN’?
  510 |                             AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_B_PIC_PATTERN, ctx->max_b_frames);
      |                                                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [ffbuild/common.mak:81: libavcodec/amfenc_av1.o] Error 1
make: *** Waiting for unfinished jobs....
build@Rupesh:~/soft/temp/ffmpeg$ 

Kindly try to suggest what's wrong and how to compile the source code of the latest version of ffmpeg which is obtained from git.

Regards,
Rupesh.

Hi @rupeshforu3

The issue arises because the latest FFmpeg source code references AMD AMF (Advanced Media Framework) constants for AV1 encoding that are not defined in your AMF library version.

This is a compatibility issue between the FFmpeg source code and your installed version of the AMD AMF SDK.

Just for fun, @rupeshforu3 I compiled this on my mac, without error, as follows:

git clone https://github.com/FFmpeg/FFmpeg ffmpeg
cd ffmpeg
./configure
make

Successful Results:

neo ffmpeg $ ./ffmpeg
ffmpeg version N-118348-g6ecc96f4d0 Copyright (c) 2000-2025 the FFmpeg developers
  built with Apple clang version 16.0.0 (clang-1600.0.26.6)
  configuration: 
  libavutil      59. 55.100 / 59. 55.100
  libavcodec     61. 31.101 / 61. 31.101
  libavformat    61.  9.106 / 61.  9.106
  libavdevice    61.  4.100 / 61.  4.100
  libavfilter    10.  6.101 / 10.  6.101
  libswscale      8. 13.100 /  8. 13.100
  libswresample   5.  4.100 /  5.  4.100
Universal media converter
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'
neo ffmpeg $ 

:slight_smile:

Hi have you specified the option --enable-amf while invoking the ./configure script present in ffmpeg source code downloaded from git.

According to you if I fetch the latest AMF from git does the problem going to be solved.

No, @rupeshforu3, I followed the steps outlined in my earlier reply. That’s all I plan to do on this topic.

Note:

On macOS, enabling AMF for FFmpeg can be tricky since AMF (Advanced Media Framework) is designed for AMD GPUs, and macOS primarily uses Apple’s Metal API for GPU acceleration. AMF is not natively supported on macOS.. So, I do not plan to do this @rupeshforu3 because it's not readily supported on my M3 mac (note I mentioned to you I was on macOS) and do not want to go down that rabbit hole.

I'm sure you can figure it out, @rupeshforu3 :slight_smile:

1 Like

Hi just now I have fetched AMF from git and copied include files to /usr/include/AMF.

After that I have compiled ffmpeg source code from the beginning and succeeded.