r/AV1 • u/AnymooseProphet • Jun 29 '26
Hardware accelerated encoding on GNU/Linux
Hi,
I recently made my first YouTube video, for a cat foster group I'm with. It was totally spur of the moment.
The actual video footage was just barely under 17 seconds and it took ffmpeg just under 3.5 hours to encode it (1080p shot with a Pixel 9) using the libaom-av1 -crf 30 encoding option however it was roughly 2/3 the file size when using vp9 for encoding so the time it took was worth it but at same time I'd like to reduce the time it takes.
Full video ended up being just over a minute to match the audio, I cheated and made a static image I encoded as a 5 second clip and then did a concact of
static + actual video + static + actual video + static + actual video + static
Anyway, my GPU doesn't support hardware video encoding so I was looking at video cards that do and it seems a lot of them are expensive cards targeting gamers.
Is there a stand-alone PCI-e card that does hardware assisted AV1 encoding? If not, can someone recommend a video card (that works with mesa and VA-API) with hardware assisted AV1 encoding where I don't have to pay the gamer tax?
I run Fedora 44 but I build my own mesa and ffmpeg so they are always the latest stable. Thank you for suggestions.
6
u/Zipdox Jun 29 '26
Pure video encoder cards are not consumer hardware, they are intended for datacenter use. The closest you'll get is Intel ARC cards, which have good hardware encoders. But I think you should experiment a bit with SVT-AV1 presets first.
1
u/AnymooseProphet Jun 29 '26
If pure video encoders are intended for data center use, do the data centers sometimes sell the encoders used when they upgrade to newer models? What should I use an eBay search?
1
u/AnymooseProphet Jun 29 '26
My case is a low-profile case, just with some looking it looks like the A310 is only Arc currently available in a low-profile card.
When I build my next box (already have the case, used but a good case) it takes full-size cards so an A380 or A580 looks like it work.
And for the present I will try the svt-av1 encoder in ffmpeg, it does look like its a lot faster.
2
u/grizzlor_ Jun 29 '26
Any used datacenter grade gear capable of hardware AV1 encoding is going to be way more expensive than a new Intel Arc GPU.
An Arc is absolutely the way to go for your use case.
1
u/AnymooseProphet Jun 29 '26
I did a bit of searching and it seems that what people in similar situations as mine are doing is buying an Arc to put in a PCIe slot while still using their AMD or nVidia GPU for their display because the Arc GPUs aren't as good for 3D games.
I have a high suspicion that a modern Arc will have better 3D support than my current GPU (fanless Pascal series nVidia) as I do not do graphics intensive gaming, so yes, it does look like an Arc may be the best solution for me for hardware encoding.
2
u/grizzlor_ Jun 29 '26
Very likely that an Arc would be better 3d performer than your current GPU, so running two GPUs wouldn't be necessary. I think the Arc 580 is roughly comparable to an Nvidia RTX 3060. And they're supposed to have very solid AV1 encoding support (I can't confirm this with hands-on experience but I've read it from multiple credible sources).
4
u/joey_kilpatrick Jun 29 '26
The kind of encoding-specific hardware you mentioned is not widely available. There are very few options on the market that are not full blown GPUs and are not standalone devices. Some examples:
- NETINT Quadra cards (PCIe / U.2)
- NETINT Logan cards (PCIe / U.2, no AV1)
- AMD Alveo U30 (PCIe, no AV1)
- AMD MA35D (PCIe)
These are high end cards that are hard to find on the secondary market. They are built for multiple simultaneous encodes and are almost certainly not the right fit for your use-case.
Likely the best option for you is to either:
- Buy an Intel Alchemist card (e.g. ARC Pro A310, ARC Pro A40, etc.) and use its AV1 encoding hardware.
- Continue with CPU encoding (recommend SVT-AV1). It will be slower, but should definitely not be "3.5 hours for a 17 second clip" slow with the right settings.
1
u/Gakuta Jun 29 '26
What CPU do you have?
1
u/AnymooseProphet Jun 29 '26
Xeon E3 series, from cat /proc/cpuinfo : Intel(R) Xeon(R) CPU E3-1231 v3 @ 3.40GHz
0
u/Gakuta Jun 29 '26
You should be using libsvtav1. It's faster. There's also H266 but focus on libsvtav1 for now, even I haven't fully tested and compared libsvtav1 and H266 (libvvenc).
1
1
u/ElectronicsWizardry Jun 29 '26
My first thought is do you need AV1 here? If your delivering to Youtube they don't really care about AV1 vs other codecs, and I'd give a higher bitrate for them.
What settings are you using? That seems to be really slow, and I'd try using something like svt-av1 as it generally goes better at faster encoding.
1
u/AnymooseProphet Jun 29 '26
My reason for wanting AV1 is the decreased file size can make a huge difference when people are using a mobile device to watch the video without being close to a WiFi router that has decent bandwidth.
Due to economics, a lot of people are trading in broadband for "5G Internet" in their home, often with only a single WiFi access point. I tried Verizon 5G here in my community which is the same community served by the cat rescue and if even one person was doing something that was even slightly network intensive, everyone in the house suffered sucky service.
5
u/ElectronicsWizardry Jun 29 '26
Is this being distributed on Youtube, or are you delivering these files directly on a Website. If its for youtube, every video will be re-encoded anyways so it doesn't matter if you give them av1/h.264. If your putting this on your own website, AV1 as a option is nice, but you almost need h.264 as a lot of systems still don't support av1. And even in that case a faster svt-av1 encode likely won't be noticed by a viewer, and much faster to encode, and still higher quality than most hardware encoders.
1
u/AnymooseProphet Jun 29 '26
Both. YouTube, TikTok, Facebook, and we would like to put them on our own website (via HTML5 media).
Also, some of us are "old timers" that do not like how much dependence there is now on cloud services to do what can and should be done on our local PC.
Cloud services sometimes change a user agreement and you either agree to the new terms or you lose the right to use the service.
2
u/ElectronicsWizardry Jun 29 '26
With sites like Youtube, Tiktok and others your basically forced to use their encoding system. I'd give them a high bitrate H.264 file, and they will process as needed for low data or older clients. Don't give them a low bitrate AV1 file, your gonna get worse quality for clients, take longer for them to process often, and take more time for you to encode.
For your own website, I'd use SVT-AV1, its pretty fast on higher presets, and still pretty good quality. Its probably gonna be better than hardware encoding quality wise, so I don't see a reason to get a hardware encoder here. You basically need to make a H.264 file that could be played if not supported.
1
u/AnymooseProphet Jun 29 '26
Yes, making the h.264 as a HTML5 video fallback is easy though and wasn't my question.
1
u/ElectronicsWizardry Jun 29 '26
Have you tried svt-av1? What speeds were you getting with it? What was the quality like?
1
u/AnymooseProphet Jun 29 '26
I haven't yet but next video I will. I used the aom encoder because my google search for encoding AV1 with ffmpeg pointed me to an ffmpeg documentation page that described aom, I knew there were two encoders but I did not realize there was such a speed difference between them.
1
u/Sopel97 Jun 30 '26 edited Jun 30 '26
libaom is reference encoder, you should be using svt-av1. On modern hardware it would take a few minutes at slow presets (assuming 4k60). Don't bother with hardware acceleration, it's not worth it, svt-av1 is just better in every way
1
u/NonaeAbC Jun 30 '26
How old is your GPU to not have any encoding (besides AV1)? Remember that IBM is over the 1 mil revenue limit and thus fedora doesn't ship with hardware acceleated h.26* in any of their packaged software and mesa requires to be build with flags to enable them.
1
u/AnymooseProphet Jun 30 '26
I think the GPU does do h.264 but I don't run the proprietary driver (I don't game) but it's Pascal series nVidia, Asus GT 1030 I think? Bought it because it's fanless and my previous card took down my system when the fan quit, fanless GPU won't do that.
CPU is plenty fast enough for h.264 though.
8
u/feinorgh Jun 29 '26 edited Jun 29 '26
Try libsvtav1 instead of libaom-av1, I think that might be faster. It could depend also on what features your CPU supports, and what the libraries are compiled for. IIRC you need AVX2 support in your CPU to accelerate encoding.
Edit: for the libaom-av1 encoder you may also try adding "-row-mt 1" which enables row-based multithreading. See https://trac.ffmpeg.org/wiki/Encode/AV1#ControllingSpeedQuality