mpv hardware acceleration gpu fix

NapoleonWils0n

Well-Known Member

Reaction score: 150
Messages: 275

Hi All

Heres a fix for mpv hardware acceleration

mpv now requires vo=gpu in mpv.conf
and you also need to set up XDG_RUNTIME_DIR

create ~/.config/mpv/mpv.conf

Bash:
vi ~/.config/mpv/mpv.conf

And add the following code

Bash:
msg-level=ffmpeg=fatal
vo=gpu
hwdec=vaapi

then edit your ~/.bashrc if you are using bash

Code:
vi ~/.bashrc

or edit your ~/.zhsrc if you are using the zsh shell

Code:
vi ~/.zshrc

Add the following code to your shell config file

Bash:
# XDG_RUNTIME_DIR for mpv hardware acceleration
if [ -z "$XDG_RUNTIME_DIR" ]; then
    export XDG_RUNTIME_DIR=/tmp
    if [ ! -d  "$XDG_RUNTIME_DIR" ]; then
        mkdir "$XDG_RUNTIME_DIR"
        chmod 0700 "$XDG_RUNTIME_DIR"
    fi
fi

then source your ~/.bashrc if you are using bash

Bash:
source ~/.bashrc

or source your ~/.zshrc if you are using the zsh shell

Bash:
source ~/.zshrc

jpb done
 

xtouqh

Member

Reaction score: 27
Messages: 48

Add the following code to your shell config file

Code:
# XDG_RUNTIME_DIR for mpv hardware acceleration
if [ -z "$XDG_RUNTIME_DIR" ]; then
export XDG_RUNTIME_DIR=/tmp
if [ ! -d "$XDG_RUNTIME_DIR" ]; then
mkdir "$XDG_RUNTIME_DIR"
chmod 0700 "$XDG_RUNTIME_DIR"
fi
fi
Should not the second if be non-nested here, otherwise it only runs when XDG_RUNTIME_DIR was empty and set to /tmp, which should already exist?
 
Top