# mpv hardware acceleration gpu fix



## NapoleonWils0n (Jan 11, 2020)

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


```
vi ~/.config/mpv/mpv.conf
```

And add the following code


```
msg-level=ffmpeg=fatal
vo=gpu
hwdec=vaapi
```

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


```
vi ~/.bashrc
```

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


```
vi ~/.zshrc
```

Add the following code to your shell config file


```
# 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


```
source ~/.bashrc
```

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


```
source ~/.zshrc
```

jpb done


----------



## xtouqh (Oct 30, 2020)

NapoleonWils0n said:


> Add the following code to your shell config file
> 
> Code:
> # XDG_RUNTIME_DIR for mpv hardware acceleration
> ...


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?


----------

