-
Notifications
You must be signed in to change notification settings - Fork 54
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
Support AMD GPU encoding #45
Comments
This is great info, thanks for the detective work. I'll see if I can find a way to introduce this to the profile concept. Ffmpeg is super powerful but it doesn't seem to abstract the complexity away sometimes... |
Every time I need to do something different with ffmpeg I have to spend time looking up docs, blogs, and stackexchange... After digging into it, I'm not sure whether it's worth pursuing the vaapi encoding. The quality I'm getting is crap. The only really useful way to use it (for me) is with constant-quality mode ( Compared to libx264... the very-fast preset you use by default is 20% slower than using vaapi encoding (vaapi takes the same time regardless of setting), produces a file that is a bit over half the original, and the quality is decent, perhaps similar to The one big caveat is that I'm using an AMD Ryzen 9 5900HX with integrated GPU. I don't know and have not found any info on how the video encoding block on that iGPU compares to those on higher-end discrete AMD GPUs. I also don't know what limitations the Linux VAAPI driver has vs. the actual HW capabilities that may be accessible on Windows. I do find complaints that the AMD HW doesn't produce B-frames, which I can verify looking at the files produced. Any way, I'm planning to use the VAAPI decoding (no quality harm there) and then the libx264 ultra-fast preset to get an initial rendering and then redo using the medium preset. (Medium produces great quality, files ~60% the size of the original, but takes 2x as long as the very fast preset.) |
Based on your comment, "I'm not sure whether it's worth pursuing the vaapi encoding" - I wasn't planning to do anything with AMD GPU support. It that's not what you meant, please let me know! |
@tve what quality can one get with libx264 with the same file size as |
I dont know if anyone has experimented much with AMD GPU settings, but if there are recommendations, I'd be happy to include them in the documentation. |
@tve I revisited the vaapi config a little bit, and I think that I can make the config possible, by adding an optional "filter" parameter to the profile. Did you have any success with getting vaapi to work? What parameters did you use? Thanks!! |
I did not pursue vaapi further after my last comment above. I'm using libx264 and the veryfast setting. |
Since 0.93.0, and support for the input/filter/output settings in the "profiles" configuration, this should be possible. I dont know the settings, but check the PERFORMANCE_GUIDE doc, and the same sort of thing should work for vaapi... |
Just wanted to confirm that the "filter" property in profiles does indeed let you use vaapi. I'm currently using:
|
This is fantastic info. Thank you for sharing it. |
Unfortunately, AMD driver on Linux does not support
It should work on all platforms. Shall I create a PR? |
Hi. This is great info. Maybe can call it vaapi-linux ? Then it can be added to the built in profiles. Don't worry about a pr, I can add it. Thanks! |
@time4tea as you see fit! |
Btw, you may use both |
Hello, I tried all the above overlay configurations and still get the: I am on Ubuntu 24.04 with a 6650TX Radeon. Can the generating of the overly be accelerated? Thanks. |
@RaveGun what command line are you using and where do you add the ffmpeg configuration? |
@igutidze I have a file created at this location: And the command line is: And the
I am not happy with the performance of the system anyhow on editing any 4k Videos. I am not a content creator so this will be a one time event, that I will have to use the computer for 4k video editing. |
@RaveGun please add
|
I did the test:
|
I just got a new box with an integrated AMD GPU. Of course getting hardware encode/decode to work cost a bunch of hair off my head... I'm using linux, it's possible that the 'AMF' drivers on windows make things easier, dunno.
The simplest profile settings ASFAIK are:
The result is:
which is ffmpeg's way to say that the output of the overlay filter can't be piped like that into the h264_vaapi encoder 'cause the latter expects the frame to be in the hardware/gpu. What's needed is a 'hwupload' filter that does the upload to the gpu memory. E.g., in FFMPEGOverlay instead of
it needs
nice, eh?
BTW, I noticed that ffmpeg has an overlay_vaapi filter, so this would mean the decoded video frames would stay in gpu, get overlaid, and then encoded. Sadly the AMD vaapi driver doesn't support that... I believe the Intel one might.
The text was updated successfully, but these errors were encountered: