Ubuntu上讓Firefox使用Chrome最新版PepperFlash插件

2016-11-11更新:
最新消息是Adobe將按期發佈Flash Player的NPAPI版和PPAPI版,將保持大的版本號同步.
Adobe作出這個決定主要是出於安全方面的考慮.
所以部分特性如GPU 3D加速和付費視頻的DRM將不會完整實現.
http://labs.adobe.com/downloads/flashplayer.html
Firefox:  NPAPI(Netscape Plug-In API)
Chromium: PPAPI(PepperFlash API)
Flash for Firefox on Linux:
下載後將裏面的libflashplayer.so放到/usr/lib/mozilla/plugins/便可.
https://fpdownload.macromedia.com/pub/labs/flashruntimes/flashplayer/linux64/flash_player_npapi_linux.x86_64.tar.gz
https://fpdownload.macromedia.com/pub/labs/flashruntimes/flashplayer/linux32/flash_player_npapi_linux.i386.tar.gz
須要開啓Flash Stage 3D加速的能夠下載下面的PPAPI版本和文章.
Flash for Opera and Chromium based applications on Linux:
https://fpdownload.macromedia.com/pub/labs/flashruntimes/flashplayer/linux64/flash_player_ppapi_linux.x86_64.tar.gz
https://fpdownload.macromedia.com/pub/labs/flashruntimes/flashplayer/linux32/flash_player_ppapi_linux.i386.tar.gz
(完)html

Ubuntu上運行Chrome,訪問chrome://flags/,啓用"覆蓋軟件渲染列表",重啓Chrome,查看chrome://gpu/,可見Flash Stage3D已經開啓硬件加速.運行下面的 Flash Stage3D 賽車遊戲:
http://www8.agame.com/mirror/flash/r/Rallypoint_extreme/Rally_Point_Extreme3/Bin/
CPU溫度在47度左右(較日常升高了5度),CPU使用率約20%(i5-3230M爲四核心,滿載爲400%).


Adobe Flash Player 11.2 將是支持 Linux 平臺的最後一個版本.
Adobe 只繼續爲 Flash Player 11.2 for Linux 提供安全更新,而不提供版本更新.
Linux上爲Firefox添加Flash Player支持也很是簡單.
下載Adobe爲Linux提供的tar.gz包:
https://get.adobe.com/cn/flashplayer/
32位 64位
把壓縮包裏的libflashplayer.so複製或軟連接到/usr/lib/mozilla/plugins/便可.

由於Chromium/Opera/Maxthon跟Chrome內核是同樣的,
因此默認就能加載Chrome的Flash插件/opt/google/chrome/PepperFlash,
而要在Firefox上使用PepperFlash,則須要經過第三方插件 FreshPlayerPlugin 來加載.
這裏先提一下,FreshPlayerPlugin這種非官方的方式穩定性並非很好,但能夠一試.

Firefox for Linux:
http://releases.mozilla.org/pub/firefox/releases/46.0/linux-x86_64/zh-CN/firefox-46.0.tar.bz2
http://releases.mozilla.org/pub/firefox/releases/46.0/linux-i686/zh-CN/firefox-46.0.tar.bz2

Chrome for Ubuntu/Debian Stable:
https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
https://dl.google.com/linux/direct/google-chrome-stable_current_i386.deb

上面是Firefox和Chrome的下載地址,由於PepperFlash集成在Chrome裏,因此須要安裝Chrome。
固然也能夠不安裝Chrome,把PepperFlash解壓後軟連接到/opt/google/chrome/下面也能夠,
好比我把PepperFlash解壓到/home/eechen/apps/firefox/flash/PepperFlash:
sudo mkdir -p /opt/google/chrome/
sudo ln -s /home/eechen/apps/firefox/flash/PepperFlash /opt/google/chrome/
其實在下面介紹的~/.config/freshwrapper.conf裏也是能夠用pepperflash_path指定PepperFlash的位置的.

webupd8爲Ubuntu編譯了二進制版本freshplayerplugin,就不須要本身手動編譯了.
下載對應你的系統版本的 freshplayerplugin , 個人是64位的Ubuntu14.04(trusty)因此我下載:
http://ppa.launchpad.net/nilarimogard/webupd8/ubuntu/pool/main/f/freshplayerplugin/freshplayerplugin_0.2.4+git20150518~webupd8~trusty0_amd64.deb
好比我把freshplayerplugin裏的libfreshwrapper-pepperflash.so解壓到/home/eechen/apps/firefox/flash/libfreshwrapper-pepperflash.so
而後我把它軟連接到Firefox的插件目錄:
sudo ln -s /home/eechen/apps/firefox/flash/libfreshwrapper-pepperflash.so /usr/lib/mozilla/plugins/

重啓Firefox訪問about:plugins便可看到Firefox成功加載了Chrome的PepperFlash:


關於Flash Stage3D硬件加速:
在默認狀況下,Ubuntu下Chrome的Flash Stage3D由軟件模擬,運行Flash Stage3D遊戲時性能不好,
CPU溫度高達57度,CPU使用率高達300%,並且幀速很低,卡頓.
Ubuntu上運行Chrome,訪問chrome://flags/,啓用"覆蓋軟件渲染列表",重啓Chrome,查看chrome://gpu/,可見Flash Stage3D已經開啓硬件加速.
運行下面的 Flash Stage3D 賽車遊戲:
http://www8.agame.com/mirror/flash/r/Rallypoint_extreme/Rally_Point_Extreme3/Bin/
CPU溫度在47度左右(較日常升高了5度),CPU使用率在20%(i5-3230M爲四線程,滿載爲400%).

http://helpx.adobe.com/x-productkb/multi/stage3d-unsupported-chipsets-drivers-flash.html
裏面提到,Linux上的Flash Stage3D硬件加速只支持Chrome PepperFlash.

Linux上Firefox的Flash插件不能使用硬件加速Stage3D,只能使用軟件模擬,因此速度慢,耗CPU,發熱量大.
不過通常的Flash視頻應該是沒有用到Stage3D硬件加速的,因此用Firefox+Flash11.2看視頻不是太大的問題.
可是,Firefox用FreshPlayerPlugin插件使用PepperFlash的方式就能夠開啓Flash Stage3D硬件加速了:
把deb包中的 /usr/share/doc/freshplayerplugin/freshwrapper.conf.example
解壓到/home/eechen/apps/firefox/flash/freshwrapper.conf,修改 pepperflash_path 路徑:
# Configuration options for FreshPlayerPlugin

# This configuration file is optional. Wrapper will search for it first
# in ~/.config/freshwrapper.conf, then in /etc/freshwrapper.conf.
# If wrapper fails to find configuration, it will use default values,
# which you can find below

# Audio buffer is used to continuously provide sound adapter with data.
# Values too low may lead to buffer underruns and stuttering.  Values
# too high will lead to noticeable latency. Usually plugin selects size
# on its own, but you may override bounds here

# lower bound for audio buffer size, in milliseconds
audio_buffer_min_ms = 20

# higher bound of audio buffer size, in milliseconds
audio_buffer_max_ms = 500

# output sound through JACK. If enabled, only JACK will be tried, and if
# your machine doesn't have it, there would be no sound, and no sync
audio_use_jack = 0

# Path to the Pepper Flash plugin.
# If the option is absent, freshwrapper will search for Pepper Flash in
# a number of location where it could be. Usually that's enough, but if
# not, you should manually enter the right path. Multiple paths could
# be specified, separated by colon.
#pepperflash_path = "/opt/google/chrome/PepperFlash/libpepflashplayer.so"
pepperflash_path = "/home/eechen/apps/firefox/flash/PepperFlash/libpepflashplayer.so"

# "Command-line" arguments for Flash
flash_command_line = "enable_hw_video_decode=1,enable_stagevideo_auto=1"

# enable 3d and stage 3d
enable_3d = 1

# when set to 1, limits output to warnings and errors only
quiet = 0

# When multiple monitors with different resolutions are used, size
# of fullscreen window can vary. But some Flash movies request these
# parameters once at startup and rely on them to be correct. By default,
# if zeros are used here, freshwrapper will select minimal width and
# height across all monitors.
fullscreen_width = 0
fullscreen_height = 0

# Enables DNS query case randomization to partially protect against DNS
# poisoning attacks. It was reported that some Mikrotik routers do not
# support this trick. Set parameter to 0 if you have an affected model
randomize_dns_case = 0

# scaling factor (floating point value) used to convert screen pixels
# to device independent pixels. You may need it for displays with
# high DPI
device_scale = 1

# method org.freedesktop.ScreenSaver.SimulateUserActivity() in KDE 5 seems
# to have no effect unless GetSessionIdleTime() called afterwards. Set
# parameter to 1 to call latter
quirk_plasma5_screensaver = 0

# whenever to use windowed plugin mode
enable_windowed_mode = 1

# whenever XEmbed used in windowed mode (if browser advertises its support)
enable_xembed = 1

# if set to 1, fullscreen window will be kept always above browser, and hidden
# from taskbar and pager
tie_fullscreen_window_to_browser = 1

而後把它軟連接到配置目錄:
ln -s /home/eechen/apps/firefox/flash/freshwrapper.conf /home/eechen/.config/freshwrapper.conf
下載cubes_stage3d來對比下Chrome和Firefox各自使用PepperFlash的Stage3D硬件加速性能:
http://airtightinteractive.com/demos/flash/stage3d/cubes/cubes_stage3d.zip
分別用Firefox和Chrome訪問cubes_stage3d/bin-release/index.html,在個人電腦(i5-3230M,無獨顯,分辨率1366x768,Ubuntu14.04)上:
100個立方體,Chrome達到60FPS,CPU空閒率爲89%,穩定.
100個立方體,Firefox達到58FPS,CPU空閒率爲85%,有時候會出現閃爍.

最後,說一下Opera.基於Chrome39的Opera26是首個支持Linux的穩定版本,Opera能夠自動加載Chrome的Pepper Flash Player來提供Flash支持:
http://dl-desktop.oupeng.com/pub/opera/desktop/31.0.1889.99/linux/opera-stable_31.0.1889.99_amd64.deb
Opera裏訪問about://flags啓用#ignore-gpu-blacklist便可讓Flash支持Stage3D硬件加速.linux

相關文章
相關標籤/搜索