paulpacifico / shutter-encoder

A professional video compression tool accessible to all, mostly based on FFmpeg.
https://www.shutterencoder.com
GNU General Public License v3.0
916 stars 58 forks source link

Shutter encoder dont detect VAAPI in AMD #150

Open Milor123 opened 1 year ago

Milor123 commented 1 year ago

Hi guys, I am trying of do encoding using my hardware acceleration in my AMD GPU, i am using PRO drivers only, but cant select VAAPI or AMF like in windows.

I am in Ubuntu Studio 22.04 LTS with kernel 6.2.0-26-generic

$ vainfo 
Trying display: wayland
Trying display: x11
libva info: VA-API version 1.19.0
libva info: User environment variable requested driver 'radeonsi'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_14
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.19 (libva 2.19.0)
vainfo: Driver version: Mesa Gallium driver 23.1.0-devel for AMD Radeon RX 6750 XT (navi22, LLVM 15.0.7, DRM 3.54, 6.2.0-26-generic)
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSlice
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileAV1Profile0            : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc

and my drivers are:

$ dpkg -l | grep amdgpu
    amdgpu
    amdgpu-core
    amdgpu-dkms
    amdgpu-dkms-firmware
    amdgpu-install
    amdgpu-lib
    amdgpu-pro
    amdgpu-pro-core
    amdgpu-pro-oglp:amd64
    amf-amdgpu-pro:amd64
    clinfo-amdgpu-pro
    gst-omx-amdgpu
    libamdenc-amdgpu-pro:amd64
    libdrm-amdgpu-amdgpu1:amd64
    libdrm-amdgpu-common
    libdrm-amdgpu-dev:amd64
    libdrm-amdgpu-radeon1:amd64
    libdrm-amdgpu1:amd64
    libdrm-amdgpu1:i386
    libdrm2-amdgpu:amd64
    libegl1-amdgpu-mesa:amd64
    libegl1-amdgpu-mesa-drivers:amd64
    libegl1-amdgpu-pro-oglp:amd64
    libgbm1-amdgpu:amd64
    libgl1-amdgpu-mesa-dri:amd64
    libgl1-amdgpu-mesa-glx:amd64
    libgl1-amdgpu-pro-oglp-dri:amd64
    libgl1-amdgpu-pro-oglp-ext:amd64
    libgl1-amdgpu-pro-oglp-gbm:amd64
    libgl1-amdgpu-pro-oglp-glx:amd64
    libglapi-amdgpu-mesa:amd64
    libgles1-amdgpu-pro-oglp:amd64
    libgles2-amdgpu-pro-oglp:amd64
    libllvm15.0.50503-amdgpu:amd64
    libxatracker2-amdgpu:amd64
    mesa-amdgpu-omx-drivers:amd64
    mesa-amdgpu-va-drivers:amd64
    mesa-amdgpu-vdpau-drivers:amd64
    ocl-icd-libopencl1-amdgpu-pro:amd64
    opencl-legacy-amdgpu-pro-icd:amd64
    vulkan-amdgpu-pro:amd64
    xserver-xorg-amdgpu-video-amdgpu
    xserver-xorg-video-amdgpu

installed after a clean install, using this command sudo amdgpu-install -y --usecase=opencl,workstation,amf,rocm,graphics,hip,hiplibsdk --vulkan=pro --opencl=rocr,legacy --accept-eula -y --no-32

image

I try many things, compile the FFMPEG with amf and other things, user other builds of other repos, but nothing work for ShutterEncoder, because when i try test it using this command

ffmpeg -vaapi_device /dev/dri/renderD128 -i 01.mov -vf 'format=nv12,hwupload' -c:v hevc_vaapi -b:v 5M output2.mp4

all works nice doing manually

Shutter Encoder Original input without HW:

image

ffmpeg -hwaccel auto -i "/Davinci/Renders/01.mov" -vf 'format=nv12,hwupload' -c:v hevc_vaapi -b:v 1067k -profile:v main -level 5.2 -map v:0 -c:a aac -ar 48k -b:a 256k -map a:0 -pix_fmt yuv420p -sws_flags bicubic -tag:v hvc1 -metadata creation_time="2023-08-24T18:37:39.803708547Z" -y "/Davinci/Renders/01_H.265.mp4"

HW EXAMPLE REFERENCE:

ffmpeg -vaapi_device /dev/dri/renderD128 -i 01.mov -vf 'format=nv12,hwupload' -c:v hevc_vaapi -b:v output2.mp4

Converting command into a one with HW (it works for me) ffmpeg -vaapi_device /dev/dri/renderD128 -i "/Davinci/Renders/01.mov" -vf 'format=nv12,hwupload' -c:v hevc_vaapi -b:v 1067k -profile:v main -level 5.2 -map v:0 -c:a aac -ar 48k -b:a 256k -map a:0 -pix_fmt yuv420p -sws_flags bicubic -tag:v hvc1 -metadata creation_time="2023-08-24T18:37:39.803708547Z" -y "/Davinci/Renders/01_H.265.mp4"

PD: I have linked the shutterencoder bin FFMPEG to my /usr/bin (using ln -s )

EDIT2: really it works only add the next line -vf 'format=nv12,hwupload' -c:v hevc_vaapi

what should i do guys, i want do it manully T_T please help, i love shutter encoder :3

Milor123 commented 1 year ago

@paulpacifico the bug persists in the new version 17.4, I've again linked the /usr/lib/Shutter Encoder/usr/bin/Library/ffmpeg my unlocked AMF and Vaapi FFmpeg version

using sudo ln, it only unlock vaapi for decode but in hardware aceleration i cant use nothing, no Vaapi no AMF, only NVENC (but i am AMD USER not NVIDIA)

Could please you add a option for select it manually in case of dont be undetected? :/

helissonms commented 4 months ago

Any update about that?

Milor123 commented 4 months ago

Any update about that?

Nope, I've bought a NVIDIA card and in linux I have problem with shutter encoder too.

I think that @paulpacifico should unlock the decoders and accel types in linux

@helissonms try link the ffmpeg of shutter encoders with your custom build of ffmpeg in linux (it solve my problems in linux with NVIDIA, but AMD is other case because need that @paulpacifico add it to encoders and hardware acel list)

check firts where is installed your shutterencoder in linux, ls /opt/shutter-encoder/usr/bin/Library/

sudo rm -r /opt/shutter-encoder/usr/bin/Library/ffmpeg
sudo rm -r /opt/shutter-encoder/usr/bin/Library/ffprobe
sudo rm -r /opt/shutter-encoder/usr/bin/Library/ffplay

sudo ln -s $(which ffmpeg) /opt/shutter-encoder/usr/bin/Library/ffmpeg
sudo ln -s $(which ffprobe) /opt/shutter-encoder/usr/bin/Library/ffprobe
sudo ln -s $(which ffmpeg) /opt/shutter-encoder/usr/bin/Library/ffplay
helissonms commented 4 months ago

Unfortunately I'm also using an AMD graphics