Firefox: Cant open .mp4 - Couldn't open avcodec

Hello everyone,

I reinstalled Fedora Silverblue yesterday and can’t play .mp4 in Firefox because of the following error:

NS_ERROR_DOM_MEDIA_FATAL_ERR (0x806e0005)
Details: mozilla::MediaResult mozilla::FFmpegDataDecoder<60>::InitDecoder(AVDictionary**): Couldn't open avcodec

Do I have to install anything else for this?

Hello, @tealk Official Site

The error you’re encountering, NS_ERROR_DOM_MEDIA_FATAL_ERR (0x806e0005), suggests that there’s an issue with the FFmpeg codec needed to play .mp4 files in Firefox on Fedora Silverblue. To resolve this, you may need to install additional codecs that are not included by default due to licensing restrictions.

Here’s what you can do:

Install the necessary codecs:
You might need to install the ffmpeg package, which includes the avcodec library that Firefox requires to play .mp4 files.
Since Fedora Silverblue uses rpm-ostree, you would typically install packages like this:
rpm-ostree install ffmpeg

After running the command, you’ll need to reboot your system for the changes to take effect.
Enable RPM Fusion repositories:
If ffmpeg is not available in the default repositories, you may need to enable the RPM Fusion repositories, which provide additional packages that are not shipped by Fedora for various reasons.
Check for browser compatibility:
Ensure that your version of Firefox is compatible with the codecs. Sometimes, a browser update or a fresh installation might be required.

I hope my suggestion is helpful for you.

Best Regard,
patrick521

Unfortunately the package does not exist, the following can be found for the term ffmpeg

rpm-ostree install ffmpeg
error: Packages not found: ffmpeg
rpm-ostree search ffmpeg

===== Summary & Name Matched =====
ffmpegthumbs : KDE ffmpegthumbnailer service
ffmpeg-free-devel : Development package for ffmpeg
python3-ffmpeg-python : Python bindings for FFmpeg - with complex filtering support
vlc-plugin-ffmpeg : VLC media player FFmpeg plugins

===== Name Matched =====
ffmpegthumbs : KDE ffmpegthumbnailer service
ffmpeg-free : A complete solution to record, convert and stream audio and video
ffmpeg-free-devel : Development package for ffmpeg
python3-ffmpeg-python : Python bindings for FFmpeg - with complex filtering support
vlc-plugin-ffmpeg : VLC media player FFmpeg plugins

===== Summary Matched =====
ffmpegthumbs : KDE ffmpegthumbnailer service
gstreamer1-plugin-libav : GStreamer FFmpeg/LibAV plugin
indi-3rdparty-webcam : INDI driver for ffmpeg based webcams
audacious-plugins-ffaudio : FFmpeg input plugin for Audacious
ffmpeg-free-devel : Development package for ffmpeg
kmplayer : A simple front-end for MPlayer/FFMpeg/Phonon
libavcodec-free : FFmpeg codec library
libavcodec-free-devel : Development files for FFmpeg's codec library
libavdevice-free : FFmpeg device library
libavdevice-free-devel : Development files for FFmpeg's device library
libavfilter-free : FFmpeg audio and video filtering library
libavfilter-free-devel : Development files for FFmpeg's audio/video filter library
libavformat-free : FFmpeg's stream format library
libavformat-free-devel : Development files for FFmpeg's stream format library
libavutil-free : FFmpeg's utility library
libavutil-free-devel : Development files for FFmpeg's utility library
libpostproc-free : FFmpeg post-processing library
libpostproc-free-devel : Development files for the FFmpeg post-processing library
libswresample-free : FFmpeg software resampling library
libswresample-free-devel : Development files for the FFmpeg software resampling library
libswscale-free : FFmpeg image scaling and colorspace/pixel conversion library
libswscale-free-devel : Development files for FFmpeg's image scaling and colorspace library
nv-codec-headers : FFmpeg version of Nvidia Codec SDK headers
python3-ffmpeg-python : Python bindings for FFmpeg - with complex filtering support
vlc-plugin-ffmpeg : VLC media player FFmpeg plugins

You need to enable the RPM Fusion repos before you can install ffmpeg and related codecs.

See Howto/OSTree - RPM Fusion

After adding the repo i get a conflict if i try to install it.

error: Could not depsolve transaction; 1 problem detected:
 Problem: package ffmpeg-libs-6.1.1-8.fc40.x86_64 from rpmfusion-free conflicts with libavcodec-free provided by libavcodec-free-6.1.1-8.fc40.x86_64 from @System
  - package ffmpeg-6.1.1-8.fc40.x86_64 from rpmfusion-free requires ffmpeg-libs(x86-64) = 6.1.1-8.fc40, but none of the providers can be installed
  - conflicting requests

It wouldn’t be my choice, but you can always try installing Firefox as a Flatpak. It’s provided by Mozilla. Media playback works out of the box.

For media outside of your browser, installing the Celluloid flatpak is a great option. It also comes directly from the developer with support for lots of codecs, including the patent-encumbered ones found in .mp4.

I really wanted to avoid installing RPM Fusion in Silverblue, though, because you need to do the uninstall-install dance whenever upgrading to a new Silverblue release.

I’m doing something similar right now, only with LibreWolf

Found an existing thread with this problem and I verified the workaround works with Fedora 40 Silverblue:

1 Like

So when I try to open a video with the tool, I only get this message:
image

Hmm… that’s odd. I’ve been able to play H.264 and H.265 videos with Celluloid, and all I did was install it in an hour ago.

I don’t have the RPM Fusion packages layered, but that’s about the only difference between your system and mine, I think…

Can you right-click the video, click properties, and then click Audio and Video Properties?

Oh, and do you get any output when running flatpak run io.github.celluloid_player.Celluloid video.mp4?

I have not yet installed “ffmpeg” at all

Here are the details of the video

and here is the output of the app

flatpak run io.github.celluloid_player.Celluloid '/var/home/tealk/Nextcloud/Videos/VID-20180220-WA0010.mp4' 
Cannot load libcuda.so.1

(io.github.celluloid_player.Celluloid:2): Gdk-CRITICAL **: 16:24:06.762: gdk_monitor_get_geometry: assertion 'GDK_IS_MONITOR (monitor)' failed

You have the extra Gdk-CRITICAL error that I don’t. It seems like it’s failing to find your monitor? Which has nothing to do with codecs or RPM Fusion; it’s a far more fundamental failure.

Sorry, I have no idea what the issue might be…the best I can suggest is that you open an issue here: Issues · flathub/io.github.celluloid_player.Celluloid · GitHub

1 Like

For future reference, Tealk installed the Fedora flatpak for Celluloid, which was why it wasn’t working. The Fedora Flatpak lacks decoding support for H.264/H.265. When Tealk installed the Flathub version, it worked perfectly.

1 Like