In this tutorial, we will be showing you how to get Netflix up and running on your Raspberry Pi.
Netflix has been one of the hardest things to get working on the Raspberry Pi thanks to its reliance on a DRM (Digital Rights Management) that tends only to be distributed for closed platforms.
With this guide, we will be making use of a plugin for the popular media center Kodi. We found this plugin combined with Kodi is one of the best ways of getting Netflix to run on your Raspberry Pi.
Alternatively you can run Netflix within the Chromium web browser, all you need to do is install the Widevine DRM package to your Raspberry Pi.
Getting Netflix to run on your Raspberry Pi requires a few different steps as the software will need to obtain a version of the DRM library so that you can stream videos.
You can make use of operating systems that package Kodi, such as OSMC, as these same steps should work as long as you have terminal access.
Throughout this tutorial we will be making use of the Raspbian operating system.
Equipment List
Here is a list of all the equipment that we recommend you have for completing this Raspberry Pi Netflix tutorial.
Recommended
- Raspberry Pi ( Amazon ) 2 or Newer
- Micro SD Card ( Amazon ) 16GB+ recommended
- Power Supply ( Amazon )
- USB Keyboard ( Amazon )
- USB Mouse ( Amazon )
- HDMI Cable ( Amazon )
- Ethernet Cable ( Amazon ) or Wi-Fi ( Amazon )
Optional
- Raspberry Pi Case ( Amazon )
Preparing for Netflix on the Raspberry Pi
1. Before we can get Netflix working on the Raspberry Pi, we will have to do a few things.
The first thing we should do is update all the packages already installed on your Pi.
Doing this ensures that any out of date packages won’t end up breaking the tutorial.
To update all your packages, go ahead, and run the following two commands.
sudo apt update
sudo apt upgrade
2. Once the update process has completed, we can now go ahead and install Kodi to the Raspberry Pi.
The reason that we are using Kodi is that it is currently the most reliable way of accessing Netflix on the Raspberry Pi.
Web browser methods for accessing Netflix appear to get broken often and can be painful to set up and maintain. Kodi is also pretty well optimized for the Raspberry Pi.
If you are running a distribution like OSMC, you can skip to the next step of this guide as you will have Kodi installed already.
To install Kodi and all the packages we require, run the following command.
sudo apt install kodi kodi-peripheral-joystick kodi-pvr-iptvsimple kodi-inputstream-adaptive kodi-inputstream-rtmp
You will see that we are installing several other packages alongside Kodi. These extra packages are required for the Kodi Netflix plugin to function correctly on our Raspberry Pi.
3. We need to now install some extra packages to go alongside our Kodi installation.
These packages contain the Python package manager “pip” as well as some extras that are needed for us to run the Kodi Netflix Plugin.
Run the following command to install the last few packages we require.
sudo apt install build-essential python3-pip python3-dev python3-setuptools python3-wheel libffi-dev libssl-dev libnss3
4. Next, we will install the Python packages that are required by the Netflix plugin for Kodi.
We can install these Python packages to our Pi by making use of the pip
package manager.
Use the follows two commands below to install all the required Python packages.
sudo pip3 install pycryptodomex win_inet_pton --break-system-packages
5. With all the required packages now installed, there is one last thing we need to do.
We need to download the CastagnaIT repository. This repository will allow us to install the Netflix plugin for Kodi and have it automatically updated.
We can download the latest version of the repository directly from the project’s GitHub by running the following command.
wget https://raw.githubusercontent.com/CastagnaIT/repository.castagnait/kodi/repository.castagnait-2.0.1.zip
Once the repository plugin has finished downloading, you can proceed with getting Netflix working on your Raspberry Pi.
Adding the Repository for Netflix on Kodi
In this section, we will be showing you how to make use of all the packages we just installed to run Netflix on your Raspberry Pi.
1. The first step is to launch Kodi on your Raspberry Pi.
You can do this by clicking the start menu icon in the top left-hand corner, hovering over “Sound & Video” then clicking “Kodi“.
2. To get started, we will need to change Kodi’s settings to allow unknown sources to be installed. If we don’t change this option, we won’t be able to install the Netflix plugin.
To do this, we need to open up the settings page within Kodi. If you are using the default theme, the button to get to this page is the cog symbol at the top of the sidebar.
3. Within this menu, you need to click “System” in the bottom right-hand corner of the screen.
4. Now that we are in the system settings page we need to go and click “Add-ons” in the side bar.
5. Next, click the toggle for the “Unknown sources” option.
You will get a few warning messages. It is safe to ignore these warnings as long as you are only installing plugins from reputable sources like we are.
Changing this option will allow us to install the repository that we downloaded to our Raspberry Pi in the previous section.
Once you have enabled “Unknown Sources“, press the ESC key to return to the main settings page.
6. Now that we are back on the main settings page, go ahead and click the “Add-ons” menu button.
This button will take us to the Add-ons settings page and allow us to install the CastagnaIT repository from which we can download the Netflix Plugin for our Raspberry Pi.
7. Once in the “Add-ons” settings page, click the “Install from zip file” option to continue.
8. With the “Install from zip file” dialog now open, click “Home folder” as that is where we downloaded the repository to.
9. Scroll to the bottom of the next dialog, then double-click the file called “repository.castagnait-2.0.0.zip
” to install the repository.
Now that we have set up the repository, we can proceed to install the Netflix Plugin to our Raspberry Pi and also set up anything else we may need.
Installing the Netflix Plugin to the Pi
1. With the required repository now installed to our Raspberry Pi, we can go ahead and install the Netflix plugin through Kodi’s interface.
Click the “Install from repository” option in the “Add-ons” page to proceed.
2. In this menu, look for the “CastagnaIT Repository” option and select it to open the repository.
3. Now that we are within the CastagnaIT repository, we can now locate and install the Netflix plugin.
To find the Netflix plugin, we need to open the “Video add-ons” category.
4. Open the only entry on this page, the “Netflix” plugin.
We will be able to start the installation process on the next screen.
5. On this screen, click the “Install” button in the bottom right-hand corner.
6. Before the installation begins, you will be asked if you are okay with installing some additional plugins.
As the Netflix plugin relies on all of these to function, the only real option is to select “Ok“.
This process can take a little bit of time as it will need to install these additional add-ons that the Netflix plugin relies on.
7. With the Netflix plugin now installed to the Raspberry Pi, there are a couple more things that we will need to do before we are ready to open it.
To start with, we need to go ahead and enable the “Adaptive Inputstream” plugin.
We can enable this plugin by first going into the “My Add-ons” page.
8. Now that we are in the “My Add-ons” page, we need to go into the “VideoPlayer Inputstream” category.
9. On this screen, go ahead and open up the “InputStream Adaptive” plugin.
This plugin is what the Netflix add-on relies on for streaming video data from the Netflix servers to your Raspberry Pi.
10. On this screen, click the “Enable” button to activate the InputStream Adaptive plugin.
With the InputStream Adaptive plugin now enabled, we can finally go ahead and run the Netflix plugin. Return to the main menu for the next section.
Running Netflix on the Raspberry Pi
1. Back on the main menu, click “Add-ons” (1.) in the sidebar.
Once the “Add-ons” page is open, go ahead and click “Netflix” (2.) to open up the Netflix add-on.
2. The first time you open the Kodi Netflix add-on you will be required to choose a login method.
The easiest method is the “E-Mail/Password
“, this method allows you to enter your email and password to log in.
However, if you have any issues you will need to follow the steps to generating a authentication key for Netflix.
3. Now within the Netflix add-on, go ahead and pick a show that you want to watch.
The first time you watch a show, you will have to run through the process of installing the DRM modules the plugin requires to work.
Without these DRM modules the plugin will not be able to stream the video content from Netflix.
These modules are the same reason web browsers on the Raspberry Pi struggle to deal with Netflix.
4. When notified that Widevine CDM is required, click the “Install Widevine” button to begin the installation process.
5. You will then see another notification stating that you must have at least 3.1GB of free disk space. The reason for this is that the installer has to obtain Widevine CDM from a ChromeOS image.
There are a few legal reasons why we can’t just download the Widevine CDM directly.
Click the “Yes” button to proceed with the installation process.
6. Before your Raspberry Pi can start the process of obtaining the required files to use Netflix, you will need to first agree to a EULA from Google.
Click “I Accept” to agree to the EULA and proceed with the download process.
7. You will now see a message stating that the plugin will need to make use of tools with root permissions to be able to extract the required file from the ChromeOS image.
To proceed with this process, click the “I Accept” button.
8. Now, wait for the download and extraction process to finish. This process can take some time, so now is a good time to grab a cup of coffee.
If it ever appears that the progress bar is stuck, please give the program more time to run, as it has to extract a single file from a large image.
9. Once the Widevine process has completed, you will now be able to watch any videos that you want straight from Netflix to your Raspberry Pi.
Below you can see us running the Netflix exclusive TV show, “The Crown” on our Raspberry Pi.
Using an Authentication Key for Logging into Netflix
It you are having trouble logging into the Netflix addon by using your email and password, there is an alternative solution that we will delve into now.
You will need to have a device with a desktop interface and access to a web browser for these steps.
You can run this script on a different device to your Raspberry Pi as we can copy the key over.
Generating the Netflix Authentication Key on Windows
For starters, we will show you how to retrieve this key when using a Linux system.
To use this method, you will need to be using the Chrome web browser as that’s the only browser the software supports.
This software is written by the Netflix for Kodi team. You can check out the source code of this tool by going to the NFAuthenticationKey repository for Windows.
1. Before we proceed, you need to download the NFAuthentication Key program that contains the program we need from our CDN.
You will find the download link on this page under the “For Windows” header.
After this download, you should have a zip file called “NFAuthenticationKey_Windows_1.0.2.0.zip
” on your device.
2. Extract the folder from within the downloaded archive.
You should find an executable within these folders called “NFAuthenticationKey.exe
“.
Double-click this file to run the program on your device.
3. This program will instruct you on how to use it to generate the required Netflix authentication key.
Before proceeding, you will need to have all windows of Chrome closed.
Once closed, click the “Start” button.
4. Clicking this button will open the Chrome web browser on your device.
Wait till it automatically redirects you to the Netflix login screen. If, for some reason, it doesn’t redirect you, click the “Cancel” button and start again.
Do not manually go to the Netflix website. Manually changing the website will stop the application from being able to retrieve the information it needs.
5. After logging in, the application will quit out of Chrome once it has the data it needs.
It will generate a file called “NFAuthentication.key
“. You will need to copy the contents of this file to your Kodi device.
Within the program, you should also see a message indicating a four-digit PIN (Eg. 1234
). You need to remember this PIN to be able to use your authentication file.
Using Linux to generate your Netflix Auth Key
In this section, we will show you how to get the authentication key that you need to run Netflix on Kodi.
For this to work, you will need to be running a form of Linux where you have access to a Chrome-based web browser.
1. First, make sure you have a Chromium based web browser installed.
On an apt-based operating system, you can run a command like we have below to install Chromium. We also need to install the unzip
package to
On Raspberry Pi OS, the required web-browser comes pre-installed.
sudo apt install chromium-browser
2. Once you have Chromium installed, there are a few other things we need to install.
We need to install Python, its package manager pip, and a few other addons.
sudo apt install build-essential python3-pip python3-dev libffi-dev libssl-dev libnss3
3. Finally, we need to install the two Python packages that we require to run the script to generate the authentication key for Netflix.
pip3 install pycryptodomex
pip3 install websocket-client
4. Finally, we can download the Python script we need directly from the CastagnaIT repository.
We can download this file to the current directory by using wget
within the terminal.
wget https://raw.githubusercontent.com/CastagnaIT/NFAuthenticationKey/linux/NFAuthenticationKey.py
5. With the script downloaded, let us now go ahead and run the Python script.
The script will automatically try to detect where Chrome is installed on your device and run it.
python3 NFAuthenticationKey.py
6. Follow the prompts now displayed within your terminal to generate the required authentication file.
You will be required to login to Netflix to generate the code.
7. Once you have followed the prompts, you should end up with a file called “NFAuthentication.key
” within the same directory as the script.
If you have followed the guide as we have written it, you can use the ls command to find it like below.
ls -l
8. If you have generated this key on a different device to your Raspberry Pi, we will need to copy it over.
To get the contents of the file, you can use nano or the cat command like below.
cat NFAuthentication.key
Logging in to Netflix using the Key in Kodi
Before we proceed, make sure that you have the authentication key copied over to your Kodi device (In our case, this is a Raspberry Pi).
1. The easiest way to do this is to open the file up with a text editor and copy it over SSH to a new file on your device running Kodi.
For example, we can open up a new file to copy the contents over to our Pi with the following command.
nano NFAuthentication.key
2. Once the key has been copied across to the file, save the file by pressing CTRL + X, then Y, followed by the ENTER key.
3. With the Netflix authentication key now in place, launch Kodi on your device.
4. Navigate to the Netflix addon in Kodi and open it.
You should be greeted by the following message asking you to select “E-Mail/Password
” or “Authentication key
” for logging in.
To proceed, select the “Authentication key
” option.
5. In the dialog that pops up, you will need to navigate to where you saved your Netflix Authentication key.
In our case, we saved it to our home directory, so it is relatively easy to find.
Once found, select it and press the ENTER key to proceed.
6. Before the Netflix Kodi addon can use your authentication key, you will need to enter the generated PIN.
Use the interface displayed on the screen to type in your PIN. Once done, either click “Done
” or press the ENTER key.
7. Finally, you will need to enter the password for your account.
Use the provided dialog to enter your password or use the keyboard.
8. You should now be successfully logged in to the Netflix addon for Kodi.
These steps should work for both your Raspberry Pi and any other device Kodi works on.
Hopefully at this point you will now successfully be able to watch Netflix on your Raspberry Pi.
If you have ran into any issues with running Netflix within Kodi, then feel free to drop a comment below.
Hello,
Im trying to install Netflix on om OSMC.
According to your Step 3, I typed the following:
it basically replies back with :
so I changed to :
and result was:
I cannot go forward. any ideas?
Hi Nader,
To me it looks like for some reason the second apt package call attempted to uninstall important packages for OSMCs operation.
I have updated the install guide to now ensure they point to the “Python 3” releases, however, im not entirely sure if that is what went wrong with your install process.
You should be able to run the following command to install the required packages.
Cheers,
Emmet
Thanks, for your manual, but something is wrong here, I suppose with Widevine installation. After doing all the steps on a fresh raspberry pi 4 it always finishes with:
ERROR : AddOnLog: inputstream.adaptive: License update not successful (no keys)
ERROR : AddOnLog: inputstream.adaptive: Initialize failed
SingleSampleDecrypter)
ERROR : CVideoPlayer::OpenInputStream – error opening [plugin://plugin.video.netflix/play….
Windevine reinstallation didn’t help, restarts too…
Hi Zyta,
Sadly, there is nothing we can do from our side to fix this issue. It appears to be an ongoing issue with the Netflix plugin caused by changes made to Netflix’s website.
The developer has been attempting to fix these issues, but they may take some time. In the meantime, they have provided a work around, but you will have to manually install it. https://github.com/CastagnaIT/plugin.video.netflix/files/9708686/plugin.video.netflix_1.19.0%2Bmatrix.1_20221004_t1.zip
You can read more about this issue from their GitHub https://github.com/CastagnaIT/plugin.video.netflix/issues/1444
Cheers,
Emmet
Finally I did it 🙂 I just removed the .kodi directory and started from scratch and it succeeded. It looks just that after the Netflix change, some pieces of software need to get an adequate update. So if it would not be working for someone, wait a couple of days, remove the .kodi and try again. Thank you again for this nice manual
Hello, the manual is great. You probably know about problems reported https://github.com/CastagnaIT/plugin.video.netflix/issues/1425
It seems, that it may be problematic to get update on Kodi 18.x. Have you any hints on installing Kodi 19.x on our Raspberries?
Hi Afzer,
I see thats CastagnaIT has now published a new version that is meant to fix the issues.
If you are running Raspberry Pi OS Bullseye you should automatically get Kodi 19.x installed directly from the repository.
Cheers,
Emmet
Hi, this is a great and very detailed tutorial, thank you! I followed all the steps on a RPi 3b, with a fresh and updated OSMC install. First of all, the URI o the repo zip in the article is still bogus, it downloads a HTML file (as .zip), and fails to install in KODI.
I worked that around anyway, and got the plugin installed. Now when I navigate to it (Main menu => Vides => Video addons => Netflix), it puts on a dark overlay with a spinning OSMC logo in the middle, stays like that for a while, and then trows me back to the plugin list. What may be wrong?
Hi Mortee,
Thank you for letting us know the issue about the repository download link not working. I have hopefully corrected it now.
I’m not entirely sure what could be going wrong there. From memory OSMC includes a full operating system so you should be able to install all of the required packages to run the addon.
Cheers,
Emmet
this step appears to be dead now–
wget https://github.com/castagnait/repository.castagnait/raw/master/repository.castagnait-1.0.1.zip
Hi Rylan,
Thank you for mentioning this. I have updated the tutorial so it now points to the newer repository file.
Cheers,
Emmet
Hey, problem is fixed. It was exactly what I wrote. After using older widevine everything works fine. 🙂
Thank you! The tutorial worked perfectly. It works just fine on my RPi-4 with 4GB ram running Raspbian Buster (2021-01-11-raspios-buster-armhf-full). Brilliant!
George
Nice tutorial, everything works but audio. It doesn’t seem to matter what I select in the Kodi audio settings. Audio through Chromium works fine.
Fixed, you might need to select the “default HDMI” instead of “PI: HDMI”.
Thanks , works fine on Pi 4b
Hi. Thankyou so much for this incredible tutorial. I’m having problems with the audio. Can’t seem to make it work. Could you help, please.
I’m using a Pi 4 8Gb with Rasbian OS, neither the jack, nor the bluetooh speaker gets audio using Netflix, but are both ok when streaming youtube, for example.
Thank you for your help.
Tânia
Portugal
Hi Tânia,
Glad that this tutorial has been helpful for you.
It could be that the Kodi software is trying to put audio through the HDMI port instead of the headphone jack or the Bluetooth speakers.
You should be able to control the settings for this by going to
Settings
->System
then looking under theAudio
tab.Within this screen, try changing the “
Audio output device
” to your output device. For example if you want to output audio to the headphone jack try setting this to “Pi Analogue
“.Hopefully this helps with the issues that you are facing.
Cheers,
Emmet
Hi Emmet, great tutorial.
Just tried it on new Rpi 400 for my son and it works great.
Video playback is smooth. Background video during setup in Netflix is lagging, but when in standard play mode, it is smooth. Thanks again.
The file NFAuthenticationKey_Windows_1.0.2.0.zip is flagged as MALWARE by Chrome when I attempt to download it
Hi Irlandos,
For some reason Google has flagged the file which makes it impossible to use that browser to obtain it.
Quickly browsing through the source code it might not like how it’s designed to hook in to the Chrome web browser and control it to go to a certain website.
The software launches chrome with a debug hook enabled then uses web sockets to interact with it. It redirects you to the Netflix website then waits for you to log on. Once you have logged in it takes the cookies generated to produce the key it needs to log you in through the plugin.
The program then encrypts the data, which is why you need the PIN that is generated to be bale to use the authentication key within the Netflix for Kodi plugin.
Unless something sinister is being inserted from the available code there isn’t anything dodgy from what my eye can see, I have also used the program myself for when I tested and wrote up this tutorial.
As an alternative you can always use your Raspberry Pi and install Raspbian with the desktop and follow the Linux steps. This uses a python script version of the Windows program to do the same steps as explained beforehand.
Cheers,
Emmet
Hey
Works great on raspberry pi 4.
The password must be typed slowly or ignores all characters.
Perttiov
Thanks to this great tutorial I managed to install Kodi and the plugin for watching Netflix. Unfortunately at the moment the plugin has a problem which is that even if you input your credentials for some reason it returns the message that login is invalid. I went to their github and they are aware of the problem and there is a workaround, but I think I didn’t install it correctly or something…
The workaround is login with an autentification key. I followed the instructions in the webpage https://github.com/CastagnaIT/plugin.video.netflix/wiki/Login-with-Authentication-key but at the step where I need to run the script I get the error “No such file or directory”
So basically I’m stuck on login in for netflix and it seems I must use autentification key. I really hope you can add that part to this tutorial.
Hi Erick,
Thank you for pointing out about the recent changes to the Netflix for Kodi plugin.
We have gone ahead and added a new section that explains how to generate the required authentication key that the plugin wants.
Let us know if you still run into issues with this.
Cheers,
Emmet
I agree that this a very good tutorial. I have gotten as far as step 5 to generate the auth code. In the term window, I type in python NFAu etc and hit enter, I get a disclaimer: this script and code etc, press ENTER to accept. When I press enter, I get, An error is occurred: unexpected EOF while parsing (, line 0)
Hi Jim,
I’ve adjusted the tutorial to use Python 3 explicitly, it seems to work better with the script despite it meant to support Python 2.
Let me know if the new steps are still causing you issues.
Cheers,
Emmet
Hi ,
This tutorial is the greatest. No one can beat this.
I’m running Kodi on OSMC OS on Pi 3B+. it is working VERY GOOD.
Everything is possible.
Thanks.
Carlos
Portugal
Hi. I’ve followed the steps and indeed I’m able to start streaming my shows.
But the video lags and delays, making it impossible to watch (besides the lag the sound is not sync’ed with the video).
I’m also running a 3B+ with OSMC OS. Have you done any extra step to make it work? It seems like my Pi doesn’t have enough juice to render the image, but my setup is the same as yours.
Thanks in advance
Diogo
Portugal
thanks
Easy and great tutorial!
worked on the First time!
This is Awesome! Was disappointed when chromium didn’t run Netflix and my main reason for a Pi was a cheap streaming service, this is amazing, pitty about no proper title screens like the real Netflix, but hey for the price I paid I can get over that
Hi Emmet,
I tried a couple of Kodi-netflix “guides” found yours is the best.
I’m running Kodi on a lean OS (Raspberry Pi OS Lite) on Pi 3B+. And it is working really smoothly.
Thanks.
Kenyon
Awesome tutorial. Keep up the great work!
Great tutorial! If there’s any update to Kodi, how to update it?
Hi Justin,
To update Kodi from the package repository all you need to do is run the following command.
It will be updated just like any other packages you have installed on your OS.
Cheers,
Emmet