Note: as @clibois mentioned below, due to the DRM Netflix uses, all decoding has to be done in CPU, making it somewhat choppy.
Note 2: Even the RPi 3 suffers from these CPU limitations. There is the potentially risky option of overclocking your RPi 3, but I haven't tried this.
If you manage to get smooth playback, please contact me, or post your solution here
UPDATE: I can no longer get this method to work. I have tried using Chromium v47, and v48, and both result in Netflix error "Oops, something went wrong" / C7053-1807, for which I can find no description online. If you manage to get things up and running, please contact me!
These steps are based on OSMC, which in turn is based on a Debian Jessie + Kodi install, so should be the same for any Debian based setup.
For the quickest setup, install the latest OSMC
We'll use this directory to store our temporary downloads, etc.
mkdir netflix
cd netflix
Note: for all the commands below, I suggest switching into Super User mode to avoid typing sudo before every command:
sudo su
Let's start by making sure everything is up to date:
apt-get update
apt-get upgrade
This section is inspired by the instructions here
We need to grab Chromium v47 - v48 has a bug with netflix, and v49+ doesn't work on our Debian Jessie system.
- Visit the page for chromium-browser
- Scroll down to "The Vivid Vervet" and click that heading.
- Scroll down to the "Releases in Ubuntu" heading
- Find the highest version that starts with
47
(note: v48 does not work). - Click the arrow next to it.
- Look for the Builds header on the right
- Click the "armhf" option.
- On the following page, scroll to the bottom to find the list of links under Built Files.
For each of the files that look like:
chromium-browser_*.deb
chromium-codecs-ffmpeg-extra_*.deb
(Note: You do not need the *-dbg*.deb
or *-chromedriver*.deb
versions of the packages)
For example, I grabbed these files:
chromium-browser_47.0.2526.106-0ubuntu0.15.04.1.1192_armhf.deb
chromium-codecs-ffmpeg-extra_47.0.2526.106-0ubuntu0.15.04.1.1192_armhf.deb
We need to download them on the RPi:
wget -c https://launchpad.net/...
Next, install the ffmpeg
deb with:
dpkg -i chromium-codecs*.deb
Now, install the dependencies:
apt-get install `dpkg -I chromium-browser*.deb | grep " Depends" | sed "s/^ Depends: //" | sed "s/ ([^)]\+)//g" | sed "s/ | [^ ]\+//g" | sed "s/,//g"`
This command essentially searches for the dependencies of the chromium-browser*.deb
package, then installs them all.
If you get any errors such as:
avr-libc : Depends: gcc-avr (>= 1:4.3.4) but it is not going to be installed
Then you need to run the following commands (This will fix all the broken dependencies, and re-configure all the previously broken packages.):
apt-get clean
apt-get install -f
dpkg --configure -a
Then re-run command above to install the dependencies.
I also had to install libexif12
& lsb-release
to get chromium running:
apt-get install libexif12 lsb-release
Now, install chromium:
dpkg -i chromium-browser*.deb
Set chromium to run correctly; edit the file /etc/chromium-browser/default
to be (You can use vi
or nano
to edit the file):
CHROMIUM_FLAGS="-password-store=detect -user-data-dir"
Finally, setup a symlink so plugins, etc, that are searching for chrome will find chromium instead:
cd /usr/bin
ln -s chromium-browser chrome-browser
ln -s chromium-browser chrome
cd -
In order to have Chrome output its audio to HDMI, we need to setup the ALSA drivers:
apt-get install alsa-utils
modprobe snd_bcm2835
amixer cset numid=3 2
(the 2
at the end is to specify HDMI. Use 1
for headphones)
For Chrome to take advantage of the full screen, and to use the mouse, we need a window environment of some kind. Since OSMC doesn't come with one by default, let's install matchbox
now:
apt-get install xorg xinit matchbox
If you're still root (because you ran sudo su
as mentioned at the top), drop to your normal user now:
exit
Create a new file /home/osmc/.xinitrc
(using vi
or nano
) with the contents:
#!/bin/bash
# ~/.xinitrc
xset -dpms
xset s off
xset s noblank
matchbox-window-manager &
chromium-browser http://www.netflix.com
kill $!
Make it executable with:
chmod a+x /home/osmc/.xinitrc
And now give permission to start up the script by editing the file /etc/X11/Xwrapper.config
(may require being root again), and changing the allowed_users
line to be:
allowed_users=anybody
Then to test, ensure you can see OSMC up and running on whatever display you have the rPi connected to, make sure you're not root, then run the following command:
sudo systemctl stop mediacenter && xinit /home/osmc/.xinitrc && sudo systemctl start mediacenter
This will shut-down OSMC and pop up Chromium. To go back to OSMC, use the Chromium shortcut to close the current window: <ctrl>-w
(or if you have a mouse, simply click the "x" to close the window).
Note: The first time you run the above command it may display a black screen for 30-60 seconds before displaying Chromium. Subsequent executions should show Chromium within 1-2 seconds of OSMC shutting down.
Note: If you see errors such as [1:1:0326/155000:ERROR:image_metadata_extractor.cc(112)] Couldn't load libexif.
, then you can install the missing dependency like so:
sudo apt-get install libexif12
Netflix requires libnss3 (already installed as a dependency of chromium-*.deb
above), and the widevine DRM plugin.
Prior to Chromium v44, widevine would only work with official Google Chrome (which doesn't work on the RPi's ARM-based CPU). However, from 44 onwards, a patch has been added to allow the widevine plugin to work.
Thanks to @ who managed to get it working!
Thanks to Google's ARM ChromeOS builds, we can get a working copy of the widevine plugin to run on our RPi.
Still on the RPi:
wget https://dl.google.com/dl/edgedl/chromeos/recovery/chromeos_7077.134.0_daisy-skate_recovery_stable-channel_skate-mp.bin.zip
unzip chromeos*.zip
Then we want to get access to the files stored on that ChromeOS image:
sudo apt-get install kpartx
sudo kpartx -avs chromeos*.bin
You will see the following output where it has created a series of partitions, representing the Chromebook disk image:
add map loop0p1 (254:0): 0 28672 linear /dev/loop0 2928640
add map loop0p2 (254:1): 0 32768 linear /dev/loop0 20480
add map loop0p3 (254:2): 0 2641920 linear /dev/loop0 286720
add map ...
We're interested in the one ending in p3
, which will now exist at /dev/mapper/loop0p3
. Let's mount it:
sudo mkdir -p /media/osmc/chromeos
sudo mount -t ext2 /dev/mapper/loop0p3 -o ro /media/osmc/chromeos/
Now move into the root of that partition and search for the widevine plugins:
cd /media/osmc/chromeos/
find ./ -type f -name "libwidevine*"
The two files you want are named libwidevinecdm.so
and libwidevinecdmadapter.so
(ignore any "Permission denied" errors).
sudo cp <path_to_files>/libwidevine*.so /usr/lib/chromium-browser/
(replace <path_to_files>
with the location returned from the find
command above)
Before we continue, we need a way to control Chromium. Let's do it with our phone!
Grab the app Home Remote Control.
Install xdotool
on the RPi:
apt-get install xdotool
In Home Remote Control, select "Linux only" and enter your RPi's IP address, as well as the user / pass combo to log into SSH (default is: osmc
/osmc
).
Fire up Chromium again:
sudo systemctl stop mediacenter && xinit /home/osmc/.xinitrc && sudo systemctl start mediacenter
Once Chromium is loaded up, install the "User Agent Switcher" extension from the Play Store, then add the following user agent as "Chrome":
Mozilla/5.0 (X11; CrOS armv7l 6946.63.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36
In the "User Agent Switcher" tool, set that as a permanent override for netflix.com
.
Reload netflix.com, and you should now be able to start streaming!
Shutdown your RPi:
sudo shutdown now
Then start it up again (this is a cheat's way of unmounting the ChromeOS image).
SSH back into your RPi, then remove the temporary folder we created at the start:
sudo rm -rf /home/osmc/netflix
Thanks for this tutorial. I was succesful to play netflix under OSMC in chromium with this and the chromium versions and libwidevine libraries mentioned in the comments from @buma and @mboel.
However, I do want to use netflix from within kodi and tried to use the flix2kodi addon that @clibois mentioned. To do so, I also installed lxde. Unfortunately, I am not able to switch to the chromium that flix2kodi succefully starts. That is, I hear the sound but do not see the video. Chromium is running, but Kodi stays on top of the display. I tried to plug in a keyboard and do an alt-tab, but this does not work. Apparently, kodi always runs in a fullscreen mode. All the workaround to get windowed mode of kodi do not work. If anybody has a hint to do this, I'd be very grateful.
I'm happy to provide a tutorial then, too.