Open boyedarat opened 4 months ago
We are aware of a regression in the latest public driver: incompatibility between FFmpeg use of D3D11VA and AMF encoder, if no filters are in-between. The fix is ready and will appear in one of future driver packages. We will inform when it is available. For now please use one of older drivers : 23.12.1
We are aware of a regression in the latest public driver: incompatibility between FFmpeg use of D3D11VA and AMF encoder, if no filters are in-between. The fix is ready and will appear in one of future driver packages. We will inform when it is available. For now please use one of older drivers : 23.12.1
Thanks for the confirmation. Please keep this issue open. I'll test again when the new driver package is out and update the status here.
I've just seen that new drivers have been released. Have you had a chance to try them out ?
@MikhailAMD Just tested with Adrenaline 24.2.1 on the same system. FFMPEG now just hangs.
On 24.1.1, it would just exit, with a 1KB output file.
Yes, the fix missed 24.2.1. I am tracking and will let know.
Yes, the fix missed 24.2.1. I am tracking and will let know.
@MikhailAMD Adrenaline 24.3.1 is now out and guess what? It is still not fixed. Is AMD planning to actually fix this issue? Or should we just give up?
I tried myself: reproduced the problem with 24.1.1 driver and after installing 24.3.1 the issue is gone. One thing to check - you have two GPUs: one discreet and one from Ryzen. Do you know which one is used by default? Can you experiment with "-gpu 0" and "-gpu 1" in ffmpeg CMD?
@MikhailAMD The options '-gpu 0' or '-gpu 1' don't seem to be AMF options, but rather for NVENC. Here is the full command line I use for FFMPEG:
ffmpeg.exe -hwaccel d3d11va -hwaccel_output_format d3d11 -hwaccel_device 0 -i video1.mp4 -c:v hevc_amf -usage high_quality -c:a libfdk_aac -y video2.mp4
ffmpeg.exe -hwaccel d3d11va -hwaccel_output_format d3d11 -hwaccel_device 1 -i video1.mp4 -c:v hevc_amf -usage high_quality -c:a libfdk_aac -y video2.mp4
Both of the above options cause the FFMPEG process to freeze. I have to kill the process to exit it. This is the same FFMPEG build I posted in my original bug report above.
If you have a FFMPEG build or options that work for you. Please post it here. Thanks.
I used FFmpeg 6.1.1 full release build from here: https://www.gyan.dev/ffmpeg/builds/ My command line was the same as the original one. AMF in this command line will get D3D11 device from HW context so you are right that "-hwaccel_device" should be used to select the GPU device. Before updating drivers I usually uninstall all AMD drivers using the cleanup utility to ensure fresh install: https://www.amd.com/en/support/kb/faq/gpu-601 Also, please enable verbose FFmpeg log. The problem you see may be somewhat different from the fixed one. Your latest command line includes "-usage high_quality" which would enable PA. PA requires more frames to be accumulated before encoder can produce a compressed frame. The defaults may cause deadlock. I suggest to try without this usage and read this article for PA: https://github.com/GPUOpen-LibrariesAndSDKs/AMF/blob/master/amf/doc/AMF_Video_PreAnalysis_API.md. You may need to add more frames by "-extra_hw_frames". Another problem could be that D3D11VA allocates output frames without D3D11_BIND_SHADER_RESOURCE flag. But AMF PA needed it as it is using D3D11. We plan to introduce a patch to FFmpeg for this. If you want to use PA you may need to enable SW decoding for now.
We plan to introduce a patch to FFmpeg for this. If you want to use PA you may need to enable SW decoding for now.
I've managed it to get to work with these options:
ffmpeg.exe -threads 8 -hwaccel d3d11va -hwaccel_output_format d3d11 -hwaccel_device 1 -i video1.mp4 -c:v hevc_amf -rc hqvbr -c:a libfdk_aac -y video2.mp4
Not being able to use -usage high_quality
is a huge bummer for me. Also, dxva2 is not available on my dedicated Radeon RX 6850M XT, only d3d11 is an option for hardware transcoding.
I am not sure how far along AMD has gotten along with FFPMEG 7 support, now that it is out. It is really frustrating that support on such a popular tool is just so poor.
Any update on this? Running to FFMPEG freezes with PA enabled from a fresh driver install and newly built FFMEPG with AMF
There are two separate issues here:
Describe the bug Using "-hwaccel d3d11va -hwaccel_output_format d3d11" on FFMPEG for hardware accelerated transcoding fails. But using "-hwaccel dxva2 -hwaccel_output_format dxva2_vld" works just fine. I've tried with many different FFMPEG v6 builds, including latest snapshot releases, same issue.
To Reproduce Steps to reproduce the behavior: Just attempt to transcode any h264 MP4 video to HEVC using AMF on FFMPEG v6, as per your Wiki: https://github.com/GPUOpen-LibrariesAndSDKs/AMF/wiki/FFmpeg%20and%20AMF%20HW%20Acceleration#41-hardware-decode-and-hardware-encode
Setup (please complete the following information):
Debug Log (please upload or paste): No error log, it just exits with a 1KB output file.
Expected behavior
Screenshots N/A.
Additional context Here is the output using DXVA2 with AMF, that works fine: