Install video codecs for Firefox etc. in Rocky Linux 9.x

By default many videos don’t work on in the Firefox browser, e.g. Youtube live videos, videos in Twitter or various online newspapers. Some examples:

https://www.youtube.com/watch?v=jfKfPfyJRdk

https://twitter.com/niporwifi/status/1660752131085815811

The workaround is to install and use the Chrome browser which apparently includes the needed codecs within the browser itself, but if you want to make them work (also) in Firefox, the following worked for me.

sudo dnf install epel-release
sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-9.noarch.rpm
sudo dnf install --nogpgcheck https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-9.noarch.rpm
sudo dnf config-manager --enable crb
sudo dnf groupupdate core
sudo dnf groupupdate multimedia --setop="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin
sudo dnf groupupdate sound-and-video

These instructions are specifically for Rocky Linux 9.x (I tried it on 9.3). I updated them from these instructions, which are apparently for Rocky Linux 8:

I changed those instructions by replacing “8” with “9” in the rpmfusion links, and replacing “powertools” with “crb”. If I am missing something in these instructions, let me know, but at least e.g. those web pages above now work for me in Firefox.