Atomic Desktops: Fix video playback and thumbnails, also in Firefox

You may encounter that your preinstalled Firefox can’t play videos or certain video thumbnails are missing in your file manager.

This is due to missing nonfree codecs, that the Fedora Project would need to pay an enormous amount of money for, thus they can’t possibly preinstall it.

There is rpmfusion though, which is not situated in the US and thereby can easily ship these packages without consequences. Also, some Flatpak apps or runtimes ship ffmpeg, which includes the wanted video codecs.

Here are some ways to fix this problem. I will focus on Fedora Atomic versions, see here for the fix on traditional Fedora

(Fedora Flatpak Firefox has no fix currently and would need a flatpak extension from a repo like rpmfusion, see this issue for details)

Three options

With “systed sysextensions” there will be a fourth way to install these packages without layering. It is not yet well tested and didnt work in my experiments.


A: With layering

This will add a changeset to your system. On every update, these changes will be applied new, so they are always fresh and dont pile up old issues. It slows down the update process though, and consumes more resources.

Using rpmfusion packages may also cause temporary update issues, if the packages are not synchronized with Fedora’s. These issues will fix themselves after a few days.

1. Add rpmfusion repo

The repos are managed through an RPM which you need to layer and reboot.

# free and nonfree
rpm-ostree install --reboot 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

2. Install the codecs

A: Minimal: Just freeworld video codecs

This will make video playback and video thumbnails work, and is likely enough.

rpm-ostree install --reboot libavcodec-freeworld

B: Complete: ffmpeg + ffmpegthumbnailer

If you want to use ffmpeg from the terminal and have all features, you need to remove all those packages to fix the dependency problems.

rpm-ostree override remove libavcodec-free libavfilter-free libavformat-free libavutil-free libpostproc-free libswresample-free libswscale-free libavdevice-free --install ffmpeg --install ffmpegthumbnailer

B: Without layering

There are options to use it without layering. This will keep your updates fast and prevent (temporary) update issues.

Flatpaks with ffmpeg included

Many Flatpak applications include ffmpeg internally, so you can use that.

NOTE
This will not make video thumbnails in the filemanager (ffmpegthumbnailer) or video playback in Firefox work, but give you access to the full ffmpeg binary to do video, audio or image editing.

WARNING

You will need to give these apps access to all directories you use with ffmpeg, as Portals don’t work in the terminal. This means an app may get more filesystem access than it would need on it’s own.

Applications with home access can override their own privileges and gain root access. So make sure to trust them.

To display all apps with their App IDs:

flatpak list --app --culumns=application

Use the KDE Settings for that, or Flatseal. You can also use the terminal:

flatpak override --filesystem=home org.app.name

recommended

These apps are well known and trusted. You can restrict internet permission in the settings.

not recommended

These apps connect to the internet or have other issues. You may not want to remove their sandbox.

  • KRDC (Remote Desktop Client)
  • OBS Studio (Video recording and broadcasting)
  • NewsFlash (RSS Feed Reader)
  • FreeTube (Youtube Application)
  • VLC (Note that the package is unofficial and doesn’t have Wayland support.)

To use these in bash, enter:

cat >> ~/.bashrc <<EOF
ffmpeg() {
  flatpak run --command=ffmpeg org.app.NAME "$@"
}
EOF

Distrobox

You can create a container and install ffmpeg there. All apps in a Distrobox/Toolbox have full home access.

distrobox-create Fedora -i registry.fedoraproject.org/fedora-toolbox:$(rpm -E %fedora)

distrobox-enter Fedora
sudo dnf install -y 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 install -y ffmpeg

exit

Outside the box:

cat > ~/.local/bin/ffmpeg <<EOF
#!/usr/bin/sh
distrobox-enter Fedora -- ffmpeg
EOF

chmod +x ~/.local/bin/ffmpeg

This will create a script in your $PATH directory.

Alternatively you can use an alias in your shell, example for bash, zsh or fish:

cat >> ~/.bashrc <<EOF
alias ffmpeg="distrobox-enter Fedora -- ffmpeg"
EOF

C: Easy, complete, unofficial: use uBlue images

This is an easy method, requires no additional maintenance and will keep the rpm-ostree updates just as fast. But it means you need to place trust in a second entity, and you will get your OS updates from Github’s container registry and not Fedora servers anymore.

uBlue takes the Fedora Atomic images and adds all the needed media codecs to it. They do the same for NVIDIA and other hardware enablement tasks.

They don’t advertise their base images anymore, but you find their image list here and the “template command” below.

First, rebase to the unverified image. This is a temporary step.

rpm-ostree rebase --reboot ostree-unverified-registry:ghcr.io/ublue-os/IMAGENAME:latest

After the reboot, rebase to the signed image.

rpm-ostree rebase ostree-image-signed:docker://ghcr.io/ublue-os/IMAGENAME:latest

Use the -main images if you don’t need NVIDIA or other drivers or custom kernels.
Example: kinoite-main.

Use the -nvidia images if you rely on proprietary NVIDIA drivers (which will get more complicated when NVIDIA supports modern cards with opensource but still external drivers).
Example silverblue-nvidia.

Use the :latest version to get automatic version upgrades. You never need to touch the Terminal again :wink: … probably.

WARNING

the *-nokmods images are no longer supported and dont receive any updates anymore! Rebase to *-main.

Note

The first rebase may become redundant when Fedora switches to signed OSTree native containers

5 Likes

its a while ago that I did this. If there is a mistake, please correct me.

Or just install the flatpak from flathub which includes everything

1 Like

Thanks for collecting these fixes in one place as they will be needed for some time to come.

I’ve got to see about getting involved in these as they promise to be a much better solution. Both were started by the wonderful cgwalters
bootc
sagano

I remeber reading a thread within the last few years where a question was raised about using container rather than ‘git for fs tree’ and Colin seemed to really have the light bulb go off in his responses. Wish I could find that thread again…

I selfishly mention them on your discussion with the hope that others will want the benefit and become part of the way forward as well.

  • No drag&drop
  • slower (did a huge test yesterday, will post here)
  • no native messaging (KeepassXC-browser, KDE connect, KDE Plasma integration, Zotero, UMD, …)
1 Like

Edit: fixed the override command. ffmpeg conflicts with a hell lot of packages.

With workstation that is not an issue since installing ffmpeg can be done with dnf and using the
--allowerasing option to remove the conflicts. I understand that you are on an immutable system, but that should also be possible with using rpm-ostree. The command is structured differently but still can be done. If I understand your comment it seems you may have been able to do that already.

1 Like

It’s still not quite right. The Fedora ffmpeg packages are libavcodec-free libavfilter-free libavformat-free libavutil-free libpostproc-free libswresample-free libswscale-free

libavif is not part of ffmpeg, and ffmpegthumbnailer is not a Fedora package. Kinoite alone has ffmpegthumbs in the base image, which is apparently KDE-specific and doesn’t appear to conflict with ffmpegthumbnailer from RPM Fusion.

1 Like

Thanks, so on my Fedora Container its easier then

I am pretty sure libavif was a dependency problem

From Ask Fedora to Proposed Common Issues

Added atomic-desktops, ffmpeg, h264 and removed flatpak, gnome, kde

updated the guides, more structure, many possible Flatpaks to get the ffmpeg binary / library.

Now integrating that into some form that ffmpegthumbnailer and firefox can use… that would be interesting

Well, but this is not a big, isn’t it? So I think that this is not the right category. Wdyt @kparal

No, it’s not a bug/failure of the Fedora distribution, it’s just an unfortunate state of the world :slight_smile: Thanks a lot, @boredsquirrel , for writing this up. I’ll move this back to the Ask Fedora category, but we have a helpful tag howto for guides like these, I’ll add it.

I feel like we could promote such guides more (because most people will probably not figure out to look for the howto tag), so I started a topic about it here:

3 Likes

From Proposed Common Issues to Ask Fedora

Added howto

From Ask Fedora to Proposed Common Issues

Removed howto

Oops Discourse bug

1 Like