Open alexheretic opened 1 year ago
Hi, I wanted to say this is a pretty awesome tool. I've been using it to test re-encodes of videos I want to archive. I was going to open an issue asking about AMD support (along with some of my finding), but saw this one and thought it would be better to add the info here.
I thought adding basic AMD support would be as simple as the pull request for NVENC, but discovered a snag. AMD's AMF encoder (and by extension FFMPEG) has two QP settings. -qp_i
sets the quality for I-frames and -qp_p
sets the quality for P-frames. Technically, I got away with only setting the -qp_p
flag when doing a crf-search, but that leaves the quality of I-frames set to AMD's default (26). I wouldn't want to do a full video encode without changing -qp_i
.
Here is an example of an FFMPEG encode using AMD HEVC encoder:
ffmpeg -i "I:\Video\testvideo1.mkv" -vcodec hevc_amf -qp_p 22 -qp_i 22 "i:\Video_Encodes\testvideo1.mp4
Adding an override option for other encoders would help in my scenario, but it would need to support multiple FFMPEG flags to work correctly with AMD's encoder.
Thanks.
Thanks for that example, I agree the mechanism should be able to handle this case.
Is there any updates on this? I'd like to be able to use ab-av1 with hevc_amf and av1_amf but currently cannot.
For amd it is pretty simple to just set both qp_i and qp_p to the same peramiter to achieve a decent encode, jsut gotta remember it's 0 to 255.
ffmpeg -i '2024-04-06_21-52-32.mp4' -an -c:v av1_amf -rc cqp -qp_i 128 -qp_p 128 ./2024-04-06_21-52-32-comp.mp4
(3.4GB HEVC to 1.99GB AV1):
SSIM: 0.9717
VMAF: 90.6857
ab-av1 was created to search for the optimal crf value for svt-av1. Now we support all ffmpeg encoders we see some of these do not support crf. E.g. hevc_vaapi uses
-qp
.Currently we have hard-coded workarounds for librav1e, _vaapi, _nvenc & *_qsv encoders.
For other encoders it may be helpful to allow the user to specify the crf substitute. Something like
--ffmpeg-crf-arg cq
.