Log in

View Full Version : AMD Ryzen 5500GT APU video processing libraries and Linux ffmpeg video encoding.


rupeshforu3
9th August 2024, 04:00
Hi I am Rupesh from India and I brought a new desktop pc with ryzen 5500GT APU and Asus prime b450 m k2 motherboard. I have installed debian Trixie testing Linux distribution and everything is working fine except I have some doubts related to video encoding using ffmpeg and libaom av1.

I have some mp4 h264 video files and I thought to convert them to av1 codec using libaom. So I compiled ffmpeg source code with options cpu=znver3 and --enable-libaom and --enable-x265.

I succeeded in building ffmpeg from source code but my Linux doesn't have package related to AMF which is the software from AMD related to video codecs. During the configuration of ffmpeg first I have included the option --enable-amf but I got error as amf requested but not found. So I removed this option and after that the compilation was successful.

I have used the recently build ffmpeg to convert h264 files to av1 codec and succeeded. After that I have copied converted av1 files to the latest android tablet and tried to play through vlc video player but when I skip forward 10 minutes the player is getting stuck for few seconds and resume. I mean it can't respond quickly when I fast forward.

Previously I used Intel 10th gen 10100 APU and Asus prime h 510 me motherboard and used the same ffmpeg tool to convert the same h264 files to av1 codec in the same Linux operating system. After that I have copied them to the same latest android tablet and tried to play through vlc video player and at that time there is no lag when I fast forward. I mean it responded quickly when I fast forwarded.

Previously while using Intel 10th gen pc there were options such as --enable-libmfx --enable-qsv --enable-libvpl

I think that those are related to Intel but not useful while using amd APU and so I have given option --disable-libmfx and not used vpl qsv at all.

I searched web for AMD ffmpeg and found only AMF but there are no options mfx, vpl found in Intel.

I found an article on how to compile ffmpeg with AMF support and it suggested to clone the git of AMF and so I cloned it and the resulting cloned folder is 1300 mb.

I am confused on how to compile ffmpeg with AMF support.

Is there any degradation in the quality of converted av1 file when libraries such as AMF mfx vpl are not used.

If you say just ignore AMF support for ffmpeg I will ignore.

Kindly clarify my doubts related to AMF and if you think AMF is must for proper libaom encoding kindly suggest proper method to compile ffmpeg with AMF support.

Regards,
Rupesh.

GeoffreyA
11th August 2024, 08:54
Being on Windows, I can't tell you about compiling FFmpeg for Linux. The thing is, libaom-av1 is the reference, software encoder; it works without hardware encoding. The same with libsvtav1. Hardware encoders, like AMD's AMF, are faster, but their quality does not match software encoders. My advice is simply to use libsvtav1, which is both fast and good quality. Ignore AMF, or any other hardware encoder for that matter! If libsvtav1 is not in your FFmpeg, try to compile it or use libaom-av1. Indeed, the latter is the gold standard of AV1 quality but slower.

To solve the lag problem, add -g 240 to your command. That will add a new keyframe every 240 frames, which, for 24-fps content, is 10 seconds. By default, I think libaom-av1 has a big keyframe interval, leading to lag when seeking. Here are some commands for quality encoding:

ffmpeg -i INPUT.mp4 -c:v libaom-av1 -cpu-used 4 -crf 23 -g 240 -arnr-strength 1 -c:a copy OUTPUT.mp4

ffmpeg -i INPUT.mp4 -c:v libsvtav1 -preset 4 -crf 23 -g 240 -svtav1-params tune=0 -c:a copy OUTPUT.mp4

For test encodes, raise the preset or cpu-used value for more speed. A value of 4 is recommended for the final encode. Raise crf for more compression, or lower it for more quality; but it's little use going below 18. (Also, I don't think the 5500GT, which is Cezanne, comes with hardware AV1 encoding; that is only since VCN 4. Cezanne carries VCN 2.2.) I hope that helps!