Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
OBS studio AMD hardware encoder through amf
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
Ja.KooLit
Tux's lil' helper
Tux's lil' helper


Joined: 14 Feb 2022
Posts: 99
Location: Somewhere Over There!

PostPosted: Fri Feb 03, 2023 2:54 am    Post subject: OBS studio AMD hardware encoder through amf Reply with quote

Hey guys,
It seems that I could'nt get to work HVEC or amf hardware encoding to work properly.

As per wiki, amf use flag only through ffmpeg.

On Arch, I have installed obs-studio-amf through AUR and I can choose AMD hvec and it is recording really well.

On gentoo though, there is no option for amd hardware encoder. Am I missing something?

TIA
_________________
Oh Yeah!!!
Back to top
View user's profile Send private message
CooSee
Veteran
Veteran


Joined: 20 Nov 2004
Posts: 1438
Location: Earth

PostPosted: Fri Feb 03, 2023 11:36 pm    Post subject: Reply with quote

amf only works with amdgpu-pro :!: - IIRC

from obs-studio-amf https://aur.archlinux.org/packages/obs-studio-amf
Code:
Dependencies (32)
    amf-amdgpu-pro

and from media-video/ffmpeg ebuild
Code:
RDEPEND="
amf? ( media-video/amdgpu-pro-amf )

8)
_________________
" Die Realität ist eine Illusion, die durch Mangel an ehrlicher Kommunikation entsteht "
---
" Der Mensch ist von Natur aus neugierig, was am Ende übrig bleibt ist die Gier "
Back to top
View user's profile Send private message
Ja.KooLit
Tux's lil' helper
Tux's lil' helper


Joined: 14 Feb 2022
Posts: 99
Location: Somewhere Over There!

PostPosted: Sat Feb 04, 2023 1:49 am    Post subject: Reply with quote

CooSee wrote:
amf only works with amdgpu-pro :!: - IIRC

from obs-studio-amf https://aur.archlinux.org/packages/obs-studio-amf
Code:
Dependencies (32)
    amf-amdgpu-pro

and from media-video/ffmpeg ebuild
Code:
RDEPEND="
amf? ( media-video/amdgpu-pro-amf )

8)


after enabling amf on ffmpeg, it is naturally pulling the amd-gpu-pro drivers.

on wiki AMDGPU-PRO page, drivers available are
Code:

https://wiki.gentoo.org/wiki/AMDGPU-PRO
    media-video/amdgpu-pro-amf
    dev-libs/amdgpu-pro-opencl
    media-libs/amdgpu-pro-vulkan


in which I have both except the opencl

Code:
[ebuild   R    ] media-libs/amdgpu-pro-vulkan-22.20.3.1462318::gentoo  ABI_X86="(64) -32" VIDEO_CARDS="amdgpu" 0 KiB
[ebuild   R    ] media-video/amdgpu-pro-amf-1.4.26.1462318::gentoo  0 KiB

Total: 2 packages (2 reinstalls), Size of downloads: 0 KiB



I have launched as well obs using
Code:

VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/amd_pro_icd64.json /usr/bin/obs


here is my ffmpeg enable use flags

Code:
Installed versions:  4.4.3(0/56.58.58)^t(00:54:51 03/02/23)(X alsa amf bzip2 dav1d encode gnutls gpl iconv jack libv4l mp3 network opengl postproc pulseaudio sdl svg threads truetype v4l vaapi verify-sig vorbis vpx vulkan x264 x265 xvid zlib -amr -amrenc -appkit -bluray -bs2b -cdio -chromaprint -chromium -codec2 -cpudetection -cuda -debug -doc -fdk -flite -fontconfig -frei0r -fribidi -gcrypt -gme -gmp -gsm -hardcoded-tables -iec61883 -ieee1394 -jpeg2k -kvazaar -ladspa -libaom -libaribb24 -libass -libcaca -libdrm -libilbc -librtmp -libsoxr -libtesseract -libxml2 -lv2 -lzma -mipsdspr1 -mipsdspr2 -mipsfpu -mmal -modplug -nvenc -openal -opencl -openh264 -openssl -opus -oss -pic -rav1e -rubberband -samba -snappy -sndio -speex -srt -ssh -static-libs -svt-av1 -test -theora -twolame -vdpau -vidstab -vmaf -webp -zeromq -zimg -zvbi ABI_MIPS="-n32 -n64 -o32" ABI_S390="-32 -64" ABI_X86="32 64 -x32" CPU_FLAGS_ARM="-neon -thumb -thumb2 -v6 -v8 -vfp -vfpv3" CPU_FLAGS_PPC="-altivec -vsx -vsx2" CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext sse sse2 sse3 sse4_1 sse4_2 ssse3 -3dnow -3dnowext -fma4 -xop" FFTOOLS="aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart sidxindex trasher")



my obs

Code:
eix obs-studio                                                                                                                                     ─╯
[?] media-video/obs-studio
     Available versions:  (~)27.2.3-r1 (~)27.2.4 **9999*l {+alsa browser decklink fdk jack lua nvenc pipewire pulseaudio python speex +ssl truetype v4l vlc wayland LUA_SINGLE_TARGET="+luajit" PYTHON_SINGLE_TARGET="python3_8 python3_9 python3_10"}
     Installed versions:  29.0.0-r1(10:52:31 03/02/23)(alsa decklink jack lua pipewire pulseaudio python speex ssl truetype v4l vlc wayland -browser -fdk -nvenc -qt6 -websocket LUA_SINGLE_TARGET="luajit" PYTHON_SINGLE_TARGET="python3_10 -python3_9 -python3_11")
     Homepage:            https://obsproject.com
     Description:         Software for Recording and Streaming Live Video Content

_________________
Oh Yeah!!!


Last edited by Ja.KooLit on Sat Feb 04, 2023 1:53 am; edited 1 time in total
Back to top
View user's profile Send private message
shadowless
Tux's lil' helper
Tux's lil' helper


Joined: 27 Nov 2022
Posts: 101

PostPosted: Sat Feb 04, 2023 1:52 am    Post subject: Reply with quote

Hmmmm (nevermind)... Thought I had encoded a video using the AMF encoder with ffmpeg on my system when I had Arch Linux installed... but I can't go back to verify if it had pulled in the propietary drivers or not.
Back to top
View user's profile Send private message
Ja.KooLit
Tux's lil' helper
Tux's lil' helper


Joined: 14 Feb 2022
Posts: 99
Location: Somewhere Over There!

PostPosted: Sat Feb 04, 2023 2:00 am    Post subject: Reply with quote

https://imgur.com/a/kJzctf2

my obs arch encoder options
_________________
Oh Yeah!!!


Last edited by Ja.KooLit on Sat Feb 04, 2023 2:14 am; edited 1 time in total
Back to top
View user's profile Send private message
Ja.KooLit
Tux's lil' helper
Tux's lil' helper


Joined: 14 Feb 2022
Posts: 99
Location: Somewhere Over There!

PostPosted: Sat Feb 04, 2023 2:13 am    Post subject: Reply with quote

shadowless wrote:
Hmmmm (nevermind)... Thought I had encoded a video using the AMF encoder with ffmpeg on my system when I had Arch Linux installed... but I can't go back to verify if it had pulled in the propietary drivers or not.


I believe there were some work arounds before obs officially support amf... now that obs officially support, it should be able to use x264 or x265(hvec) hardware encoder...
_________________
Oh Yeah!!!
Back to top
View user's profile Send private message
shadowless
Tux's lil' helper
Tux's lil' helper


Joined: 27 Nov 2022
Posts: 101

PostPosted: Sat Feb 04, 2023 6:47 am    Post subject: Reply with quote

On closer look...

AMF is not enabled for Linux in the OBS source.

The obs-studio-amf package in arch linux's aur contains a patch '7206.patch' to add it in. You can clone the git repo for the aur package to grab the patch.
Back to top
View user's profile Send private message
Ja.KooLit
Tux's lil' helper
Tux's lil' helper


Joined: 14 Feb 2022
Posts: 99
Location: Somewhere Over There!

PostPosted: Sat Feb 04, 2023 11:24 am    Post subject: Reply with quote

shadowless wrote:
On closer look...

AMF is not enabled for Linux in the OBS source.

The obs-studio-amf package in arch linux's aur contains a patch '7206.patch' to add it in. You can clone the git repo for the aur package to grab the patch.


Wow thanks for looking.

after getting the patch, how can I apply it? Is there a wiki or guide that I can look into?

TIA

edit:

Nevermind found how to apply patches

unfortunately

Code:
 Applying user patches from /etc/portage/patches ...
 * Applying 7206.patch ...
patching file plugins/obs-ffmpeg/CMakeLists.txt
Hunk #1 FAILED at 119.
1 out of 1 hunk FAILED -- saving rejects to file plugins/obs-ffmpeg/CMakeLists.txt.rej
patching file plugins/obs-ffmpeg/obs-amf-test/CMakeLists.txt
patching file plugins/obs-ffmpeg/obs-amf-test/obs-amf-test-linux.cpp
patching file plugins/obs-ffmpeg/obs-ffmpeg.c
patching file plugins/obs-ffmpeg/texture-amf-opts.hpp
patching file plugins/obs-ffmpeg/texture-amf.cpp
 [ !! ]
 * ERROR: media-video/obs-studio-29.0.0-r1::gentoo failed (prepare phase):
 *   patch -p1  failed with /etc/portage/patches/media-video/obs-studio/7206.patch
 *
 * Call stack:
 *               ebuild.sh, line  136:  Called src_prepare
 *             environment, line 3526:  Called cmake_src_prepare
 *             environment, line 1722:  Called default_src_prepare
 *      phase-functions.sh, line  948:  Called __eapi8_src_prepare
 *             environment, line  363:  Called eapply_user
 *             environment, line 1918:  Called eapply '/etc/portage/patches/media-video/obs-studio/7206.patch'
 *             environment, line 1878:  Called _eapply_patch '/etc/portage/patches/media-video/obs-studio/7206.patch'
 *             environment, line 1816:  Called __helpers_die 'patch -p1  failed with /etc/portage/patches/media-video/obs-studio/7206.patch'
 *   isolated-functions.sh, line  112:  Called die
 * The specific snippet of code:
 *              die "$@"

_________________
Oh Yeah!!!
Back to top
View user's profile Send private message
shadowless
Tux's lil' helper
Tux's lil' helper


Joined: 27 Nov 2022
Posts: 101

PostPosted: Sat Feb 04, 2023 8:56 pm    Post subject: Reply with quote

Did you clean up the patch before applying it?

See: https://wiki.gentoo.org/wiki/Creating_a_patch#Adjusting_a_malformed_patch_from_TortoiseGit_or_Git_for_Windows
Back to top
View user's profile Send private message
Ja.KooLit
Tux's lil' helper
Tux's lil' helper


Joined: 14 Feb 2022
Posts: 99
Location: Somewhere Over There!

PostPosted: Sun Feb 05, 2023 6:11 am    Post subject: Reply with quote

shadowless wrote:
Did you clean up the patch before applying it?

See: https://wiki.gentoo.org/wiki/Creating_a_patch#Adjusting_a_malformed_patch_from_TortoiseGit_or_Git_for_Windows


Honestly no... do I have to?

Anyway, I saw that there is a new update today. Perhaps one of the devs can just add another use flags to obs-studio like like amf for example....

Ive got to be honest, this patches is too much for me lmao.... I hope that some Gentoo amd - obs user can figure it out how to enable the amf functionality
_________________
Oh Yeah!!!
Back to top
View user's profile Send private message
shadowless
Tux's lil' helper
Tux's lil' helper


Joined: 27 Nov 2022
Posts: 101

PostPosted: Sun Feb 05, 2023 10:40 am    Post subject: Reply with quote

I doubt we'll see a USE flag for AMF until the feature is supported upstream.

I had yet to patch an ebuild... so I decided to give a try. I found this video to be helpful in understanding patch: https://www.youtube.com/watch?v=yIU92YySlW0

I created a local repo and copied the ebuild for media-video/obs-studio-29.0.0-r1

I cleaned up the patch, added it to the ebuild, and installed the patched package. It seems to work. I can use the AMD hardware encoder for h264 in OBS. I don't see the hevc encoder here, however I can't use the hevc_amf encoder in ffmpeg either. I believe my GPU might be a little too old for hardware hevc encoding (RX 580). The patch also enables building of an obs-amf-test binary from the OBS source. That test tells me that I don't have AMF hevc support as well.

Here's a pastebin for the patch if you're interested: https://pastebin.com/aPDNZWJK
Back to top
View user's profile Send private message
Chiitoo
Administrator
Administrator


Joined: 28 Feb 2010
Posts: 2571
Location: Here and Away Again

PostPosted: Sun Feb 05, 2023 12:05 pm    Post subject: Reply with quote

shadowless wrote:
I doubt we'll see a USE flag for AMF until the feature is supported upstream.

Indeed, very likely when/if the upstream pull request 7206 [1] gets in.

1. https://github.com/obsproject/obs-studio/pull/7206
_________________
Kindest of regardses.
Back to top
View user's profile Send private message
Ja.KooLit
Tux's lil' helper
Tux's lil' helper


Joined: 14 Feb 2022
Posts: 99
Location: Somewhere Over There!

PostPosted: Sun Feb 05, 2023 1:59 pm    Post subject: Reply with quote

shadowless wrote:
I doubt we'll see a USE flag for AMF until the feature is supported upstream.

I had yet to patch an ebuild... so I decided to give a try. I found this video to be helpful in understanding patch: https://www.youtube.com/watch?v=yIU92YySlW0

I created a local repo and copied the ebuild for media-video/obs-studio-29.0.0-r1

I cleaned up the patch, added it to the ebuild, and installed the patched package. It seems to work. I can use the AMD hardware encoder for h264 in OBS. I don't see the hevc encoder here, however I can't use the hevc_amf encoder in ffmpeg either. I believe my GPU might be a little too old for hardware hevc encoding (RX 580). The patch also enables building of an obs-amf-test binary from the OBS source. That test tells me that I don't have AMF hevc support as well.

Here's a pastebin for the patch if you're interested: https://pastebin.com/aPDNZWJK


Thanks alot for sharing. Gonna be busy trying to figure out but its great you gave me some idea and what to look at

Never done patching nor creating and local ebuild before so gonna took some time for me :)
_________________
Oh Yeah!!!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum