Closed Bug 1275267 Opened 8 years ago Closed 8 years ago

media.ffmpeg.enabled on Linux degrades the video quality

Categories

(Core :: Audio/Video: Playback, defect)

45 Branch
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: armin72, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0
Build ID: 20160502160818

Steps to reproduce:

I watch a 720p video on youtube and the video quality is much worse as it was the case in earlier versions. If I set "media.ffmpeg.enabled" to "false" the quality rises significantly. I'm using Linux Mint 17.2



Actual results:

video quality with "media.ffmpeg.enabled" is much worse. If I set it to "false"  the quality rises significantly.


Expected results:

FFmpeg should have the same quality as GStreamer.
Component: Untriaged → Audio/Video: Playback
Product: Firefox → Core
Thank you for your report. 

Quality with gstreamer would have been maxed at 360p when nothing else was available. 

YouTube uses MSE/vp9 by default which isn't influenced by the ffmpeg preference. 

You can manually select the resolution you want if you're unhappy with the quality YouTube auto selected for you.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
Of course I've set the quality always to 720p. Video quality at 720p ist bad with "media.ffmpeg.enabled" and significantly better if i set it to "false". in both cases at 720p.
What does "stats for nerd" (right click on the playback window) with media.ffmpeg.enabled set to true (default) and set to false?

Please copy/paste the content here.
This is the output of the "stats for nerd":
Dimensions: 1280 x 720
Resolution: 1280 x 720@30
Volume: 100%
Stream Host: r3---sn-4g5e6ne6
Stream Type: https
CPN: nC40E4ojRMpo3eCA
Mime Type: video/mp4; codecs="avc1.4d400c"
DASH: yes (136/140)
Connection Speed: 4199 Kbps
Buffer Health: 69.2 s
Dropped Frames: 0/4511


Linux Mint has btw. no FFmpeg installed. It uses avconv instead. And my Version of avconv has no VP9 support. But GStreamer has:

armin@freedom ~ $ gst-inspect-1.0 | grep vpx
vpx:  vp8dec: On2 VP8 Decoder
vpx:  vp8enc: On2 VP8 Encoder
vpx:  vp9dec: On2 VP9 Decoder
vpx:  vp9enc: On2 VP9 Encoder
armin@freedom ~ $ gst-inspect-1.0 | grep x264
x264:  x264enc: x264enc
typefindfunctions: video/x-h264: h264, x264, 264
armin@freedom ~ $ 



armin@freedom ~ $ avconv -codecs | grep libx
avconv version 9.18-6:9.18-0ubuntu0.14.04.1, Copyright (c) 2000-2014 the Libav developers
  built on Mar 16 2015 13:19:10 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
DEV.L. mpeg4                MPEG-4 part 2 (decoders: mpeg4 mpeg4_vdpau ) (encoders: mpeg4 libxvid )
DEV.LS h264                 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_vdpau ) (encoders: libx264 )
armin@freedom ~ $ avconv -codecs | grep vpx
avconv version 9.18-6:9.18-0ubuntu0.14.04.1, Copyright (c) 2000-2014 the Libav developers
  built on Mar 16 2015 13:19:10 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
DEV.L. vp8                  On2 VP8 (decoders: vp8 libvpx ) (encoders: libvpx )
armin@freedom ~ $ 

Can Firefox also use avconv?

If media.ffmpeg.enabled is set tu true, the YouTube player shows me 720p and also the red HD Icon is displayed but the Video looks like 360p. Is it possible that firefox can not work with avconv?
you haven't provided the information I asked for which is the about for nerd info with media.ffmpeg.enabled = false.

You don't need gstreamer for vp8/vp9 support, firefox has native decoders for those, it ships with libvpx (http://www.webmproject.org/code/) and the FFmpeg VP8/VP9 decoder (www.ffmpeg.org)

The version of libav you are using has serious security flaws and is no longer maintained by the libav developers; you should consider upgrading to FFmpeg 3.x.

avconv is just an utility of LibAV, you will have libavcodec and libavutils installed and firefox will use those if it finds them.

Did you disable webm by any chance?
please copy the output of about:support.

It could very well be that the problem is isolated to the particular video you are trying to watch.
In any cases, all those issues are YouTube issues, not Firefox.

We have no control of the encoding quality used by YouTube. If their 720p streams look bad, well, that's just how the video is.
Oh sorry.

Enabled (default): 
Video ID: gE0zJXZS3yQ
Dimensions:1280 x 720
Resolution:1280 x 720@30
Volume: 100%
Stream Host: r3---sn-4g5edn7z
Stream Type: https
CPN: 6_h9VqJw1w1k9hYP
Mime Type: video/mp4; codecs="avc1.4d400c"
DASH: yes (136/140)
Connection Speed: 4341 Kbps
Buffer Health: 11.7 s
Dropped Frames: 0/488

Disabled: 
Video ID: gE0zJXZS3yQ
Dimensions: 1280 x 720
Resolution: 1280 x 720
Volume: 100%
Stream Host:
Stream Type:
https
CPN: ppfv0dL55Mx-MD5d
Mime Type: video/mp4; codecs="avc1.64001F, mp4a.40.2"
DASH: no (22)
Connection Speed: 0 Kbps
Buffer Health: 33.0 s
Dropped Frames: 0/434


FFmpeg is not in the repository of my Linux Distibution because all Debian based Distributions supports only avconv. The only way would be a source code installation. But if Firefox has its own FFmpeg on board this cannot be the cause of the problem. The problem exists with every Video on YT btw. The Video I've posted is just an example. Also Videos with the Mime Type VP9 has the same issue. Is there any way for me to figure out how Firefox sets the Parameters for FFmpeg and is there an opportunity to change this Parameters? 

I don't think that I disable webm. Here is the output of about:support:

{
  "application": {
    "name": "Firefox",
    "version": "45.1.1",
    "buildID": "20160502160818",
    "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0",
    "safeMode": false,
    "updateChannel": "esr",
    "supportURL": "https://support.mozilla.org/1/firefox/45.1.1/Linux/de/",
    "numTotalWindows": 1,
    "numRemoteWindows": 0,
    "remoteAutoStart": false
  },
  "modifiedPreferences": {
    "accessibility.typeaheadfind.flashBar": 0,
    "browser.cache.disk.smart_size.first_run": false,
    "browser.cache.frecency_experiment": 3,
    "browser.cache.disk.filesystem_reported": 1,
    "browser.cache.disk.capacity": 358400,
    "browser.cache.disk.smart_size.use_old_max": false,
    "browser.download.importedFromSqlite": true,
    "browser.download.useDownloadDir": false,
    "browser.places.smartBookmarksVersion": 7,
    "browser.search.update": false,
    "browser.search.useDBForOrder": true,
    "browser.sessionstore.upgradeBackup.latestBuildID": "20160502160818",
    "browser.sessionstore.interval": 600000,
    "browser.startup.homepage_override.mstone": "45.1.1",
    "browser.startup.homepage": "startseite.warias.org",
    "browser.startup.homepage_override.buildID": "20160502160818",
    "browser.tabs.showAudioPlayingIcon": false,
    "browser.urlbar.unifiedcomplete": false,
    "browser.urlbar.userMadeSearchSuggestionsChoice": true,
    "dom.enable_resource_timing": false,
    "dom.event.clipboardevents.enabled": false,
    "dom.enable_user_timing": false,
    "dom.enable_performance": false,
    "dom.apps.reset-permissions": true,
    "dom.mozApps.used": true,
    "extensions.lastAppVersion": "45.1.1",
    "font.internaluseonly.changed": false,
    "keyword.URL": "https://duckduckgo.com/?t=lm&q=",
    "media.gmp-gmpopenh264.lastUpdate": 1452031143,
    "media.peerconnection.enabled": false,
    "media.ffmpeg.enabled": false,
    "media.gmp-gmpopenh264.version": "1.5.3",
    "media.gmp-manager.lastCheck": 1464085912,
    "media.gmp-gmpopenh264.enabled": false,
    "media.gmp-manager.buildID": "20160502160818",
    "network.prefetch-next": false,
    "network.protocol-handler.app.apt+http": "/usr/bin/apturl",
    "network.http.speculative-parallel-limit": 0,
    "network.predictor.cleaned-up": true,
    "network.protocol-handler.warn-external.apt": true,
    "network.cookie.prefsMigrated": true,
    "network.protocol-handler.app.apt": "/usr/bin/apturl",
    "network.protocol-handler.warn-external.apt+http": true,
    "network.http.sendRefererHeader": 0,
    "places.history.expiration.transient_current_max_pages": 104858,
    "places.database.lastMaintenance": 1464114974,
    "plugin.importedState": true,
    "plugin.disable_full_page_plugin_for_types": "application/pdf",
    "plugin.state.flash": 0,
    "plugin.state.java": 0,
    "plugin.state.libtotem-narrowspace-plugin": 0,
    "plugin.state.libtotem-gmp-plugin": 0,
    "plugin.state.libtotem-mully-plugin": 0,
    "privacy.cpd.siteSettings": true,
    "privacy.sanitize.timeSpan": 0,
    "privacy.cpd.offlineApps": true,
    "privacy.sanitize.migrateFx3Prefs": true,
    "security.disable_button.openDeviceManager": false,
    "security.disable_button.openCertManager": false,
    "services.sync.declinedEngines": "",
    "storage.vacuum.last.index": 1,
    "storage.vacuum.last.places.sqlite": 1462987453,
    "webgl.disable-extensions": true,
    "webgl.disabled": true
  },
  "lockedPreferences": {},
  "graphics": {
    "numTotalWindows": 1,
    "numAcceleratedWindows": 0,
    "windowLayerManagerType": "Basic",
    "windowLayerManagerRemote": true,
    "supportsHardwareH264": "No; Failed to create H264 decoder",
    "numAcceleratedWindowsMessage": [
      ""
    ],
    "adapterDescription": "Intel Open Source Technology Center -- Mesa DRI Intel(R) Sandybridge Desktop ",
    "adapterVendorID": "Intel Open Source Technology Center",
    "adapterDeviceID": "Mesa DRI Intel(R) Sandybridge Desktop ",
    "adapterRAM": "",
    "adapterDrivers": "",
    "driverVersion": "3.0 Mesa 10.1.3",
    "driverDate": "",
    "webglRendererMessage": [
      ""
    ],
    "info": {
      "AzureCanvasBackend": "cairo",
      "AzureSkiaAccelerated": 0,
      "AzureFallbackCanvasBackend": "none",
      "AzureContentBackend": "cairo",
      "CairoUseXRender": 1
    }
  },
  "javaScript": {
    "incrementalGCEnabled": true
  },
  "accessibility": {
    "isActive": false,
    "forceDisabled": 0
  },
  "libraryVersions": {
    "NSPR": {
      "minVersion": "4.12",
      "version": "4.12"
    },
    "NSS": {
      "minVersion": "3.21.1 Basic ECC",
      "version": "3.21.1 Basic ECC"
    },
Its not the complete Output here is ist again:

{
  "application": {
    "name": "Firefox",
    "version": "45.1.1",
    "buildID": "20160502160818",
    "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0",
    "safeMode": false,
    "updateChannel": "esr",
    "supportURL": "https://support.mozilla.org/1/firefox/45.1.1/Linux/de/",
    "numTotalWindows": 1,
    "numRemoteWindows": 0,
    "remoteAutoStart": false
  },
  "modifiedPreferences": {
    "accessibility.typeaheadfind.flashBar": 0,
    "browser.cache.disk.smart_size.first_run": false,
    "browser.cache.frecency_experiment": 3,
    "browser.cache.disk.filesystem_reported": 1,
    "browser.cache.disk.capacity": 358400,
    "browser.cache.disk.smart_size.use_old_max": false,
    "browser.download.importedFromSqlite": true,
    "browser.download.useDownloadDir": false,
    "browser.places.smartBookmarksVersion": 7,
    "browser.search.update": false,
    "browser.search.useDBForOrder": true,
    "browser.sessionstore.upgradeBackup.latestBuildID": "20160502160818",
    "browser.sessionstore.interval": 600000,
    "browser.startup.homepage_override.mstone": "45.1.1",
    "browser.startup.homepage": "startseite.warias.org",
    "browser.startup.homepage_override.buildID": "20160502160818",
    "browser.tabs.showAudioPlayingIcon": false,
    "browser.urlbar.unifiedcomplete": false,
    "browser.urlbar.userMadeSearchSuggestionsChoice": true,
    "dom.enable_resource_timing": false,
    "dom.event.clipboardevents.enabled": false,
    "dom.enable_user_timing": false,
    "dom.enable_performance": false,
    "dom.apps.reset-permissions": true,
    "dom.mozApps.used": true,
    "extensions.lastAppVersion": "45.1.1",
    "font.internaluseonly.changed": false,
    "keyword.URL": "https://duckduckgo.com/?t=lm&q=",
    "media.gmp-gmpopenh264.lastUpdate": 1452031143,
    "media.peerconnection.enabled": false,
    "media.ffmpeg.enabled": false,
    "media.gmp-gmpopenh264.version": "1.5.3",
    "media.gmp-manager.lastCheck": 1464085912,
    "media.gmp-gmpopenh264.enabled": false,
    "media.gmp-manager.buildID": "20160502160818",
    "network.prefetch-next": false,
    "network.protocol-handler.app.apt+http": "/usr/bin/apturl",
    "network.http.speculative-parallel-limit": 0,
    "network.predictor.cleaned-up": true,
    "network.protocol-handler.warn-external.apt": true,
    "network.cookie.prefsMigrated": true,
    "network.protocol-handler.app.apt": "/usr/bin/apturl",
    "network.protocol-handler.warn-external.apt+http": true,
    "network.http.sendRefererHeader": 0,
    "places.history.expiration.transient_current_max_pages": 104858,
    "places.database.lastMaintenance": 1464114974,
    "plugin.importedState": true,
    "plugin.disable_full_page_plugin_for_types": "application/pdf",
    "plugin.state.flash": 0,
    "plugin.state.java": 0,
    "plugin.state.libtotem-narrowspace-plugin": 0,
    "plugin.state.libtotem-gmp-plugin": 0,
    "plugin.state.libtotem-mully-plugin": 0,
    "privacy.cpd.siteSettings": true,
    "privacy.sanitize.timeSpan": 0,
    "privacy.cpd.offlineApps": true,
    "privacy.sanitize.migrateFx3Prefs": true,
    "security.disable_button.openDeviceManager": false,
    "security.disable_button.openCertManager": false,
    "services.sync.declinedEngines": "",
    "storage.vacuum.last.index": 1,
    "storage.vacuum.last.places.sqlite": 1462987453,
    "webgl.disable-extensions": true,
    "webgl.disabled": true
  },
  "lockedPreferences": {},
  "graphics": {
    "numTotalWindows": 1,
    "numAcceleratedWindows": 0,
    "windowLayerManagerType": "Basic",
    "windowLayerManagerRemote": true,
    "supportsHardwareH264": "No; Failed to create H264 decoder",
    "numAcceleratedWindowsMessage": [
      ""
    ],
    "adapterDescription": "Intel Open Source Technology Center -- Mesa DRI Intel(R) Sandybridge Desktop ",
    "adapterVendorID": "Intel Open Source Technology Center",
    "adapterDeviceID": "Mesa DRI Intel(R) Sandybridge Desktop ",
    "adapterRAM": "",
    "adapterDrivers": "",
    "driverVersion": "3.0 Mesa 10.1.3",
    "driverDate": "",
    "webglRendererMessage": [
      ""
    ],
    "info": {
      "AzureCanvasBackend": "cairo",
      "AzureSkiaAccelerated": 0,
      "AzureFallbackCanvasBackend": "none",
      "AzureContentBackend": "cairo",
      "CairoUseXRender": 1
    }
  },
  "javaScript": {
    "incrementalGCEnabled": true
  },
  "accessibility": {
    "isActive": false,
    "forceDisabled": 0
  },
  "libraryVersions": {
    "NSPR": {
      "minVersion": "4.12",
      "version": "4.12"
    },
    "NSS": {
      "minVersion": "3.21.1 Basic ECC",
      "version": "3.21.1 Basic ECC"
    },
    "NSSUTIL": {
      "minVersion": "3.21.1",
      "version": "3.21.1"
    },
    "NSSSSL": {
      "minVersion": "3.21.1 Basic ECC",
      "version": "3.21.1 Basic ECC"
    },
    "NSSSMIME": {
      "minVersion": "3.21.1 Basic ECC",
      "version": "3.21.1 Basic ECC"
    }
  },
  "userJS": {
    "exists": false
  },
  "crashes": {
    "submitted": [],
    "pending": 0
  },
  "sandbox": {
    "hasSeccompBPF": true,
    "hasSeccompTSync": true,
    "hasPrivilegedUserNamespaces": true,
    "hasUserNamespaces": true,
    "canSandboxMedia": true
  },
  "extensions": [
    {
      "name": "Classic Theme Restorer",
      "version": "1.5.2",
      "isActive": true,
      "id": "ClassicThemeRestorer@ArisT2Noia4dev"
    },
    {
      "name": "Firefox Hello Beta",
      "version": "1.1.14",
      "isActive": true,
      "id": "loop@mozilla.org"
    },
    {
      "name": "FxIF",
      "version": "0.4.9.1",
      "isActive": true,
      "id": "{11483926-db67-4190-91b1-ef20fcec5f33}"
    },
    {
      "name": "Google Translator for Firefox",
      "version": "2.1.0.5.1.1-signed",
      "isActive": true,
      "id": "translator@zoli.bod"
    },
    {
      "name": "NoScript",
      "version": "2.9.0.11",
      "isActive": true,
      "id": "{73a6fe31-595d-460b-a920-fcc0f8843232}"
    },
    {
      "name": "Old Default Image Style",
      "version": "3.0.6.1-signed.1-signed",
      "isActive": true,
      "id": "olddefaultimagestyle@dagger2-addons.mozilla.org"
    },
    {
      "name": "Status-4-Evar",
      "version": "2015.11.16.23.1-signed.1-let-fixed",
      "isActive": true,
      "id": "status4evar@caligonstudios.com"
    },
    {
      "name": "uBlock Origin",
      "version": "1.7.0",
      "isActive": true,
      "id": "uBlock0@raymondhill.net"
    },
    {
      "name": "Adblock Edge",
      "version": "2.1.9.1-signed.1-let-fixed.1-signed",
      "isActive": false,
      "id": "{fe272bd1-5f76-4ea4-8501-a05d35d823fc}"
    },
    {
      "name": "VLC Youtube Shortcut",
      "version": "0.8.2.0",
      "isActive": false,
      "id": "vlc_shortcut@kosan.kosan"
    }
  ],
  "experiments": []
}
Debian is using FFmpeg now; not libav. They have done so for about 2 years. 

You're using a distribution based on Ubuntu 14.04. It was the last release that used libav. 

In any case, you're being served 720p content in both cases; this is surprising because typically YouTube also have VP9 encoding which is of slightly higher quality. Why the plain MP4 would have higher quality than the fragmented one is up to YouTube. We have no control over that. 

Most other YouTube videos would be available with vp9. Why this particular one isn't. YouTube would know. 

You're running Firefox 45 I suggest that you upgrade to the latest version.
It's the latest version of Firefox I'm using the ESR version (45.1.1 at the moment). I've figuered out somthing now. If I play the Youtube video directly in Firefox (not using the YT Player) there is no difference between FFmpeg and GStreamer. The problem is, if I have enabled ffmpeg, the YT player uses DASH. If I disable ffmpeg in Firefox, GStreamer is used which doesn't support DASH. DASH can change the Video quality dynamicly and it makes a terrible job. Without DASH it works optimal. I have a DSL 6000 connection wich alows me to watch video in 720p. But DASH means it has to lower the Quality  I think. That's awful. I think it would be grate if you make it possible to disable DASH support in FFmpeg. E.g. with a about:config flag.
I found it. The setting is called "media.mediasource.enabled". If I set this to "false" FFmpeg has a good quality in YT player. I'm loosing the video qualities 1080p and 480p if I do that, but I think I can live with that.
I think I have two choices to disable DASH: Disabling ffmpeg support and using GStreamer or disabling mediasource.
you can disable dash by setting media.mediasource.enabled to false.

However, what you're experiencing is atypical and likely unique for that particular video you are watching.

Because;
1- Typically DASH videos have much higher resolution available than 720p, up to 8k sometimes. Most have 1080p
2- You can manually select the resolution, including higher than what youtube detected to use
3- Most (almost all) videos have a DASH VP9 streamer, which allows for lower bitrate yet higher resolution. So for the same network bandwidth you will usually get a higher resolution.
4- GStreamer is typically bad and unstable and that's why we removed support for it.

You're not doing yourself a favour by disabling ffmpeg. I also don't recommend that you disable mediasource, as most videos will now be limited to 360p. If you thought 720p was bad, I guarantee you, 360p is worse.

BTW, gstreamer would have used FFmpeg/LibAV exactly like what Firefox is doing. Disabling ffmpeg isn't what's getting a higher quality. It's that YouTube serves you a different content. But this is an exception, not the rule.

make sure you set media.mediasource.webm.enabled to true if it's not enabled.

you can check on what is supported by going to youtube.com/html5 ; everything should appear in blue. If it doesn't ; it must be because you've played with the preferences which will certainly give you an overall worse experience.

Try videos like: https://www.youtube.com/watch?v=wTcNtgA6gHs
or: https://www.youtube.com/watch?v=XqLTe8h0-jo

those clearly show the advantage of using dash with youtube.
The videos you've linked looks better with disabled DASH in my case. That's crazy. And even with enabled DASH I only get 720p automaticly. If I set it manualy to 1080p it doesn't looks better. But anyway we can say "it's not a bug, it's a feature". I agree with you that's not a good idea to disable FFmpeg because it will no longer be supported in future and it doesn't disable DASH at VP9 videos. The only way to disable DASH is to set "media.mediasource.enabled" to false. I don't know why the video which I have uploaded to Youtube does not come with VP9. I'll consult the YT support therefore. Maybe I have to upload a bunch of Videos first so that I will get better features. But now I know where the problem is and I think it's not a Firefox issue. Thank you very much for your support.
You need to log in before you can comment on or make changes to this bug.