feat: implement support for AMD AMF codecs #163
+3,228
−14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a draft until things settle.
Some notes:
The gstreamer Dockerfile applies a patch from my Gist repo. I probably should have stuffed that patch into this repo instead. I wasn't thinking clearly enough last night to realize that Docker has access to the local files of this repo.
Edit 4: You need to mount your local distribution's compatible AMF libraries into the image as read-only volumes:
Either for Docker run:
Edit 5: Here, have a Docker Compose preset, assuming you built all these images locally:
Edit 2: The version of AMF that this image set creates requires bleeding edge AMDGPU VCN firmware. I hope it's possible to update your test machines to the latest available linux-firmware package.
Edit 3: Basically, whatever Docker host you run this on requires the
amdgpu
kernel module to interface with the GPU, and the latest availablelinux-firmware
package or equivalent for your distribution. This should at least beUbuntu 24.04
or whatever other LTS is available from 2024, or a more bleeding edge distribution if you prefer. After all, the AMF package this bundles is targetingUbuntu 24.04
, and is running on anUbuntu 24.10
image.Edit: Some editing instructions for your config.toml, based on the current v4 format, in case you don't want to reset your config and paste in your UUID and device pairings:
First, look at your
gstreamer.video
default_source
setting. If there is amax-bytes=0
, it should be removed. If there is amax-buffers
, it should be changed to5
or so.Second, for every
gstreamer.video.defaults.*
plugin entry already in existence, this may be worth tweaking, but not applicable to AMF. If the first part of thevideo_params
isqueue !
, it should be changed toqueue leaky=downstream max-size-buffers=5 !
. If it already has theleaky=downstream
part, change themax-size-buffers
to5
or so. This seems to help some codecs. Just so long as theleaky
parameter is there, of course.Third, add the default plugin settings for
amfcodec
, directly underneath thegstreamer.video.defaults.qsv
section:Finally, add the three codec sections, in the
[[gstreamer.video.*_encoders]]
sections, below the respectiveplugin_name = 'qsv'
sections, and directly above the respectiveplugin_name = 'vaapi'
sections. If they are not ordered before thevaapi
sections, thevaapi
sections will take priority, as they are tried in order of the config file:AV1:
H.264:
HEVC: