Trying to stream AV1 on AMD

cprn

New Member
Hi. I recently got Radeon RX 7900 XTX and I’m trying to test AV1 streaming. I’m on Manjaro and I'm using mesa drivers from nonfree.eu repository (amdgpu). Neither obs-studio nor obs-studio-rc show hardware video encoders. I installed obs-studio-amf and it does show hardware encoders but I have 2 issues:
  1. The only encoders in Settings > Output > Streaming are:
  • AMD HW H.264 (AVC)
  • FFmpeg VAAPI H.264
  • x264
There’s no AMD HW A1 or AMD HW H265.
  1. These hardware video encoders are available in Recording section but when I select AMD HW A1 and click Start Recording my whole PC freezes and the only thing I can do is hard reset. Before it freezes I can see a flicker of “gpu busy” (or something like that) on the system status bar (where it normally shows temperature, utilisation %, video RAM usage, etc).
Are those issues normal? Is there no support for AV1 for streaming in OBS for Linux yet and is AV1 recording in OBS for Linux unstable?

Description: Manjaro Linux 6.5.3-1-MANJARO
Release: 23.0.2
OBS Studio: 29.1.3-1 (64 bit)

I can use AMD HW H.264 (AVC) for streaming and AMD HW H.265 (HEVC) for recording without issues. I just wanted to use the A1, since my new GPU has it and it’s supposed to be way better.
 

cprn

New Member
Log from OBS freezing whole system in attachment (recording with AMD HW A1).
 

Attachments

  • 2023-09-23 18-46-00.txt
    12 KB · Views: 180

cprn

New Member
I figured out the 1st part (idk why I can't edit post, sorry) - I was trying to stream to Twitch which doesn't support newer hardware codecs. Streaming for YouTube with Hardware (AMD, HEVC) works fine.
 

cprn

New Member
I tried to ask on Manjaro forums but there seems to be consensus that we simply don't know yet how to verify if AV1 isn't supported or if my GPU is faulty because I am the 1st person trying to use AV1 on RX 7900 XTX there. The only thing I've managed to confirm is that the following hangs my system as well whereas using HEVC doesn't:

Bash:
ffmpeg -i input.mp4 -c:v av1_amf -quality speed output.mp4
 

cprn

New Member

Update - still not working​

With OBS version 30 the AMF patch stopped working and since new FFmpeg has an extended VAAPI implementation the author of the patch decided not to update it. Therefore the obs-studio-amf package became obsolete. After updating:

ffmpeg -> ffmpeg-obs 6.1.1-2
obs-studio-amf -> obs-studio 30.0.2-1

The AMF implementation of AV1 stopped wroking entirely (maybe I'm missing some library, IDK):
❯ ffmpeg -i input.mp4 -c:v av1_amf -quality speed output.mp4

[...]
Stream mapping:
Stream #0:0 -> #0:0 (hevc (native) -> av1 (av1_amf))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[swscaler @ 0x558c4f637f00] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x558c4f645c00] deprecated pixel format used, make sure you did set range correctly
Last message repeated 2 times
[av1_amf @ 0x558c4e85e340] DLL libamfrt64.so.1 failed to open
[vost#0:0/av1_amf @ 0x558c4e89bd80] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
Error while filtering: Unknown error occurred
[out#0/mp4 @ 0x558c4e8379c0] Nothing was written into output file, because at least one of its streams received no packets.
frame= 0 fps=0.0 q=0.0 Lsize= 0kB time=00:00:01.11 bitrate= 0.0kbits/s speed=6.37x
[aac @ 0x558c4f41b080] Qavg: 3890.119
Conversion failed

The VAAPI implementation of AV1 returns this:
❯ ffmpeg -i input.mp4 -c:v av1_vaapi output.mp4

[...]
Stream mapping:
Stream #0:0 -> #0:0 (hevc (native) -> av1 (av1_vaapi))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0'
[vf#0:0 @ 0x556c0101d000] Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while filtering: Function not implemented
[out#0/mp4 @ 0x556c010639c0] Nothing was written into output file, because at least one of its streams received no packets.
frame= 0 fps=0.0 q=0.0 Lsize= 0kB time=00:00:01.11 bitrate= 0.0kbits/s speed=9.42x
[aac @ 0x556c01c49840] Qavg: 3890.119
Conversion failed!

And, obviously, there's no FFmpeg VAAPI AV1 implementation in OBS available and the only two AV1 implementations that are available, i.e. SVT and QuickSync, return "timeout" and "starting the output failed" errors respectively.

Also, I'm a total noob at this so maybe I'm just doing something wrong.
 

longusnickus

New Member
try
ffmpeg -vaapi_device /dev/dri/renderD128 -i input.mp4 -vf 'format=nv12,hwupload' -c:v av1_vaapi -crf 24 -b:v
4000k output.mp4

and i think you already have seen the new OBS BETA changelog.
if you do not wanna wait install obs-studio-av1 from AUR. works for me. you should have: FFmpeg VAAPI AV1

are you aware, that manjaro, like some other distros dropped h264 and h265 support? hardware encoding and decoding do not work anymore for these 2 codex

hardware encoding for AV1 on youtube works and twitch has a beta running with AV1. you can apply here: https://dashboard.twitch.tv/broadcast
there should be a box for signing to early access
 

cprn

New Member
AV1 world out of the box now with `obs-studio-git` - there's no need for `obs-studio-av1` any more.

And no, I want aware about dropping support for those. Will look into it. Both work fine on my GPU for now.

Thanks for Twitch beta link.
 
Top