Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

Add ffmpeg amd hardware acceleration presets #324

Merged
merged 1 commit into from
Feb 25, 2024
Merged

Conversation

bytedream
Copy link
Member

@bytedream bytedream commented Jan 29, 2024

This PR adds hardware acceleration for AMD via the --ffmpeg-preset flag. Unfortunately I'm unable to test if it's working because I do not own an AMD card.

I need someone with an AMD card to verify that everything works. Testing the h264-amd-normal and h265-amd-normal feature are the minimum requirements for me to merge the feature (testing other quality levels are still desirable though; also AV1 testing would be great, but I'm okay with it to not be tested as only newer AMD models support it). You can either build the feature/amd-hwaccel branch yourself or use a pre-built binary.

Until the named tests requirements are met, this feature is blocked.

@bytedream bytedream linked an issue Jan 29, 2024 that may be closed by this pull request
@3c7
Copy link

3c7 commented Feb 25, 2024

Tested the following presets on an AMD Radeon RX 6800 XT:

  • h264-amd-normal
  • h265-amd-normal

Both of them work and speed up the process of generating the output file, however, there's only about 20% load on the GPU. I don't really know if this can be sped up further? Tried with more ffmpeg threads, but that changed nothing.

The preset av1-amd-normal results in an error - which could be related to my setup:

[av1_amf @ 0000019c85ae0980] CreateComponent(AMFVideoEncoderHW_AV1) failed with error 1
[vost#0:0/av1_amf @ 0000019c85ae06c0] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
[vf#0:0 @ 0000019c8561f380] Error sending frames to consumers: Encoder not found
[vf#0:0 @ 0000019c8561f380] Task finished with error code: -1129203192 (Encoder not found)
[vf#0:0 @ 0000019c8561f380] Terminating thread with return code -1129203192 (Encoder not found)
[vost#0:0/av1_amf @ 0000019c85ae06c0] Could not open encoder before EOF
[vost#0:0/av1_amf @ 0000019c85ae06c0] Task finished with error code: -22 (Invalid argument)
[vost#0:0/av1_amf @ 0000019c85ae06c0] Terminating thread with return code -22 (Invalid argument)
[out#0/matroska @ 0000019c87652a00] 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=       0KiB time=N/A bitrate=N/A speed=N/A
Conversion failed!

Edit: I used the prebuilt binary from the Github action.

@bytedream
Copy link
Member Author

bytedream commented Feb 25, 2024

Hey, thanks for your response, great to hear that it works!
I'm not very familiar how graphics cards are working internally but the low load may be due to the design. When I use the h265-nvidia-normal preset, I also only have a few % of total gpu load but 100% of encoder load, so the encoder maybe isn't directly linked to other components of the graphics card which are reporting the total load (?).
And regarding the error with av1-amd-normal, this is "normal". Amd supports AV1 encoding beginning with its RDNA3 architecture (RX7000 series and above) so you card doesn't has support for it. Unfortunately I don't know a (platform independent) way to check whether or not a gpu supports a specific codec.

@3c7
Copy link

3c7 commented Feb 25, 2024

You're welcome and thanks for the clarification!

@3c7
Copy link

3c7 commented Feb 25, 2024

This mentions AV1 as supported, though: https://www.amd.com/de/products/graphics/amd-radeon-rx-6800-xt Oops, that's just decoding.

@bytedream bytedream merged commit 6a7aa25 into master Feb 25, 2024
8 checks passed
@bytedream bytedream deleted the feature/amd-hwaccel branch February 25, 2024 17:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AMD hardware acceleration
2 participants