GPUOpen-LibrariesAndSDKs / AMF

The Advanced Media Framework (AMF) SDK provides developers with optimal access to AMD devices for multimedia processing
Other
611 stars 152 forks source link

Support for Linux #4

Closed boxerab closed 3 years ago

boxerab commented 8 years ago

For video transcoding, Linux is an ideal platform. And for this use case, no Vulkan support is necessary, just access to hardware decode/encode.

Xaymar commented 5 years ago

For 4. on your first reply, there is currently no maintainer for amfenc.c, amfenc.h, amfenc_h264.c, amfenc_h265.c listed in the maintainers file. That means that merging of patches takes significantly longer, unless a maintainer steps up to verify each patch for backwards incompatibility and similar changes. I was told this in reply to my own submission of a patch, which is also waiting for verification.

Lucretia commented 5 years ago

Few topic to cover:

1. AMF on Linux is only in Pro driver because it uses closed source Vulkan extensions.

Which is a problem.

MikhailAMD commented 5 years ago

We have a person who can be a maintainer by we need to introduce AMF context to share instance of AMF between encoder, decoder and converter but it is UTIL area not AMFENC.

MikhailAMD commented 5 years ago

Once Khronos finishes Vulkan extensions for encoder and decoder and Vulkan open source driver implements them we plan to make an open source version of AMF for amdgpu driver.

cRaZy-bisCuiT commented 5 years ago

MikhailAMD what is the benefit of AMF rather than VAAPI? Is either the performance or quality better?

MikhailAMD commented 5 years ago

Performance is defined by HW. AMF and VAAPI just two APIs accessing the same. One important difference though that on Linux AMF works via Vulkan and can be tightly integrated with Vulkan app. And AMF exists on Windows and on Linux while VAAPI is Linux only

madanm2 commented 5 years ago

Once Khronos finishes Vulkan extensions for encoder and decoder and Vulkan open source driver implements them we plan to make an open source version of AMF for amdgpu driver.

@MikhailAMD , any idea when vulkan extension for encoder and decoder would be available?

madanm2 commented 5 years ago

Is Pro driver available for ARM platform?

MikhailAMD commented 5 years ago

Only x86 or x86-64 :)

MikhailAMD commented 5 years ago

I don't know Khronos timeline.

madanm2 commented 5 years ago

Eagerly looking for Pro driver support for ARM platform or Vulkan extension for Encoder :)

Aurnytoraink commented 5 years ago

So 4 months later, what are the news ? I'm interested to see coming this OBS because actually I use VAAPI but it's not really using the GPU and I can't reach 1080p60fps smooth video

MikhailAMD commented 5 years ago

OBS can integrate AMF via Vulkan on Linux with Radeon Pro driver. I cannot comment here on VAAPI integration/implementation. Khronos didn't release spec for video encoder yet.

nirbheek commented 5 years ago

According to Tom Olson, the target release date for the Vulkan standards is first half of 2020.

image-5a78e4de-0707-413f-934f-e955b0b13442

Aurnytoraink commented 5 years ago

According to Tom Olson, the target release date for the Vulkan standards is first half of 2020.

2020, I think I have to wait :cry:

Aurnytoraink commented 5 years ago

@MikhailAMD Oh ? So now if I install AMDGPU-PRO driver it will work ? Also, I know that AMD didn't provide an official release for Arch Linux but we can find AUR packages of that drivers

MikhailAMD commented 5 years ago

PRO driver has AMF runtime for optional install and AMF SDK supports this. But I guess OBS still needs to do some work for Linux-specific integration.

Civil-Code commented 4 years ago

The prerequisites in the Readme file still refer to Windows as the only supported operating system: https://github.com/GPUOpen-LibrariesAndSDKs/AMF/blob/master/README.md

boxerab commented 4 years ago

@MikhailAMD I'm a little confused here - are you able to summarize current linux support for HW decode on AMD hardware ? For example, with ROCm installed, and Polaris card. Thank you :)

MikhailAMD commented 4 years ago

ROCm is not relevant to AMF. On Linux you will need Pro driver + Vulkan + AMF package. Download: https://www.amd.com/en/support/kb/release-notes/rn-rad-lin-19-50-unified Pro installation: https://amdgpu-install.readthedocs.io/en/latest/install-installing.html#installing-the-pro-variant Install AMF: sudo apt install amf-amdgpu-pro

boxerab commented 4 years ago

Thanks - can the Pro driver be installed on a machine that already has ROCm installed ?

MikhailAMD commented 4 years ago

Not an expert in the ROCm but according to what I read so far it should work.

boxerab commented 4 years ago

Thanks. Gonna close this after 3+ years :)

belmontpier commented 4 years ago

running rocm 3 and tried to install amdgpu-pro. It is impossible. Please test on your own. It is very bad for Deep Learning, this way noone can run the ffmpeg h264 in the AMD GPU. Please test and fix it. With NVIDIA its been always possible to run Deep Learning Object Detection and h264 encoding in the same GPU. With AMD, never. Why not just add the AMF and VAAPI, ffmpeg support to rocm if rocm and amdgpu cant work on the same machine? 2020 mid January..

Shatatel commented 4 years ago

I've tried to launch it with Ubuntu 18.04 Kernel: x86_64 Linux 5.3.0-28-generi CPU: Intel Xeon E3-1225 v3 @ 4x 3.6GHz GPU: AMD/ATI Ellesmere [Radeon RX 470/480/570/570X/580/580X], Pilot

How can I find proper combination?

Error! Bad return status for module build on kernel: 5.3.0-28-generic (x86_64) Consult /var/lib/dkms/amdgpu/19.50-967956/build/make.log for more information. Here it is DKMS make.log for amdgpu-19.50-967956 for kernel 5.3.0-28-generic (x86_64) Вт фев 11 11:06:42 MSK 2020 make: Entering directory '/usr/src/linux-headers-5.3.0-28-generic' CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/scheduler/sched_main.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_drm.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/ttm_memory.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu/amdgpu_drv.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/main.o In file included from /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu/../include/../backport/backport.h:8:0, from <command-line>:0: /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu/../backport/include/kcl/kcl_amdgpu.h: In function ‘kcl_amdgpu_get_vblank_timestamp_kms’: /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu/../backport/include/kcl/kcl_amdgpu.h:99:9: error: implicit declaration of function ‘amdgpu_get_vblank_timestamp_kms’; did you mean ‘kcl_amdgpu_get_vblank _timestamp_kms’? [-Werror=implicit-function-declaration] return amdgpu_get_vblank_timestamp_kms(dev, pipe, max_error, vblank_time, flags); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kcl_amdgpu_get_vblank_timestamp_kms CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/ttm_tt.o /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu/amdgpu_drv.c: At top level: /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu/amdgpu_drv.c:1449:26: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] .get_vblank_timestamp = kcl_amdgpu_get_vblank_timestamp_kms, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu/amdgpu_drv.c:1449:26: note: (near initialization for ‘kms_driver.get_vblank_timestamp’) /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu/amdgpu_drv.c:1450:26: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] .get_scanout_position = kcl_amdgpu_get_crtc_scanout_position, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu/amdgpu_drv.c:1450:26: note: (near initialization for ‘kms_driver.get_scanout_position’) CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/symbols.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/scheduler/sched_fence.o cc1: some warnings being treated as errors CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_fence.o scripts/Makefile.build:288: recipe for target '/var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu/amdgpu_drv.o' failed make[2]: *** [/var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu/amdgpu_drv.o] Error 1 scripts/Makefile.build:519: recipe for target '/var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu' failed make[1]: *** [/var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu] Error 2 make[1]: *** Waiting for unfinished jobs.... CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_fence_array.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_drm_cache.o /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_fence.c:63:1: warning: ‘dma_fence_test_signaled_any’ defined but not used [-Wunused-function] dma_fence_test_signaled_any(struct dma_fence **fences, uint32_t count, ^~~~~~~~~~~~~~~~~~~~~~~~~~~ CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/scheduler/sched_entity.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_reservation.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/ttm_bo.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_device_cgroup.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_pci.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_suspend.o LD [M] /var/lib/dkms/amdgpu/19.50-967956/build/scheduler/amd-sched.o /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_pci.c: In function ‘amdkcl_pci_init’: /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_pci.c:189:84: warning: passing argument 2 of ‘amdkcl_fp_setup’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] _kcl_pcie_link_speed = (const unsigned char *) amdkcl_fp_setup("pcie_link_speed", _kcl_pcie_link_speed_stub); ^~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_pci.c:3:0: /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_common.h:23:21: note: expected ‘void *’ but argument is of type ‘const unsigned char *’ static inline void *amdkcl_fp_setup(const char *symbol, void *fp_stup) ^~~~~~~~~~~~~~~ CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_perf_event.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_perf_event.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_kthread.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_mm.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_mn.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_io.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/ttm_bo_util.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_workqueue.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/ttm_bo_vm.o LD [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/amdkcl.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/ttm_module.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/ttm_execbuf_util.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/ttm_page_alloc.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/ttm_bo_manager.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/ttm_page_alloc_dma.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/ttm_agp_backend.o LD [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/amdttm.o Makefile:1655: recipe for target '_module_/var/lib/dkms/amdgpu/19.50-967956/build' failed make: *** [_module_/var/lib/dkms/amdgpu/19.50-967956/build] Error 2 make: Leaving directory '/usr/src/linux-headers-5.3.0-28-generic' Same here for your convinience https://pastebin.com/WneC2bsV

nyanmisaka commented 4 years ago

I've tried to launch it with Ubuntu 18.04 Kernel: x86_64 Linux 5.3.0-28-generi CPU: Intel Xeon E3-1225 v3 @ 4x 3.6GHz GPU: AMD/ATI Ellesmere [Radeon RX 470/480/570/570X/580/580X], Pilot

How can I find proper combination?

Error! Bad return status for module build on kernel: 5.3.0-28-generic (x86_64) Consult /var/lib/dkms/amdgpu/19.50-967956/build/make.log for more information. Here it is DKMS make.log for amdgpu-19.50-967956 for kernel 5.3.0-28-generic (x86_64) Вт фев 11 11:06:42 MSK 2020 make: Entering directory '/usr/src/linux-headers-5.3.0-28-generic' CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/scheduler/sched_main.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_drm.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/ttm_memory.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu/amdgpu_drv.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/main.o In file included from /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu/../include/../backport/backport.h:8:0, from <command-line>:0: /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu/../backport/include/kcl/kcl_amdgpu.h: In function ‘kcl_amdgpu_get_vblank_timestamp_kms’: /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu/../backport/include/kcl/kcl_amdgpu.h:99:9: error: implicit declaration of function ‘amdgpu_get_vblank_timestamp_kms’; did you mean ‘kcl_amdgpu_get_vblank _timestamp_kms’? [-Werror=implicit-function-declaration] return amdgpu_get_vblank_timestamp_kms(dev, pipe, max_error, vblank_time, flags); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kcl_amdgpu_get_vblank_timestamp_kms CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/ttm_tt.o /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu/amdgpu_drv.c: At top level: /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu/amdgpu_drv.c:1449:26: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] .get_vblank_timestamp = kcl_amdgpu_get_vblank_timestamp_kms, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu/amdgpu_drv.c:1449:26: note: (near initialization for ‘kms_driver.get_vblank_timestamp’) /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu/amdgpu_drv.c:1450:26: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] .get_scanout_position = kcl_amdgpu_get_crtc_scanout_position, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu/amdgpu_drv.c:1450:26: note: (near initialization for ‘kms_driver.get_scanout_position’) CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/symbols.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/scheduler/sched_fence.o cc1: some warnings being treated as errors CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_fence.o scripts/Makefile.build:288: recipe for target '/var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu/amdgpu_drv.o' failed make[2]: *** [/var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu/amdgpu_drv.o] Error 1 scripts/Makefile.build:519: recipe for target '/var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu' failed make[1]: *** [/var/lib/dkms/amdgpu/19.50-967956/build/amd/amdgpu] Error 2 make[1]: *** Waiting for unfinished jobs.... CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_fence_array.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_drm_cache.o /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_fence.c:63:1: warning: ‘dma_fence_test_signaled_any’ defined but not used [-Wunused-function] dma_fence_test_signaled_any(struct dma_fence **fences, uint32_t count, ^~~~~~~~~~~~~~~~~~~~~~~~~~~ CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/scheduler/sched_entity.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_reservation.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/ttm_bo.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_device_cgroup.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_pci.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_suspend.o LD [M] /var/lib/dkms/amdgpu/19.50-967956/build/scheduler/amd-sched.o /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_pci.c: In function ‘amdkcl_pci_init’: /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_pci.c:189:84: warning: passing argument 2 of ‘amdkcl_fp_setup’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] _kcl_pcie_link_speed = (const unsigned char *) amdkcl_fp_setup("pcie_link_speed", _kcl_pcie_link_speed_stub); ^~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_pci.c:3:0: /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_common.h:23:21: note: expected ‘void *’ but argument is of type ‘const unsigned char *’ static inline void *amdkcl_fp_setup(const char *symbol, void *fp_stup) ^~~~~~~~~~~~~~~ CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_perf_event.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_perf_event.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_kthread.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_mm.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_mn.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_io.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/ttm_bo_util.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/kcl_workqueue.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/ttm_bo_vm.o LD [M] /var/lib/dkms/amdgpu/19.50-967956/build/amd/amdkcl/amdkcl.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/ttm_module.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/ttm_execbuf_util.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/ttm_page_alloc.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/ttm_bo_manager.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/ttm_page_alloc_dma.o CC [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/ttm_agp_backend.o LD [M] /var/lib/dkms/amdgpu/19.50-967956/build/ttm/amdttm.o Makefile:1655: recipe for target '_module_/var/lib/dkms/amdgpu/19.50-967956/build' failed make: *** [_module_/var/lib/dkms/amdgpu/19.50-967956/build] Error 2 make: Leaving directory '/usr/src/linux-headers-5.3.0-28-generic' Same here for your convinience https://pastebin.com/WneC2bsV

Currently amdgpu-pro only supports the default kernel version on Ubuntu 18.04 LTS. In a few months, Ubuntu 20.04 LTS will be released with a 5.4 kernel. I think that AMD will update the driver to support higher kernel versions.

https://ubuntu.com/about/release-cycle

Shatatel commented 4 years ago

I've got it. Ubuntu 18.04.4 goes with 5.3.0-28 kernel version afaik. I'd be glad to see it working out of the box in Ubuntu distros.

koreanfan commented 4 years ago

I have ubunut 18.04.4 with installed amdgpu-pro and amf-amdgpu-pro. h264_amf works via ffmpeg. I install obs 25.0.8. How i can use for streaming and recording amd amf via obs? For streaming and recording i use VAAPI via ffmpeg: DRI_PRIME=1 LIBVA_DRIVER_NAME=radeonsi ffmpeg -y \ -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -hwaccel_output_format vaapi \ -framerate 30 -video_size 1920x1050 -f x11grab -i :0.0 -f pulse -ac 2 -i default \ -vf 'hwupload,scale_vaapi=w=1280:h=720:format=nv12' \ -vcodec h264_vaapi -g 60 -sei identifier+timing+recovery_point \ -bsf:v extract_extradata -b:v 3M -maxrate 3M -c:a aac -b:a 128k -ar 44100 \ -f flv OUTPUT How this code must be if i want use h26_amf?

MikhailAMD commented 4 years ago

If it works with regular FFmpeg, the command line for OBS should be similar: "-hwaccel h264_amf" but I didn't try OBS on Linux.

Shatatel commented 4 years ago

Looks nice. I'll try it out later. Thanks for your work, Mikhail.

Aurnytoraink commented 4 years ago

How do you use ffmpeg to convert a video with amd, and how to screen capture too ?

MikhailAMD commented 4 years ago

In FFmpeg command line you could use "-hwaccel h264_amf" to enable AMF hardware encoder inf you installed AMD Pro with with AMF. Here is more info for other variants: https://trac.ffmpeg.org/wiki/HWAccelIntro For capture you would need an application, for example OBS.

Aurnytoraink commented 4 years ago

Hmm, doing the command ffmpeg -hwaccels doesn't show me that h264_amf is avaible. Here is the output:

vdpau
vaapi
drm
opencl
vulkan
Aurnytoraink commented 4 years ago

And when I do ffmpeg -codecs | grep h264, it returns:

DEV.LS h264                 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_v4l2m2m libopenh264 ) (encoders: libx264 libx264rgb libopenh264 h264_amf h264_omx h264_v4l2m2m h264_vaapi )
MikhailAMD commented 4 years ago

My mistake, it is codec, not accelerator: -c:v h264_amf

koreanfan commented 4 years ago

Hmm, doing the command ffmpeg -hwaccels doesn't show me that h264_amf is avaible. Here is the output:

vdpau
vaapi
drm
opencl
vulkan

what version of ffmpeg and linux you use?

MikhailAMD commented 4 years ago

My mistake, it is codec, not accelerator: -c:v h264_amf

koreanfan commented 4 years ago

i launch this command on my ubuntu 18.04.4 with latest ffmpeg compiled form source and i got: Hardware acceleration methods: vdpau vaapi Is vulkan must presented in this list for my configuration?

MikhailAMD commented 4 years ago
koreanfan commented 4 years ago

Btw, yesterday i test amdgpu-pro 20.10 on ubuntu, ubuntu-mate, xubuntu and lubuntu. I have got fail launch xubuntu and lubuntu after sucessfull installing amdgpu-pro with legacy opencl for my rx560 and rebooting. On ubuntu and ubuntu-mate i have got success. i use distros isos with version 18.04.4. After on ubuntu and ubuntu-mate i install amf. Then i compile ffmpeg with --enable-amf and copy files from AMF/..... to /usr/include/AMF/ . But i have fail. So to fix this i install libunistring-dev. After that i have successfully installed ffmpeg with amf. But when i start record my screen via ffmpeg with h264_amf i have fail. I have errors vulcan not inicial and some vulkan files not found. But amdgpu-pro worked and i start dota 2 with pro-vulcan and game works perfectly ( bwt with mesa drivers and opensource vulkan i cant play dota 2 normally cuz i always have laggs and freezes, and i dont know how to fix this problem with open stack). So to fix problem with using amf via ffmpeg you need use simple code somthing like that: ffmpeg -y -framerate 60 -f x11grab -i :0.0 -f alsa -ac 2 -i default \ -c:v h264 -b:v 6M -f flv h264.flv I dont know how, but after using h264 you can use h264_amf via ffmpeg without any trouble. And in fmpeg logs vulkan successfully initialized and all files are found.

koreanfan commented 4 years ago

Yeah i install amdgpu-pro and amf package and buid it with enable amf and ffmpeg -codecs:

DEV.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_v4l2m2m ) (encoders: libx264 libx264rgb h264_amf h264_v4l2m2m h264_vaapi ) D.VIL. hap Vidvox Hap DEV.L. hevc H.265 / HEVC (High Efficiency Video Coding) (encoders: libx265 hevc_amf hevc_vaapi )

MikhailAMD commented 4 years ago

Notes:

  1. AMF works via Vulkan private encoder. The fact that games that use Vulkan are running doesn't mean anything.
  2. Vulkan runtime should be from Pro driver. Sometimes there are conflicts and FFmpeg picks up open source version - try to uninstall it.
  3. Does the simple FFmpeg transcode command line work with h264_amf? If not what is the output?
  4. In your command line you didn't include amf. Could you please clarify how it is relevant?
koreanfan commented 4 years ago

ffmpeg -y -loglevel debug -framerate 60 -f x11grab -i :0.0 -f alsa -ac 2 -i default \ -c:v h264_amf -b:v 6M -f flv amf.flv -- for simple record desktop

But if you before dont run command ffmpeg -y -framerate 60 -f x11grab -i :0.0 -f alsa -ac 2 -i default -c:v h264 -b:v 6M -f flv h264.flv wich use h264 , you cant use amf, you willbe got errors!!!

koreanfan commented 4 years ago

ffmpeg -buildconf ffmpeg version N-97814-g6275a7e Copyright (c) 2000-2020 the FFmpeg developers built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04) configuration: --prefix=/home/XXXX/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/XXXX/ffmpeg_build/include --extra-ldflags=-L/home/XXXX/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/XXXX/bin --enable-gpl --enable-gnutls --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-amf --enable-nonfree libavutil 56. 46.100 / 56. 46.100 libavcodec 58. 84.100 / 58. 84.100 libavformat 58. 43.100 / 58. 43.100 libavdevice 58. 9.103 / 58. 9.103 libavfilter 7. 81.100 / 7. 81.100 libswscale 5. 6.101 / 5. 6.101 libswresample 3. 6.100 / 3. 6.100 libpostproc 55. 6.100 / 55. 6.100

configuration: --prefix=/home/XXXX/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/XXXX/ffmpeg_build/include --extra-ldflags=-L/home/XXXX/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/XXXX/bin --enable-gpl --enable-gnutls --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-amf --enable-nonfree

MikhailAMD commented 4 years ago

Very strange, dependencies between processes. What is the output for failure?

koreanfan commented 4 years ago

sry i delete that messages with vulkan errors when i reinstall system

MikhailAMD commented 4 years ago

Everything what you provided so far looks normal - except this strange run dependecy. My feeling is that if AMF failed to initialize Vulkan - it found a wrong driver. This cannot be controlled from AMF but by Vulkan installations.

koreanfan commented 4 years ago

sudo dpkg --list | grep vulkan ii libvulkan1:amd64 1.1.70+dfsg1-1ubuntu0.18.04.1 amd64 Vulkan loader library ii vulkan-amdgpu-pro:amd64 20.10-1048554 amd64 AMDGPU Pro Vulkan driver ii vulkan-amdgpu-pro:i386 20.10-1048554 i386 AMDGPU Pro Vulkan driver

koreanfan commented 4 years ago

i saw libvulkan1:amd64 and he was instaled with steam

koreanfan commented 4 years ago

So i need delete package libvulkan1:amd64 1.1.70+dfsg1-1ubuntu0.18.04.1?