• Raspberry Pi
    3 min | 1057

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

    Raspberry Pi | 3 min | 1057


    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:

    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.

    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 lastest 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
      wget https://gist.githubusercontent.com/lemariva/0eb4ff4e847700627a5ebb71711c31bf/raw/0cab2916e4de65c0c5f780719221fdc052ac0bda/widevine-flash_armhf.sh
      # Raspberry Pi OS (64bits)
      wget https://gist.githubusercontent.com/lemariva/0eb4ff4e847700627a5ebb71711c31bf/raw/0cab2916e4de65c0c5f780719221fdc052ac0bda/widevine-flash_armhf_64.sh
      
    2. Change the file type to executable, typing:
      chmod +x widevine-flash_armhf.sh
    3. Run the script file, typing:
      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. 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 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).

    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.

    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:


    Comments

    Empty