Manage cookies

We use cookies to improve our services. Read more about how we use cookies and how you can refuse them.

The necessary cookies help to make the website work properly.

Anonymous statistical cookies help to understand how visitors use the website.

  • Raspberry Pi
    3 min | 72696

    #Raspberry Pi: Amazon Prime, Netflix, etc. and a DRM solution!

    Raspberry Pi | 3 min | 72696


    It is a rainy day and you have a Raspberry Pi, which is running Raspberry OS (Raspbian), and you think: I can make a media center to watch some movies/series. You configure everything, and then you see something like the next picture, every time that you want to watch Amazon Prime, Netflix, etc. using the Chromium Web Browser:

    Update 2021.04.05: Installing the Widevine DRM package to the Raspberry Pi is a straightforward process, follow the instructions from this tutorial: Raspberry Pi: Amazon Prime, Netflix, Disney, Spotify - a DRM official solution
    Fig. 1: Trying to play Amazon Prime videos on the Raspberry Pi running Raspberry OS.

    You could install Kodi, LibreElec or OSMC, and you'll be able to watch your series or movie without any problem (using some plugins). But, if you still want to use Raspberry OS (Raspbian), I can tell you: There is a solution! This means, your Raspberry Pi can still be a media center running Raspberry OS.

    But first, let me explain the error. This simply happens because of Digital Rights Management (DRM). The Chromium browser on the Raspberry OS doesn't support DRM. However, Chromium supports DRM using Widevine on Chrome OS running on ARM processors. This means, you could flash Chrome OS or Android on the Raspberry Pi, but they are not stable as I would like.

    Update 2020.11.15: I've just updated the solution and now it is working with Chromium >=84.0.4147.141. Earlier browser versions should use an old version of the gist file. To know which version of Chromium you are using, just type /usr/lib/chromium-browser/chromium-browser --version in a Terminal.

    If you want to update your OS, just type the following (after you've saved your important data)
    
    sudo apt-get update
    sudo apt-get upgrade
    

    DRM solution

    Therefore, the solution is to extract the library Widevine (libwidevinecdm.so) from ChromeOS and add it to Raspberry Pi OS. That sounds quite complex, right? But, it isn't at all! To do that, I found this script widevine-flash_armhf.sh, that fetches the latest official recovery image of ChromeOS for ARM, mounts it as a disk, and extracts the Widevine and Flash libraries, saving them in a compressed archive. You won't need the Flash library, but it is also available. The script is used for Vivaldi 2.0. Therefore, I forked and modified it for Chromium.

    Unsupported Browser
    Fig. 2: Unsupported Browser for DRM.
    Supported Browser
    Fig. 3: Supported Browser for DRM (user-agent changed).

    Furthermore, the websites, which need DRM, usually check the user-agent from the browser. The agent Chromium X on Linux is not supported (actually, it is blocked) (Fig. 2). However, Chromium allows you to change the agent by using the argument --user-agent. Therefore, the modified script creates a new file chromium-drm-browser.desktop using the file chromium-browser.desktop and adds the following line to the Exec=chromium-browser:

    --user-agent="Mozilla/5.0 (X11; CrOS armv7l 11895.95.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36"

    and you'll get Fig. 3, when you add that line. The good news is that that browser is supported. :)

    You can check here for the last version of the browsers, and modify the script.

    DIY Instructions

    To add DRM support to Chromium on Raspberry OS, follow these steps:

    1. Download the script on the Raspberry Pi (you could use SSH):

      # Raspberry Pi OS (32bits) / Raspbian
      # check your Chromium version typing:
      /usr/lib/chromium-browser/chromium-browser --version
      
      # for new version of Chromium (>=84)
      wget https://gist.githubusercontent.com/lemariva/0eb4ff4e847700627a5ebb71711c31bf/raw/94314cb2d3c7da7518b220b2785f7bbd69671394/widevine-flash_armhf.sh
      
      # for older version of Chromium (<84) 
      wget https://gist.githubusercontent.com/lemariva/0eb4ff4e847700627a5ebb71711c31bf/raw/499f63eabc823ab564dc08e234ca7397a33bf717/widevine-flash_armhf.sh
      
    2. Change the file type to executable, typing:
      # 32 bits
      chmod +x widevine-flash_armhf.sh
    3. Run the script file, typing:
      # 32 bits
      sudo ./widevine-flash_armhf.sh

      The script needs sudo because it mounts the ChromeOS recovery image as a disk to extract the required files.Then, it copies the library Widevine under /usr/lib/chromium-browser/. It also creates and moves the chromium-drm-browser.desktop file to the /usr/share/applications folder. This folder is where the menu access is located.
      Update 20201115: Then, it creates two folders ${HOME}/.config/chromium-browser/WidevineCdm and /opt/WidevineCdm/_platform_specific/linux_arm. Inside the folder ${HOME}/.config/chromium-browser/WidevineCdm, it writes a file latest-component-updated-widevine-cdm with the location of the library. It moves the manifest.json inside the folder /opt/WidevineCdm, and finally inside /opt/WidevineCdm/_platform_specific/linux_arm, it moves the libwidevinecdm.so file.

      Important: You'll need about +2GB of free space on the microSD to download the recovery image of ChromeOS. After the required files are extracted, the image is deleted, and you get the space back.

    After doing that, you will get two direct accesses to the Chromium Web Browser (see Fig. 4). The Chromium (DRM) Web Browser has

    • Update 20201115: The standard browser shortcut will have DRM support and you can use it to play videos from Netflix, Hulu, HBO, Disney+, Amazon Prime, Spotify, Pandora, and many others (see Fig. 5). You need to close everything and open it again, or just reboot the Rasbperry Pi to be sure.
    • Update 20201206: Some users report that the user-agent modification is needed to play videos under Netflix. I've included the creation of the direct access again.
    Chromium (DRM) Web Browser
    Fig. 4: Direct accesses to Chromium with and without DRM support.
    Supported Browser
    Fig. 5: Playing videos on Amazon Prime
    using Chromium on the Raspberry Pi OS.
    Supported Browser
    Fig. 6: Playing music on Spotify
    using Chromium on the Raspberry Pi OS.

    Hardware Acceleration (Video Decoder)

    Check this article for more information:

    Extra information

    This section is intended for those who want to analyze the script. Google lists the recovery images of ChromeOS in this file:

    https://dl.google.com/dl/edgedl/chromeos/recovery/recovery.conf

    and the selected recovery images are:

    Update: DRM doesn't work with Raspberry Pi OS 64bits. As described here, the Chromium-OS devices use a 32bits (arm) user ABI (Application Binary Interface). On Raspberry Pi OS, the user ABI is 64bits (aarch64), thus the compiled libraries don't load and you'll get following error: `wrong ELF class: ELFCLASS32` while starting Chromium.

    Common Errors / Problems

    Missing HDMI sound

    TomH has posted the following comment and this can be really helpful:

    Missing HDMI sound might be caused by one of the last OS updates. Pls see the screenshot below chapter "PulseAudio" at https://www.raspberrypi.org/blog/new-raspberry-pi-os-release-december-2020/
    After that update "AV Jack" was selected for me. While so easy to fix, it took me quite a while to have HDMI sound back


    Comments

    Noel Sheridan 07.08.2020

    chromium browser 78 seems to be ending. Is there a way to do drm with Chromium 83 which works with 5.4 kernel

    AnthonyD 07.11.2020

    That is a great solution to the DRM problem on Raspberry Pi! How is the video playback quality in Chromium? Do you know if it uses hardware acceleration or just the CPU?

    thek 07.10.2020

    Hi there. I have a question. Netflix works perfect but spotify web does not work. Is there a solution for this. Greetings Thek

    neale 07.15.2020

    Are you getting 4K playback?

    Eric 08.30.2020

    Fantastic explanation, Thankyou, worked very well. :-)

    Tamas 09.05.2020

    Hello there! Thank you for this solution! Unfoertunately, it doesn't work for me. The installation completes seemingly successfully. However, Amazon Prome shows the same error still when i open the "Chromium (DRM) Web browser" from "Internet". Then i checked whatismybrowser, and it detects the new broswer as Chromium not Chrome. Please let me know if you have any suggestion. Thank you, Tamas

    John 09.07.2020

    worked for me, video playback is working sufficiently, but just barely!

    thank you!

    Chris 10.14.2020

    Hi Thank you for this solution! unfortunately it didn't work for me. The installation completes seemingly successfully. However, Amazon Prime shows the same error still when i open the "Chromium (DRM) Web browser" from "Internet". I then checked using whatismybrowser.com, and it detects the new browser as Chromium not Chrome. Are you able to let me know if you have any suggestions. Thanks Chris

    LuHa 10.16.2020

    thanks a bunch! the path in the script should be updated to /usr/lib/chromium-browser

    Chris 10.22.2020

    Yes, I'd already made that change. Still get the error I described earlier :-(

    Stefan 11.05.2020

    The solution was working fine UNTIL I accidentally updated chromium to version 84.0.4147.141. I ran the script again (the most current version from github. Checking chrome://components I can see the "Widevine Content Decryption Module" version 0.0.0.0 (?)

    However Chromium does no longer play Netflix- and Disney+-videos.

    Until there is a solution I will try to reinstall the old Chromium.

    John Meier 11.18.2020

    This did not work for me. I ran the script and it seemed to run successfully, though the files mentioned do not show up in usr/share/applications or usr/lib/chromium-browser directories

    Richard Lewis 11.20.2020

    The browser doesn't work for Netflix after running the script because the lines in your script modifying the desktop config file have been commented out! If I run the chromium-browser command from the terminal with the added -user-agent then it works fine! Here are the lines in your script:

    # Changing user-agent to Chromium
    #cp /usr/share/applications/chromium-browser.desktop .
    #sed 's/Chromium/Chromium (DRM)/g' chromium-browser.desktop > chromium-drm-browser.desktop
    #sed -i 's@Exec=chromium-browser %U@'"Exec=chromium-browser %U $USER_AGENT"'@' chromium-drm-browser.desktop
    #sed -i 's@Exec=chromium-browser@'"Exec=chromium-browser $USER_AGENT"'@' chromium-drm-browser.desktop
    #sed -i 's@Exec=chromium-browser --temp-profile@'"Exec=chromium-browser --temp-profile $USER_AGENT"'@' chromium-drm-browser.desktop 
    #sed -i 's@Exec=chromium-browser --incognito@'"Exec=chromium-browser --incognito $USER_AGENT"'@' chromium-drm-browser.desktop
    #sudo mv chromium-drm-browser.desktop /usr/share/applications/

    Tamas Bodai 11.22.2020

    Hello there. The solution, that i installed a couple of months ago, stopped working. As i rarely use it, i just noticed it today. I'm still on version 78 of Chromium. Whatsmybrowser.org says it's Chromium 78, unlike earlier, saying it's a Chrome. I see there is a very recent update 2020.11.15. However, i do not understand what the following sentence means: "Earlier browser versions should use an old version of the gist file." Where do i find this gist file? What is the download command for step 1. if not what is given? I would also upgrade to Chromium 84, as an alternative solution, but there is no good tutorial that i can quickly find on the web. I don't find this particularly helpful: https://www.raspberrypi.org/forums/viewtopic.php?t=263419 Some guidance would be very helpful. Thanks in advance. Tamas

    KLT 12.14.2020

    First of all, thank you for this guide. It works very well for Amazon Prime and DisneyPlus, but it does not work for Netflix. I've checked the user-agent parameter in the executable and it shows the entry twice. I remove the redundant one and it still does not work for netflix. Any suggestions?