Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FirefoxNightly] H264/MP4 playback not supported #22

Closed
yekyau opened this issue May 10, 2017 · 14 comments
Closed

[FirefoxNightly] H264/MP4 playback not supported #22

yekyau opened this issue May 10, 2017 · 14 comments

Comments

@yekyau
Copy link

yekyau commented May 10, 2017

Visiting the YouTube html5 test page displays a red mark next to H.264 and H.264/MSE, and trying to play embedded MP4s fails with the browser console error

HTTP “Content-Type” of “video/mp4” is not supported. Load of media resource https://video.twimg.com/tweet_video/video.mp4 failed.
The video on this page can’t be played. Your system may not have the required video codecs for: video/mp4; codecs="avc1.42E01E mp4a.40.2", video/mp4

Reading some past bug reports and forum posts, I believe Firefox looks for libavcodec.so(.57) for H.264 decoding. I have tried dropping those files into the [...]org.mozilla.FirefoxNightly/current/active/files/lib/ directory but it doesn't appear to help.

My distro is Solus, which has its own package manager and may have installed the relevant libraries in a different place than usual. Is there a way to point it to the right codecs? Am I creating more trouble for myself by doing things the wrong way?

Thank you!

@khardix
Copy link

khardix commented May 10, 2017

I can confirm that the MP4 playback does not work even with FirefoxDevEdition on Fedora 25, with ffmpeg (and libavcodec.so) installed from RPMFusion (with DNF).

@yekyau
Copy link
Author

yekyau commented May 11, 2017

It took a few hours of muddling, but I added ffmpeg to the .json manifest file, redid the build on my local machine, and got the libraries correctly installed outright. It's all worth it for video playback right?

Note some of these dependencies may be unnecessary as far as firefox is concerned, and a couple of them are encumbered by licensing issues, but that's for the lawyers to decide. Also be warned that the firefox git clone performs a ~3gb download, and the initial build takes up to an hour.

I added these lines between the Rust section and the Firefox section in org.mozilla.FirefoxNightly/org.mozilla.FirefoxNightly.json then followed the build guide in the README:

      {
            "name": "libx264",
            "build-options" : {
              "env": {
                "PKG_CONFIG_PATH": "/app/lib/pkgconfig"
              }
            },
            "config-opts": ["--enable-shared",
                            "--disable-static",
                            "--prefix=/app",
                            "--bindir=/app/bin"],

            "sources": [
                {
                    "type": "git",
                    "url": "git://git.videolan.org/x264"
                }
            ]
      },
      {
            "name": "libfdk_aac",
            "config-opts": ["--enable-shared",
                            "--prefix=/app"],
            "sources": [
                {
                    "type": "git",
                    "url": "git://git.code.sf.net/p/opencore-amr/fdk-aac"
                }
            ]
      },
      {
            "name": "libmp3lame",
            "config-opts": ["--enable-shared",
                            "--enable-nasm",
                            "--prefix=/app",
                            "--bindir=/app/bin"],
            "sources": [
                {
                    "type": "archive",
                    "url": "http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz",
                    "sha256": "24346b4158e4af3bd9f2e194bb23eb473c75fb7377011523353196b19b9a23ff"
                }
            ]
      },
      {
            "name": "libopus",
            "build-options" : {
              "env": {
                "PKG_CONFIG_PATH": "/app/lib/pkgconfig"
              }
            },
            "config-opts": ["--prefix=/app",
                            "--enable-shared"],
            "sources": [
                {
                    "type": "git",
                    "url": "https://git.xiph.org/opus.git"
                }
            ]
      },
      {
            "name": "libogg",
            "config-opts": ["--prefix=/app",
                            "--enable-shared"],
            "sources": [
                {
                    "type": "archive",
                    "url": "http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz",
                    "sha256": "e19ee34711d7af328cb26287f4137e70630e7261b17cbe3cd41011d73a654692"
                }
            ]
      },
      {
            "name": "libvorbis",
            "config-opts": ["--prefix=/app",
                            "--with-ogg=/app/",
                            "--enable-shared"],
            "sources": [
                {
                    "type": "archive",
                    "url": "http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.gz",
                    "sha256": "eee09a0a13ec38662ff949168fe897a25d2526529bc7e805305f381c219a1ecb"
                }
            ]
      },
      {
            "name": "libvpx",
            "config-opts": ["--prefix=/app",
                            "--disable-examples",
                            "--enable-shared"],
            "sources": [
                {
                    "type": "git",
                    "url": "https://chromium.googlesource.com/webm/libvpx.git"
                }
            ]
      },
      {
            "name": "ffmpeg",
            "build-options" : {
              "env": {
                "PKG_CONFIG_PATH": "/app/lib/pkgconfig"
              }
            },
            "config-opts": ["--prefix=/app",
                            "--extra-cflags=-I/app/include",
                            "--extra-ldflags=-L/app/lib -ldl",
                            "--bindir=/app/bin",
                            "--enable-shared",
                            "--disable-static",
                            "--disable-debug",
                            "--enable-gpl",
                            "--enable-nonfree",
                            "--enable-libx264",
                            "--enable-libmp3lame",
                            "--enable-libopus",
                            "--enable-libfdk-aac",
                            "--enable-libvorbis",
                            "--enable-libvpx",
                            "--disable-doc"],
            "sources": [
            {
                "type": "archive",
                "url": "https://ffmpeg.org/releases/ffmpeg-3.3.tar.gz",
                "sha256": "d7503907a40cd1013d5a9e95cdb7ef2c0773d5426969706426640531acc66711"
            }
            ]
      },

@xhorak
Copy link
Owner

xhorak commented May 29, 2017

Hm, this is rather difficult to decide as long as ffmpeg contains some non-free code, @Sesivany what do you think about it?

@Sesivany
Copy link

I think the right way to add codecs is via runtime extensions. Firefox uses the GNOME runtime, so you can create an extension which will add ffmpeg to the runtime. The advantage of it is that if the extension is installed any app which uses the GNOME runtime will be able to use it. Another advantage is that you don't have to tweak Firefox to look for ffmpeg in another path which will be very important once Mozilla releases the official Firefox for Flatpak.
The Firefox-flatpak repo is hosted by Red Hat and we simply can't distribute ffmpeg because of patents. So the extension would have to be hosted elsewhere.

@tidux
Copy link

tidux commented Jun 16, 2017

Why not just host it somewhere else outside of the US and on a personal, non RH system? The MPEG-LA can't sue in a country where software patents aren't legally enforceable, and you don't need a whole lot of machine to serve files. If you can extend the GNOME runtime to link against system ffmpeg, then this would only be a temporary stopgap until that change got upstreamed anyways. The lack of H.264 makes these packages essentially useless for most people.

@Sesivany
Copy link

@tidux If someone forks our work and build it and host it somewhere else... but we as RH employees have tied hands.

@marsjaninzmarsa
Copy link

host it somewhere else

Flathub maybe? They already have VLC and Spotify.

@tidux
Copy link

tidux commented Aug 24, 2017

Flathub would be good. They already have Steam so clearly they're not concerned about redistributing non-libre software.

@Sesivany
Copy link

It's not about the license. It's about patents. The software itself could be FLOSS, but if it violates existing patents you can't distribute it, at least in some jurisdictions. FFMEG is GPL/LGPL, so the license is not a problem.
I'm not aware of VLC in Flathub. There is GNOME MVP though, which is a similar case. They don't actually redistribute Spotify. When you install the flatpak, it downloads the official deb package, unpacks it and installs it, so the user actually downloads and installs it from Spotify directly.
I spoken with people involved in Flathub and they haven't sorted out legal questions.

@tidux
Copy link

tidux commented Sep 21, 2017

Flathub is already hosting a build of Picard that uses FFMPEG and the hordes of MPEG-LA lawyers haven't descended on them yet. Looks like that issue has been resolved.

metabrainz/picard-website#77

@Idesmi
Copy link

Idesmi commented Oct 22, 2017

So what's the status of this now?

@Celti
Copy link

Celti commented Nov 20, 2017

Given that there doesn't seem to be any consensus from the greater Flatpak community on defining common non-GStreamer extensions for codecs, why not define the extension for the FirefoxNightly flatpak itself? They're not just available for runtimes, after all.

@xhorak
Copy link
Owner

xhorak commented Jan 30, 2018

Finally we have a solution for this: https://firefox-flatpak.mojefedora.cz/#audio/video-playback
Please reopen if that's not working for you.

@xhorak xhorak closed this as completed Jan 30, 2018
@marxistvegan
Copy link

Running Fedora 31 and ffmpeg 1.6 with Firefox 70 and also 69 and I cannot get the media to play with the solution

Finally we have a solution for this: https://firefox-flatpak.mojefedora.cz/#audio/video-playback
Please reopen if that's not working for you.

Running Fedora 31 and ffmpeg 1.6 with Firefox 70 and also 69 and I cannot get the media to play with this solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants