UPDATE: Last library re-extracted from ChromeOS on: 9-8-19 — confirmed that DRM works perfectly (ex, Spotify, etc), but as a Netflix solution it does *NOT* currently work with the latest version of Chromium (74.0.3729.157)! This may be due to “stable” having moved to 76, and raspbian still rocking the 74 branch.
The Raspberry Pi 4 model with 4GB of RAM is the first cheap hardware that can provide a real “desktop-like” experience when browsing the web/watching Netflix/etc. However, if you have tried to run Netflix on the Pi, you have quickly entered the disgusting mess that exists around DRM, WideVine (Netflix being one example of something that needs it), and Chromium.
After hours and hours of effort, I finally discovered a quick and elegant solution that lets you use the latest default provided Chromium browser, without having to recompile anything in order to watch any WideVine/DRM (Netflix, Spotify, etc) content.
Background and the DRM Problem
If you are not familiar with this, the short version is that Netflix (and many others, ex: Spotify) use the WideVine “Content Protection System” – aka DRM, and if you want to watch Netflix or something else that uses it, you need to have a WideVine plugin+browse supported integration. Chrome, Firefox, and Safari make it available for x86/amd64 systems, but not for ARM since technically they don’t have ARM builds.
Chromium, the project Chrome is based on, does have an ARM build, but it does not include any DRM support, and technically it does not include widevine support by default (*caveat here, which helps us later)
So long story short, the question becomes “how do you enable DRM/WideVine support in Chromium?”.
It seems there are two main solutions out there: use an old (v51, 55, 56, 60) version of Chromium which has been “patched” with widevine support (kusti8’s version seems to be the most popular one – except since the new Netflix changes, that also does not work), which requires uninstalling the latest Chromium available, installing the old/patched one, and dropping in older widewine plugins; the second option is to use Vivaldi – a proprietary fork of Opera which also has been “sort of patched”, but it still needs a valid libwidevinecdm plugin (see bellow) and it has it’s own issues (and also…it’s Opera…in 2019…who uses Opera?)
After a lot of research and trial and error, I discovered a much more elegant solution – use the extracted ChromeOS (armv7l – yay) binaries and insert them into Chromium + make everything think it’s ChromeOS (user agent)
Netflix/Spotify with the Default Raspberry Pi Chromium Browser
1.) Download the latest extracted ChromeOS libwidevine binary and extract it:
$ sudo su
# cd /usr/lib/chromium-browser
# wget http://blog.vpetkov.net/wp-content/uploads/2019/09/libwidevinecdm.so_.zip
# unzip libwidevinecdm.so_.zip && chmod 755 libwidevinecdm.so
NOTE: You can verify that these are the *official* versions from ChromeOS:
NOTE: UPDATED (Last re-extracted from ChromeOS on: 9-8-19)
2.) Completely QUIT all Chromium windows and re-start it.
Grab the “User-Agent Switcher for Chrome” extension: https://chrome.google.com/webstore/detail/user-agent-switcher-for-c/djflhoibgkdhkhhcedjiklpkjnoahfmg
Right click on the extension, go to “Options” and “Add” the following in the fields:
a.) New User-agent name: Netflix
b.) New User-Agent String: Mozilla/5.0 (X11; CrOS x86_64 11895.95.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36
c.) Group: Chrome
d.) Append: Replace
e.) Indicator Flag: NFX
3.) Open a new tab, select the “NFX” profile (one time) from the User-Agent Switcher, and go to: https://bitmovin.com/demos/drm
You should be able to see the movie on the left. You can now play Netflix, and Spotify
Please note that If you can see the vide on the left, this means the DRM plugin has worked! From this point on, anything that does not work (ex: Netflix sometimes breaks after a browser update) is due to the site specifically filtering User Agents/doing other “tricks”. So for example, if Netflix does not work, Spotify, Hulu, Amazon, HBO, etc will still work. The BitMovin website is the “real” test on wether the DRM plugin has worked.
Solution if you see occasional “screen tearing”
It seems the Pi’s raw CPU frequency is still not powerful enough for decoding 100% of the time. While 97-98% of the time is good enough, you will get the occasional “screen tearing” (https://en.wikipedia.org/wiki/Screen_tearing), especially with scenes with fast motion.
User Tim (credit to him for finding this!) may have found the solution to this:
Ok think i have a fix. Netflix in Chrome will only play 1280 x 720 max (its a known thing) and can be checked by pressing CTRL SHIFT ALT and D when the video is playing in Netflix (for Vid stats).
So as a test i changed my pi screen configuration from 1920 x 1080 to 1280 x 720 (at 59.94 HZ) and netflix plays fine with no tearing. (the tearing was mostly present when the camera pans left to right etc). For some reason my monitor has a 1280 x 720 at 60HZ option but this also gave a little tearing, the 59.94Hz option cures it completely, this works for me and i am happy watching Netflix at 720p
Update to this: It seems Netflix will only play at 720p on Chrome, so by lowing the resolution, it removes tearing in the cases where the monitor is at a higher resolution/60Hz.
Here are the last few OLDER versions in case you need them (note the unique date in the url):