Fedora 3x

Add rpmfusion repo

dnf install http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm

Fedora 32

dnf --enablerepo rpmfusion-free --enablerepo rpmfusion-free --enablerepo rpmfusion-free-updates --refresh install mpv

Fedora 39

dnf --enablerepo rpmfusion-free --enablerepo rpmfusion-free --enablerepo rpmfusion-free-updates --refresh install mpv

dnf --enablerepo rpmfusion-free --enablerepo rpmfusion-free-updates install libheif-hevc

dnf --enablerepo rpmfusion-free --enablerepo rpmfusion-free-updates install libavcodec-freeworld

dnf install openh264

# for the case

dnf install gstreamer1-plugins-good-extras gstreamer1-plugin-libav

Fedora 40

As we know, mpv was added to the official repos. But it works slower, because of poor codecs. To fix it, we're going to install them from rpmfusion.

# clean
sudo dnf erase mpv
sudo dnf erase ffmpeg-free

# install rpmfusion https://rpmfusion.org/Configuration
sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
sudo dnf config-manager --enable fedora-cisco-openh264

Proceed according to this post

sudo dnf swap ffmpeg-free ffmpeg

# if it's complaining about conflicts, then remove them (yes, it'll be need to agree with removal of Chromium, Krita, ...)
sudo dnf erase libswscale-free
sudo dnf erase libswresample-free

sudo dnf swap libavcodec-free libavcodec-freeworld
# sudo dnf install gstreamer1-plugins-ugly # not necessary
sudo dnf install mpv --setopt=install_weak_deps=False

If the video hangs on 1st second, try to make the following config in ~/.config/mpv/mpv.conf

cache=yes
profile=high-quality
video-sync=display-resample
interpolation

Disablerpmfusion repository after installation. If you occasionally update your system with rpmfusion enabled it can lead to weird errors with packages during dnf install, update and so on (checksum mismatch, ...)

sudo dnf config-manager --set-disabled rpmfusion-free
sudo dnf config-manager --set-disabled rpmfusion-free-updates
sudo dnf config-manager --set-disabled rpmfusion-nonfree
sudo dnf config-manager --set-disabled rpmfusion-nonfree-updates

# check that no rpmfusion enabled
dnf repolist