Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]: How to use AMF with RADV driver? #457

Open
Francehelder opened this issue Feb 21, 2024 · 8 comments
Open

[Question]: How to use AMF with RADV driver? #457

Francehelder opened this issue Feb 21, 2024 · 8 comments
Labels

Comments

@Francehelder
Copy link

I did try use ffmpeg and h264_amf encoder with RADV driver. No sucess.

@MikhailAMD
Copy link
Collaborator

Few notes:

  • I would start with AMF samples.
  • Ensure that you get the latest RADV, not from distro repo.
  • enable FFmpeg log to debug level. It should show AMF traces.

@AngryPenguinPL
Copy link

AngryPenguinPL commented Mar 13, 2024

@MikhailAMD I just checked myself, but I can't get it to work.
I have Mesa 24.0.2, ffmpeg 6.1.1 compiled with AMF 1.4.33 with --enable-amf flag
and when I try run example file I get this:

 input.avi -c:v h264_amf output.mp4
ffmpeg version 6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
  built with OpenMandriva 18.0.0-0.20240205.1 clang version 18.1.0 (/builddir/build/BUILD/llvm-project-release-18.x/clang fcecfd910af51d209d6bfb633579865185223161)
  configuration: --cc=/usr/bin/cc --cxx=/usr/bin/c++ --prefix=/usr --enable-shared --libdir=/usr/lib64 --shlibdir=/usr/lib64 --incdir=/usr/include --disable-stripping --enable-amf --enable-libjxl --enable-postproc --enable-gpl --enable-version3 --enable-nonfree --enable-nvenc --enable-ffplay --enable-libdav1d --enable-libsvtav1 --enable-librav1e --enable-libaom --enable-lto --enable-pthreads --enable-libtheora --enable-libvorbis --disable-encoder=vorbis --enable-libvpx --enable-runtime-cpudetect --enable-libdc1394 --enable-librtmp --enable-libspeex --enable-libfreetype --enable-libgsm --enable-libcelt --enable-libmfx --enable-libopenjpeg --enable-libxavs --enable-libuavs3d --enable-libmodplug --enable-libass --enable-gnutls --enable-libcdio --enable-libv4l2 --enable-openal --enable-opengl --enable-libzmq --enable-libzvbi --enable-libssh --enable-libtwolame --enable-libopus --enable-libilbc --enable-libiec61883 --enable-libgme --enable-libcaca --enable-libbluray --enable-libvidstab --enable-ladspa --enable-libwebp --enable-fontconfig --enable-libflite --enable-libxcb --enable-libxcb-shm --enable-libxcb-xfixes --enable-libxcb-shape --enable-libbs2b --enable-libmp3lame --enable-libfdk-aac-dlopen --enable-libopencore-amrnb-dlopen --enable-libopencore-amrwb-dlopen --enable-libx264-dlopen --enable-libx265-dlopen --enable-libxvid-dlopen --enable-opencl
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
Input #0, avi, from 'input.avi':
  Metadata:
    software        : Lavf57.19.100
  Duration: 00:00:30.61, start: 0.000000, bitrate: 595 kb/s
  Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 447 kb/s, 30 fps, 30 tbr, 30 tbn
  Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000 Hz, stereo, fltp, 139 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_amf))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[h264_amf @ 0x56132a6fd300] DLL libamfrt64.so.1 failed to open
[vost#0:0/h264_amf @ 0x56132a6fb300] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
Error while filtering: Unknown error occurred
[out#0/mp4 @ 0x56132a715c80] Nothing was written into output file, because at least one of its streams received no packets.
frame=    0 fps=0.0 q=0.0 Lsize=       0kB time=00:00:00.23 bitrate=   0.0kbits/s dup=2 drop=0 speed=3.21x    
[aac @ 0x56132adab380] Qavg: 65536.000
Conversion failed!

and this error is strange [h264_amf @ 0x56132a6fd300] DLL libamfrt64.so.1 failed to open because looks like libamfrt64.so.1 comes from amdgpu-pro driver... So what here is wrong?

It would be good to known few things more, like at what mesa release amf was testes or what is required.

And this amf on radv supports only encoding right? Decoding is not available?

@MikhailAMD
Copy link
Collaborator

"DLL libamfrt64.so.1 failed to open"
Did you install AMF on top of RADV?
https://github.com/GPUOpen-LibrariesAndSDKs/AMF/wiki/Driver%20Linux
sudo amdgpu-install -y --usecase=amf

@AngryPenguinPL
Copy link

AngryPenguinPL commented Mar 13, 2024

I think I misunderstood because I thought that it would be enough to rebuild ffmpeg with the amf header to make it work.

Well, now I tried to download amdgpu-install but after run it shot that does not support my system, so I downloaded only the libraries libamfrt64.so, libamfrt64.so.1 and libamfrt64.so.1.4.33 from the repository but after placing them in the right directories I only see a crash

Input #0, avi, from 'input.avi':
  Metadata:
    software        : Lavf57.19.100
  Duration: 00:00:30.61, start: 0.000000, bitrate: 595 kb/s
  Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 447 kb/s, 30 fps, 30 tbr, 30 tbn
  Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000 Hz, stereo, fltp, 139 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_amf))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
Illegal instruction (core dumped)

and this is wat I see in journal log:

Process 43873 (ffmpeg) of user 1001 dumped core.

                                                         Stack trace of thread 43873:
                                                         #0  0x00007fabc7457c85 _ZNSt6vectorISt5arrayIiLm4EESaIS1_EE17_M_realloc_insertIJRKS1_EEEvN9__gnu_cxx17__normal_iteratorIPS1_S3_EEDpOT_ (libamfrt64.so.1 + 0x457c85)
                                                         #1  0x00007fabc7457fd9 _ZN14InstructionSet23InstructionSet_InternalC1Ev (libamfrt64.so.1 + 0x457fd9)
                                                         #2  0x00007fabc71fafde _GLOBAL__sub_I_FeatureGenerator.cpp (libamfrt64.so.1 + 0x1fafde)
                                                         #3  0x00007fabf51d2f0e call_init (ld-linux-x86-64.so.2 + 0x4f0e)
                                                         #4  0x00007fabf51d2ff4 _dl_init (ld-linux-x86-64.so.2 + 0x4ff4)
                                                         #5  0x00007fabf51cf516 _dl_catch_exception (ld-linux-x86-64.so.2 + 0x1516)
                                                         #6  0x00007fabf51d986e dl_open_worker (ld-linux-x86-64.so.2 + 0xb86e)
                                                         #7  0x00007fabf51cf489 _dl_catch_exception (ld-linux-x86-64.so.2 + 0x1489)
                                                         #8  0x00007fabf51d9c58 _dl_open (ld-linux-x86-64.so.2 + 0xbc58)
                                                         #9  0x00007fabf1aa0618 dlopen_doit (libc.so.6 + 0x88618)
                                                         #10 0x00007fabf51cf489 _dl_catch_exception (ld-linux-x86-64.so.2 + 0x1489)
                                                         #11 0x00007fabf51cf5af _dl_catch_error (ld-linux-x86-64.so.2 + 0x15af)
                                                         #12 0x00007fabf1aa0127 _dlerror_run (libc.so.6 + 0x88127)
                                                         #13 0x00007fabf1aa06c9 dlopen (libc.so.6 + 0x886c9)
                                                         #14 0x00007fabf34393bf ff_amf_encode_init (libavcodec.so.60 + 0x6393bf)
                                                         #15 0x00007fabf343b4fb amf_encode_init_h264 (libavcodec.so.60 + 0x63b4fb)
                                                         #16 0x00007fabf3477a79 avcodec_open2 (libavcodec.so.60 + 0x677a79)
                                                         #17 0x0000561d404897c0 enc_open (ffmpeg + 0x207c0)
                                                         #18 0x0000561d4048a0b5 enc_frame (ffmpeg + 0x210b5)
                                                         #19 0x0000561d4048f1e1 fg_output_frame (ffmpeg + 0x261e1)
                                                         #20 0x0000561d4048e7a8 reap_filters (ffmpeg + 0x257a8)
                                                         #21 0x0000561d404ac0e3 main (ffmpeg + 0x430e3)
                                                         #22 0x00007fabf1a41c4a __libc_start_call_main (libc.so.6 + 0x29c4a)
                                                         #23 0x00007fabf1a41d05 __libc_start_main (libc.so.6 + 0x29d05)
                                                         #24 0x0000561d404831b1 _start (ffmpeg + 0x1a1b1)
                                                         
                                                         Stack trace of thread 43878:
                                                         #0  0x00007fabf1aa105e __futex_abstimed_wait_common (libc.so.6 + 0x8905e)
                                                         #1  0x00007fabf1aa37d0 pthread_cond_wait (libc.so.6 + 0x8b7d0)
                                                         #2  0x00007fabf3a97954 frame_worker_thread (libavcodec.so.60 + 0xc97954)
                                                         #3  0x00007fabf1aa4572 start_thread (libc.so.6 + 0x8c572)
                                                         #4  0x00007fabf1b1eca8 __clone3 (libc.so.6 + 0x106ca8)
                                                         
                                                         Stack trace of thread 43874:
                                                         #0  0x00007fabf1aa105e __futex_abstimed_wait_common (libc.so.6 + 0x8905e)
                                                         #1  0x00007fabf1aa37d0 pthread_cond_wait (libc.so.6 + 0x8b7d0)
                                                         #2  0x00007fabf3a97954 frame_worker_thread (libavcodec.so.60 + 0xc97954)
                                                         #3  0x00007fabf1aa4572 start_thread (libc.so.6 + 0x8c572)
                                                         #4  0x00007fabf1b1eca8 __clone3 (libc.so.6 + 0x106ca8)
                                                         
                                                         Stack trace of thread 43875:
                                                         #0  0x00007fabf1aa105e __futex_abstimed_wait_common (libc.so.6 + 0x8905e)
                                                         #1  0x00007fabf1aa37d0 pthread_cond_wait (libc.so.6 + 0x8b7d0)
                                                         #2  0x00007fabf3a97954 frame_worker_thread (libavcodec.so.60 + 0xc97954)
                                                         #3  0x00007fabf1aa4572 start_thread (libc.so.6 + 0x8c572)
                                                         #4  0x00007fabf1b1eca8 __clone3 (libc.so.6 + 0x106ca8)
                                                         
                                                         Stack trace of thread 43876:
                                                         #0  0x00007fabf1aa105e __futex_abstimed_wait_common (libc.so.6 + 0x8905e)
                                                         #1  0x00007fabf1aa37d0 pthread_cond_wait (libc.so.6 + 0x8b7d0)
                                                         #2  0x00007fabf3a97954 frame_worker_thread (libavcodec.so.60 + 0xc97954)
                                                         #3  0x00007fabf1aa4572 start_thread (libc.so.6 + 0x8c572)
                                                         #4  0x00007fabf1b1eca8 __clone3 (libc.so.6 + 0x106ca8)
                                                         
                                                         Stack trace of thread 43877:
                                                         #0  0x00007fabf1aa105e __futex_abstimed_wait_common (libc.so.6 + 0x8905e)
                                                         #1  0x00007fabf1aa37d0 pthread_cond_wait (libc.so.6 + 0x8b7d0)
                                                         #2  0x00007fabf3a97954 frame_worker_thread (libavcodec.so.60 + 0xc97954)
                                                         #3  0x00007fabf1aa4572 start_thread (libc.so.6 + 0x8c572)
                                                         #4  0x00007fabf1b1eca8 __clone3 (libc.so.6 + 0x106ca8)
                                                         
                                                         Stack trace of thread 43879:
                                                         #0  0x00007fabf1aa105e __futex_abstimed_wait_common (libc.so.6 + 0x8905e)
                                                         #1  0x00007fabf1aa37d0 pthread_cond_wait (libc.so.6 + 0x8b7d0)
                                                         #2  0x00007fabf3a97954 frame_worker_thread (libavcodec.so.60 + 0xc97954)
                                                         #3  0x00007fabf1aa4572 start_thread (libc.so.6 + 0x8c572)
                                                         #4  0x00007fabf1b1eca8 __clone3 (libc.so.6 + 0x106ca8)
                                                         
                                                         Stack trace of thread 43885:
                                                         #0  0x00007fabf1aa105e __futex_abstimed_wait_common (libc.so.6 + 0x8905e)
                                                         #1  0x00007fabf1aa37d0 pthread_cond_wait (libc.so.6 + 0x8b7d0)
                                                         #2  0x00007fabf1ccbe57 av_thread_message_queue_send (libavutil.so.58 + 0xcbe57)
                                                         #3  0x0000561d40488043 input_thread (ffmpeg + 0x1f043)
                                                         #4  0x00007fabf1aa4572 start_thread (libc.so.6 + 0x8c572)
                                                         #5  0x00007fabf1b1eca8 __clone3 (libc.so.6 + 0x106ca8)
                                                         
                                                         Stack trace of thread 43886:
                                                         #0  0x00007fabf1aa105e __futex_abstimed_wait_common (libc.so.6 + 0x8905e)
                                                         #1  0x00007fabf1aa37d0 pthread_cond_wait (libc.so.6 + 0x8b7d0)
                                                         #2  0x00007fabf1cca6ab thread_worker (libavutil.so.58 + 0xca6ab)
                                                         #3  0x00007fabf1aa4572 start_thread (libc.so.6 + 0x8c572)
                                                         #4  0x00007fabf1b1eca8 __clone3 (libc.so.6 + 0x106ca8)
                                                         
                                                         Stack trace of thread 43887:
                                                         #0  0x00007fabf1aa105e __futex_abstimed_wait_common (libc.so.6 + 0x8905e)
                                                         #1  0x00007fabf1aa37d0 pthread_cond_wait (libc.so.6 + 0x8b7d0)
                                                         #2  0x00007fabf1cca6ab thread_worker (libavutil.so.58 + 0xca6ab)
                                                         #3  0x00007fabf1aa4572 start_thread (libc.so.6 + 0x8c572)
                                                         #4  0x00007fabf1b1eca8 __clone3 (libc.so.6 + 0x106ca8)
                                                         
                                                         Stack trace of thread 43880:
                                                         #0  0x00007fabf1aa105e __futex_abstimed_wait_common (libc.so.6 + 0x8905e)
                                                         #1  0x00007fabf1aa37d0 pthread_cond_wait (libc.so.6 + 0x8b7d0)
                                                         #2  0x00007fabf3a97954 frame_worker_thread (libavcodec.so.60 + 0xc97954)
                                                         #3  0x00007fabf1aa4572 start_thread (libc.so.6 + 0x8c572)
                                                         #4  0x00007fabf1b1eca8 __clone3 (libc.so.6 + 0x106ca8)
                                                         
                                                         Stack trace of thread 43881:
                                                         #0  0x00007fabf1aa105e __futex_abstimed_wait_common (libc.so.6 + 0x8905e)
                                                         #1  0x00007fabf1aa37d0 pthread_cond_wait (libc.so.6 + 0x8b7d0)
                                                         #2  0x0000561d404a4d71 tq_receive (ffmpeg + 0x3bd71)
                                                         #3  0x0000561d40485253 decoder_thread (ffmpeg + 0x1c253)
                                                         #4  0x00007fabf1aa4572 start_thread (libc.so.6 + 0x8c572)
                                                         #5  0x00007fabf1b1eca8 __clone3 (libc.so.6 + 0x106ca8)
                                                         
                                                         Stack trace of thread 43889:
                                                         #0  0x00007fabf1aa105e __futex_abstimed_wait_common (libc.so.6 + 0x8905e)
                                                         #1  0x00007fabf1aa37d0 pthread_cond_wait (libc.so.6 + 0x8b7d0)
                                                         #2  0x00007fabf1cca6ab thread_worker (libavutil.so.58 + 0xca6ab)
                                                         #3  0x00007fabf1aa4572 start_thread (libc.so.6 + 0x8c572)
                                                         #4  0x00007fabf1b1eca8 __clone3 (libc.so.6 + 0x106ca8)
                                                         
                                                         Stack trace of thread 43888:
                                                         #0  0x00007fabf1aa105e __futex_abstimed_wait_common (libc.so.6 + 0x8905e)
                                                         #1  0x00007fabf1aa37d0 pthread_cond_wait (libc.so.6 + 0x8b7d0)
                                                         #2  0x00007fabf1cca6ab thread_worker (libavutil.so.58 + 0xca6ab)
                                                         #3  0x00007fabf1aa4572 start_thread (libc.so.6 + 0x8c572)
                                                         #4  0x00007fabf1b1eca8 __clone3 (libc.so.6 + 0x106ca8)
                                                         
                                                         Stack trace of thread 43890:
                                                         #0  0x00007fabf1aa105e __futex_abstimed_wait_common (libc.so.6 + 0x8905e)
                                                         #1  0x00007fabf1aa37d0 pthread_cond_wait (libc.so.6 + 0x8b7d0)
                                                         #2  0x00007fabf1cca6ab thread_worker (libavutil.so.58 + 0xca6ab)
                                                         #3  0x00007fabf1aa4572 start_thread (libc.so.6 + 0x8c572)
                                                         #4  0x00007fabf1b1eca8 __clone3 (libc.so.6 + 0x106ca8)
                                                         
                                                         Stack trace of thread 43892:
                                                         #0  0x00007fabf1aa105e __futex_abstimed_wait_common (libc.so.6 + 0x8905e)
                                                         #1  0x00007fabf1aa37d0 pthread_cond_wait (libc.so.6 + 0x8b7d0)
                                                         #2  0x00007fabf1cca6ab thread_worker (libavutil.so.58 + 0xca6ab)
                                                         #3  0x00007fabf1aa4572 start_thread (libc.so.6 + 0x8c572)
                                                         #4  0x00007fabf1b1eca8 __clone3 (libc.so.6 + 0x106ca8)
                                                         
                                                         Stack trace of thread 43894:
                                                         #0  0x00007fabf1aa105e __futex_abstimed_wait_common (libc.so.6 + 0x8905e)
                                                         #1  0x00007fabf1aa37d0 pthread_cond_wait (libc.so.6 + 0x8b7d0)
                                                         #2  0x00007fabf1cca6ab thread_worker (libavutil.so.58 + 0xca6ab)
                                                         #3  0x00007fabf1aa4572 start_thread (libc.so.6 + 0x8c572)
                                                         #4  0x00007fabf1b1eca8 __clone3 (libc.so.6 + 0x106ca8)
                                                         
                                                         Stack trace of thread 43891:
                                                         #0  0x00007fabf1aa105e __futex_abstimed_wait_common (libc.so.6 + 0x8905e)
                                                         #1  0x00007fabf1aa37d0 pthread_cond_wait (libc.so.6 + 0x8b7d0)
                                                         #2  0x00007fabf1cca6ab thread_worker (libavutil.so.58 + 0xca6ab)
                                                         #3  0x00007fabf1aa4572 start_thread (libc.so.6 + 0x8c572)
                                                         #4  0x00007fabf1b1eca8 __clone3 (libc.so.6 + 0x106ca8)
                                                         
                                                         Stack trace of thread 43895:
                                                         #0  0x00007fabf1aa105e __futex_abstimed_wait_common (libc.so.6 + 0x8905e)
                                                         #1  0x00007fabf1aa37d0 pthread_cond_wait (libc.so.6 + 0x8b7d0)
                                                         #2  0x00007fabf1cca6ab thread_worker (libavutil.so.58 + 0xca6ab)
                                                         #3  0x00007fabf1aa4572 start_thread (libc.so.6 + 0x8c572)
                                                         #4  0x00007fabf1b1eca8 __clone3 (libc.so.6 + 0x106ca8)
                                                         
                                                         Stack trace of thread 43882:
                                                         #0  0x00007fabf1aa105e __futex_abstimed_wait_common (libc.so.6 + 0x8905e)
                                                         #1  0x00007fabf1aa37d0 pthread_cond_wait (libc.so.6 + 0x8b7d0)
                                                         #2  0x0000561d404a4d71 tq_receive (ffmpeg + 0x3bd71)
                                                         #3  0x0000561d40485253 decoder_thread (ffmpeg + 0x1c253)
                                                         #4  0x00007fabf1aa4572 start_thread (libc.so.6 + 0x8c572)
                                                         #5  0x00007fabf1b1eca8 __clone3 (libc.so.6 + 0x106ca8)
                                                         
                                                         Stack trace of thread 43893:
                                                         #0  0x00007fabf1aa105e __futex_abstimed_wait_common (libc.so.6 + 0x8905e)
                                                         #1  0x00007fabf1aa37d0 pthread_cond_wait (libc.so.6 + 0x8b7d0)
                                                         #2  0x00007fabf1cca6ab thread_worker (libavutil.so.58 + 0xca6ab)
                                                         #3  0x00007fabf1aa4572 start_thread (libc.so.6 + 0x8c572)
                                                         #4  0x00007fabf1b1eca8 __clone3 (libc.so.6 + 0x106ca8)
                                                         
                                                         Stack trace of thread 43896:
                                                         #0  0x00007fabf1aa105e __futex_abstimed_wait_common (libc.so.6 + 0x8905e)
                                                         #1  0x00007fabf1aa37d0 pthread_cond_wait (libc.so.6 + 0x8b7d0)
                                                         #2  0x00007fabf1cca6ab thread_worker (libavutil.so.58 + 0xca6ab)
                                                         #3  0x00007fabf1aa4572 start_thread (libc.so.6 + 0x8c572)
                                                         #4  0x00007fabf1b1eca8 __clone3 (libc.so.6 + 0x106ca8)
                                                         
                                                         Stack trace of thread 43897:
                                                         #0  0x00007fabf1aa105e __futex_abstimed_wait_common (libc.so.6 + 0x8905e)
                                                         #1  0x00007fabf1aa37d0 pthread_cond_wait (libc.so.6 + 0x8b7d0)
                                                         #2  0x00007fabf1cca6ab thread_worker (libavutil.so.58 + 0xca6ab)
                                                         #3  0x00007fabf1aa4572 start_thread (libc.so.6 + 0x8c572)
                                                         #4  0x00007fabf1b1eca8 __clone3 (libc.so.6 + 0x106ca8)
                                                         ELF object binary architecture: AMD x86-64

@MikhailAMD
Copy link
Collaborator

It is not enough to copy libamfrt64.so library and links to it (libamfrt64.so.1 and libamfrt64.so.1.4.33). There is also libamdenc64.so and corresponding VCN FW that needs to be properly installed. AMF team supports only Linux distros that are supported by AMD driver. So with manual installation many things could go wrong. There is a long discussion about use of AMF on non-supported distros: #334

@valpackett
Copy link

Hm, with the amdgpu stack version 6.0.3 (same thing with 6.0.2) on Ubuntu 22.04, ffmpeg @ 478d97f303 built with AMF SDK @ e1acd43, and a Cezanne platform, it crashes like this:

[h264_amf @ 0x5555581e5280] AMF initialisation succeeded via Vulkan.
Process 2864 stopped
* thread #19, name = 'vf#0:0', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
    frame #0: 0x00007fff8a89be4f libamfrt64.so.1`Pal::AddrMgr2::AddrMgr2::AddrMgr2(Pal::Device const*) + 47
libamfrt64.so.1`Pal::AddrMgr2::AddrMgr2::AddrMgr2:
->  0x7fff8a89be4f <+47>: movq   (%rdi), %rax
    0x7fff8a89be52 <+50>: callq  *0x200(%rax)
    0x7fff8a89be58 <+56>: movl   %eax, 0x38(%rbx)
    0x7fff8a89be5b <+59>: addq   $0x8, %rsp
(lldb) bt
* thread #19, name = 'vf#0:0', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
  * frame #0: 0x00007fff8a89be4f libamfrt64.so.1`Pal::AddrMgr2::AddrMgr2::AddrMgr2(Pal::Device const*) + 47
    frame #1: 0x00007fff8a89bf0b libamfrt64.so.1`Pal::AddrMgr2::Create(Pal::Device const*, void*, Pal::AddrMgr**) + 43
    frame #2: 0x00007fff8a871e4b libamfrt64.so.1`Pal::Device::HwlEarlyInit() + 395
    frame #3: 0x00007fff8a871f70 libamfrt64.so.1`Pal::Device::EarlyInit(Pal::HwIpLevels const&) + 112
    frame #4: 0x00007fff8a8572c4 libamfrt64.so.1`Pal::Amdgpu::Device::EarlyInit(Pal::HwIpLevels const&) + 244
    frame #5: 0x00007fff8a8544a4 libamfrt64.so.1`Pal::Amdgpu::Device::Create(Pal::Amdgpu::Platform*, char const*, char const*, char const*, char const*, int, _drmPciBusInfo const&, unsigned int, Pal::Amdgpu::Device**) + 1604
    frame #6: 0x00007fff8a82be23 libamfrt64.so.1`Pal::Amdgpu::Platform::ReQueryDevices() + 339
    frame #7: 0x00007fff8a80fade libamfrt64.so.1`Pal::Platform::ReEnumerateDevices() + 30
    frame #8: 0x00007fff8a8179e5 libamfrt64.so.1`Pal::Platform::Create(Pal::PlatformCreateInfo const&, Util::AllocCallbacks const&, void*, Pal::Platform**) + 117
    frame #9: 0x00007fff8a817b4c libamfrt64.so.1`Pal::CreatePlatform(Pal::PlatformCreateInfo const&, void*, Pal::IPlatform**) + 188
    frame #10: 0x00007fff8a793f54 libamfrt64.so.1`AMFDevicePALImpl::AMFDevicePALImpl(amf::AMFContextEx*) + 340
    frame #11: 0x00007fff8a793fea libamfrt64.so.1`amf::AMFCreateDevicePAL(amf::AMFContextEx*, amf::AMFDevicePAL**) + 42
    frame #12: 0x00007fff8a731e5e libamfrt64.so.1`AMFContextImpl::GetDevicePAL() + 190
    frame #13: 0x00007fff8a7334cc libamfrt64.so.1`AMFContextImpl::GetDevice(amf::AMF_MEMORY_TYPE) + 140
    frame #14: 0x00007fff8a4f2a82 libamfrt64.so.1`amf::EncodeQueueService::Create(amf::ENCODE_QUEUE_PLATFORM_TYPE, amf::AMFContext*, void**, amf::EncodeQueueService**) + 562
    frame #15: 0x00007fff8a460b7d libamfrt64.so.1`amf::AMFEncoderCoreBaseImpl::CreateEncodeQueueService() + 733
    frame #16: 0x00007fff8a46370d libamfrt64.so.1`amf::AMFEncoderCoreBaseImpl::LoadEncodeCore() + 45
    frame #17: 0x00007fff8a429d00 libamfrt64.so.1`amf::AMFEncoderCoreH264Impl::CreateServices() + 48
    frame #18: 0x00007fff8a441f85 libamfrt64.so.1`amf::AMFEncoderCoreH264Impl::Prepare() + 37
    frame #19: 0x00007fff8a449578 libamfrt64.so.1`AMFCreateComponentEncoderVCE + 248
    frame #20: 0x00007fff8a3d2af9 libamfrt64.so.1`AMFCreateComponent + 473
    frame #21: 0x000055555632f27f ffmpeg`___lldb_unnamed_symbol17567 + 1247

There's no way to test with AMDVLK nor PRO Vulkan as they do not initialize in that version (dropped Vega support?)

WARNING: [Loader Message] Code 0 : terminator_CreateInstance: Failed to CreateInstance in ICD 0.  Skipping ICD.
Cannot create Vulkan instance.
This problem is often caused by a faulty installation of the Vulkan driver or attempting to use a GPU that does not support Vulkan.
ERROR at ./vulkaninfo/vulkaninfo.h:649:vkCreateInstance failed with ERROR_INCOMPATIBLE_DRIVER

With 5.7.3 where AMDVLK and PRO do work, AMF does work but only with PRO, which is not that surprising as this support for other Vulkan drivers was announced only recently, after that release.

@kostadinsh
Copy link

I managed to make it work on Gentoo by putting the libraries from libamdenc-amdgpu-pro and libgl1-amdgpu-pro-oglp-dri in a folder and then loading them with LD_LIBRARY_PATH=(whatever the dir is) ffmpeg -i input.mp4 -c:v h264_amf output.mp4 So, I guess if you are on a supported distro you can just install those two packages and it should work?

@AdelKS
Copy link

AdelKS commented Apr 13, 2024

I would love to understand what libraries ffmpeg tries to dlopen, in the case where we use amdgpu-pro-amf and in the case we go through mesa. And how can ffmpeg understand what to dlopen. I tried to do a keyword search in its code base, couldn't come up with anything relevant...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants