Flash video appears blue

There are some misleading and some wrong recommendations here, so let's sum up what the problem is and what solutions there are.

TL;DR

The latest versions of Ubuntu since 12.10 (Quantal) contain a patched version of the library. If you still run into issues with blue video (NOT including the Blue Man Group), check out this answer – the Flash Player's library name must be libflashplayer.so otherwise libvdpau won't apply the workaround. You may also take a look at /etc/vdpau_wrapper.cfg file. There you can disable the workarounds applied by libvdpau.

If you have Oneiric (11.10) or Precise (12.04), install patched libvdpau:

sudo add-apt-repository ppa:tikhonov/misc
sudo apt-get update
sudo apt-get install libvdpau1

Otherwise you can modify Flash Player's library:

cd /usr/lib/flashplugin-installer || cd /usr/lib/adobe-flashplugin/
sudo perl -pi.bak -e 's/libvdpau/lixvdpau/g' libflashplayer.so

Read the whole post before commenting.

The problem

Flash Player since version 11.2 uses hardware video acceleration on most platforms. Unfortunately the acceleration in Linux is not just unsupported, but essentially broken. Flash Player swaps colors in the video under the following conditions:

  • You are using a fairly new Nvidia GPU with VDPAU support.
  • You are using current version of Nvidia binary driver (older versions don't support VDPAU).
  • You have libvdpau1 package installed.
  • The player on the site uses Stage Video – that's why only YouTube and few other players are affected.

See the explanation by Pierre-Loup Griffais from Nvidia.

This is not a bug in Nvidia drivers. Nvidia is aware of this problem and they have already created a workaround. Nouveau driver isn't probably affected because the video decoding support is not yet finished.

This is not a bug in libvdpau. libvdpau is just a wrapper which allows video players to use VDPAU decoding (see Stephen Warren's explanation).

This is not an Ubuntu-specific bug. Other distributions are affected as well, e.g. Arch.

The bug is very possibly in Flash Player – although Adobe tries to blame Nvidia and incompetent users. There have been multiple reports on Adobe's bug tracker, all of them were rejected as “CannotReproduce”:

  • https://bugbase.adobe.com/index.cfm?event=bug&id=3077076
  • https://bugbase.adobe.com/index.cfm?event=bug&id=3097844
  • https://bugbase.adobe.com/index.cfm?event=bug&id=3109467
  • https://bugbase.adobe.com/index.cfm?event=bug&id=3120888
  • https://bugbase.adobe.com/index.cfm?event=bug&id=3136745
  • https://bugbase.adobe.com/index.cfm?event=bug&id=3164063

There won't be an official fix from Adobe, since NPAPI-based Flash Player receives only security patches until 2017. Hopefully we won't need Flash Player by that time.

The workarounds

Use libvdpau 0.5

Available in official repositories since Ubuntu 12.10 libvdpau 0.4.1-6

This version of libvdpau includes a workaround by Stephen Warren described below.

See the release announcement

Install patched libvdpau (proper patch)

Stephen Warren has created nice patch for libvdpau, which detects Flash Player and applies workarounds only for it. The patch can be controlled using /etc/vdpau_wrapper.cfg file.

Patched libvdpau fixes colors and allows Flash Player to use VDPAU for hardware overlay which still provides some performance benefits.

For the wrapper to work, it needs to recognize the use of Flash. So the Flash library has to be named libflashplayer.so and the plugin wrapper has to be enabled in Firefox (in about:config, dom.ipc.plugins.enabled.libflashplayer.so and dom.ipc.plugins.enabled should be set to true).

For Precise (12.04) and Oneiric (11.10) you can install the patched libvdapu from Maxim Thikonov's PPA using the following commands:

sudo add-apt-repository ppa:tikhonov/misc
sudo apt-get update
sudo apt-get install libvdpau1

The change should come into effect after reboot (or possibly sooner).

Prevent Flash Player from finding libvdpau

(Via Daniel Mario Vega on Launchpad)

Locate libflashplayer.so in your system – for Ubuntu, it's either in /usr/lib/adobe-flashplugin/ if you have adobe-flashplugin package installed, or /usr/lib/flashplugin-installer/ for flashplugin-installer package. Consult your browser's about:plugins if you have trouble finding the file (a little tweaking in case of Firefox may be required).

Run the following commands – assuming you have installed either flashplugin-installer, or adobe-flasplugin:

 cd /usr/lib/flashplugin-installer || cd /usr/lib/adobe-flashplugin/
sudo perl -pi.bak -e 's/libvdpau/lixvdpau/g' libflashplayer.so

The change takes effect after restarting the browser.

This will modify Flash Player's binary to search for non-existent "lixvdpau" library instead of "libvdpau". Therefore it won't attempt to use VDPAU presentation at all.

The command creates libflashplayer.so.bak backup of the binary in case you run into any problems.

You need to run this command every time there's a Flash Player update since your change will be overwritten.

With this workaround you can keep HW acceleration on, have libvdpau1 installed and it's very easy to apply compared to patching libvdpau.

Use Google Chrome with PepperFlash

Since version 20, Google Chrome ships with “Pepper” Flash Player 11.3 with PPAPI support (instead of 11.2 on NPAPI used by Firefox et al.). PepperFlash doesn't seem to be affected by this problem since it appears to use full hardware acceleration.

PepperFlash can be used with Chromium, but unfortunately no other browser currently supports PPAPI.

Disable Flash Player's Hardware Acceleration

The easiest and the least intrusive fix is to disable Flash Player's HW acceleration in Display settings – right-click on Flash, select Settings…

This, however, is not that easy since the Settings window is unresponsive under composite manager (Compiz, standard Unity) and if the browser shows scrollbars.

To disable Hardware acceleration open any video (e.g. on YouTube) in fullscreen and then open the Settings… window. Or you can temporarily switch to Unity 2D or other non-composite WM.

The change takes effect after refresh.

The drawback: this disables HW acceleration in Flash Player even for vector and bitmap operations. Some Flash games and movies may have worse performance and/or worse graphics.

Uninstall libvdpau

If you want to have HW acceleration in Flash Player enabled, you may uninstall libvdpau from the system, which effectively prevents Flash Player from using VDPAU.

Run:

sudo apt-get remove libvdpau1

The drawback: Desktop players (like Totem and Mplayer) won't be able to use hardware video decoding too. This will lead to higher CPU usage during playback. Also, the video playback performance may be affected (e.g. dropped frames or completely frozen picture), especially if you have slower CPU and you're watching 1080p videos.

Enable Flash Player hardware video decoding

Most users have reported that this leads to very frequent crashes of Flash Player (probably due to concurrency issues in decoding) but if you're feeling lucky, give it a try.

This is also the same method used by Flash-Aid addon. It won't make it any better.

Run:

sudo mkdir /etc/adobe
echo -e "EnableLinuxHWVideoDecode=1" | sudo tee /etc/adobe/mms.cfg > /dev/null

This will create the /etc/adobe/mms.cfg file with EnableLinuxHWVideoDecode=1 content. This is the only way how to actually force Flash Player to decode video on GPU and it's not officially supported by Adobe.

To undo this, run:

sudo rm /etc/adobe/mms.cfg

to remove the mms.cfg file.

You can try to further improve Flash Player's stability with VDPAU_NVIDIA_NO_OVERLAY=1 environment variable, see Nvidia forums.

Replace Flash players

(As recommended by bowser on Launchpad)

Use FlashVideoReplacer Firefox add-on, Literna Mágica or other solution to replace standard players in Flash with embedded video player plugin (like Totem – totem-mozilla – or VLC – mozilla-plugin-vlc). No Flash Player, no problem.

Patch libvdpau (vdpau_trace hack)

There's an unofficial patch by Nvidia which fixes Flash Player's bug on libvdpau level by hacking vdpau_trace.

Note that the aforementioned patch by Stephen Warren is technically superior and should be used instead.

The non-workarounds

The following solutions will work only partially or they may have some caveats.

Enable HTML5 at YouTube

Enabling HTML5 player at http://www.youtube.com/html5 won't work with all videos; some YouTube videos are just not available for HTML5 players (for example due to the lack of ad support). However HTML5 video is awesome and you should use it anyway.

Downgrade to Flash Player 11.1

There are known vulnerabilities in FP 11.1 which are fixed in 11.2. If you want to risk it, you should know what you're getting into.

If you still want to downgrade, try Flash Player 10.3 which is still maintained – you can get it in Adobe's archive

Switch to different GPU

It seems that very few Nvidia GPUs are not affected, particularly Quadro 2000 and GeForce GT 430. Both have VDPAU feature set C, but otherwise most feature set C GPUs are affected too. If you have any of the aforementioned GPUs, please tell us on Launchpad whether this bug affects you.


UPDATE: Please look at this solution for a proper fix. The solution mentioned here leads to crashes for many who tried it.

This is caused by a bug in the new Flash version that Adobe refuses to fix. There also is a bugreport on Launchpad that discusses this (LP: #967091). The bug only appears when you use the NVidia binary drivers and have libvdpau installed. A quick fix is adding some extra settings to the Flash configuration.

sudo mkdir /etc/adobe
echo -e "EnableLinuxHWVideoDecode=1\nOverrideGPUValidation=true" | sudo tee /etc/adobe/mms.cfg > /dev/null

This fixes the problem while still having VDPAU hardware accelleration. Unfortunately there probably won't be a new Flash version to fix this without this manual config-hack because the Flash version that introduced this bug is also the last Flash version Adobe will ever release for Linux.

If this causes instability for you, revert the changes by deleting the directory you created before.

sudo rm -r /etc/adobe

or you can try to reduce the /etc/adobe/mms.cfg file to just the

OverrideGPUValidation=true

line by editing with sudo gedit /etc/adobe/mms.cfg.


Fix (work around)

Issue: All web browsers flash player video is blue

  • Chromium
  • Google Chrome
  • Firefox

Both flash plugins causes flash video to appear have a blue overlay, so remove.

  • Adobe - flashplugin
  • Flashplugin - installer

Solution (not as functional as adobe flash plug in but it works)

  • Install lightspark (plus any browser-plugins) or
  • Install gnash (plus any browser-plugins)

Possible Fix 1

Removed:

  • gnash browser plug-ins
  • gightspark browser plug-ins
  • Video Decode and Presentation API for Unix (libraries) libvdpau1
  • flashplugin - installer

Installed:

adobe-flashplugin Re-started browser, and it worked for me.

Possible Fix 2

Installed:

  • libvdpau1

Flash set-up

  • disable HW acceleration in Flash.

Open your browser and navigate to a flash video (youtube, abobe flash site, etc) right click, settings and disable Hardware acceleration.

If you are unable to disable Hardware acceleration, log in to the Unity 2D environment.

BUG: https://bugs.launchpad.net/ubuntu/+source/unity/+bug/968489

OBS: In case of persistance. Restart the machine.