Pi-Based Streaming
Hello again. This writeup is a step to remove google from my life, and a big part of my life includes streaming movies and TV, but one of the issues I (and likely many others have) with chromecast and most streaming sticks is how poor the performance is due to the bloatware. SO this is a process I used to make a minimal streaming box that makes use of a raspberry Pi and a premium streaming service. As a necessary protection, I will not specify which service I use personally, but this process will allow you to quickly stream your favorite movies and shows.
The setup involves using the Kodi media app, which is used as an open source media player usable on every platform and by itself can be used to play media stored on the device (or network storage). The "premium service" I keep alluding to is typically the form of a server, where paying a low fee (~$20 for 6 months of access) allows you to stream from those servers. These services can be accessed through Kodi using an addon called Seren to allow streaming from services such as Premiumize, RealDebrid, and AllDebrid.
To run the Kodi app and addon, I used an old Raspberry Pi 4 Model B, and find that the ethernet connection and 2Gb RAM works well for streaming 1080p media without long loading times or buffering. To guarantee that no bloatware is included on the Pi, I use LibreElec, which is a linux-based "just enough OS" to run the Kodi app. My original setup using an old google chromecast streamed over wi-fi and struggled with loading and continuous streaming, and suffered from the additional bloat chromecast keeps on their devices.
Without further ado, let's get started with flashing raspberry pi with LibreElec. For folks reading this in the far future, my system versions are:
- LibreElec: 12.2.1
- Kodi: 21.3
- Seren: 3.0.62
LibreElec Installation
The first step is to flash the minimal OS onto the Raspberry pi. I used a USB adaptor to write to the SD card, which came with the Pi. I imagine you could use a normal USB drive, if you specify the bootloader to boot from the USB as opposed to the existing SD card on the Pi. I used Debian to flash the OS to the USB, but for Windows/MacOS people, LibreElec has a tool to flash the OS to the drive.
- Download the LibreElec image archive for your model of Pi
- decompress the archive onto a USB drive (or SD card to insert into the Pi) with the following pipeline:
cat LibreELEC-RPiX.aarch64-12.2.1.img.gz | gzip -d | sudo dd of=/dev/sdY status=progress bs=16M
Where you replace X and Y with your image archive and USB device indicators. To briefly explain the command,catlists the files in the archive,gzip -ddecompresses the listed files, and finallyddcopies the decompressed files to output file /dev/sdY, completing with a progress status and bs=16M to improve write speed - Unmount the drive, plug the SD card into the Pi, and boot it up. LibreElec, and therefore Kodi, should install from there.
Seren Installation
From here, everything can be done in Kodi, regardless of the system it's installed on. The process follows from the official install instructions, but summarized below:
- Go to file manager, located within Kodi's settings, and add source
- Click none and type
https://nixgates.github.io/packages, enter whatever name you want, for example Nixgates and click OK - Back at Kodi's home screen, go to the Add-ons menu and Install from zip file
- Select the previously name Nixgates repository and install the repository.nixgates-2.2.0.zip file, which installs the nixgates repositoryto Kodi.
- Returning to the Add-ons menu, now select Install from repository
- Select Nixgates Repo, Video add-ons, and Seren, then install Seren with Install
Premium Cloud Service & Trakt Connection
At this point Seren is installed, but you won't get very far before running into errors whenever you try to stream any media. There are a few things we need to do to get started up streaming.
- Install a provider/scraper to Seren
- Enable and authorize Seren to use your premium cloud service
- Optional: Enable and authorize Seren to access your Trakt.TV account
The provider/scraper searches for valid media links, which the cloud services filter and match link hashes to ones stored on the premium server. My setup uses a4kscrapers which works well with Seren. In addition, we can also link Trakt.TV which is a media streaming tracker. Seren integrates this to track your watched movies and shows, provide suggestions, store watchlists, etc. You can get away without using this service, however, I find it adds a lot of convenience within the Seren add-on.
- Go to Seren's tools menu from Seren's home screen, then navigate to provider tools,manage provider packages, and Install package.
- Install from web location
https://bit.ly/a4kScrapers - Go to Seren settings, either through the side menu (push left on the remote), or selecting tools and Open Settings Menu
- Go to Accounts and enable your premium cloud service account (Premiumize, Real-Debrid, AllDebrid) and authorize that account with however Seren instructs you
- Optional: In the same Accounts menu, authorize Trakt with whatever similar instructions Seren provides you
"Playback failed" Error Fix
If you followed all previous instructions and notice that Seren doesn't recognize any playable media resulting in a Playback failed error, then a more recent version of Seren is required to fix this issue. The update uses a separate repository to install from. Note that installing a previous version of Seren is required in order to install the proper dependencies, so skipping the initial install in this guide is not an option.
- From the Kodi home screen, we're going to return to the File Manager menu accessed through Kodi settings and add another source with Add source
- This time type in
https://bbviking.github.io/and name it appropriately - From the Kodi Add-ons menu, Install from zip and select bbviking (or whatever you named it), and plugin.video.seren-3.0.62.zip
- This installation may take a while so be patient. You can monitor the progress through the Add-ons menu in Kodi settings and going to Currently downloading add-ons. It will hang on 77%, but just let it install while you go touch grass
- Once complete, movies and shows should now be able to stream in the updated app
Kodi & Seren Configuration
Congratulations! through this long and difficult journey, you now have a minimal and efficient streaming box! While you could happily stream from this point, there are some configurations you can do to streamline your streaming experience. For example, setting a default language and subtitle so you don't have to listen to your media in German. Below I highlight some of the settings I have changed on my box to have a nice user experience. All provided options are changes from the default settings.
LibreElec
- Services
- Enable Samba: Off
- Enable SSH: Off
- Enable Bluetooth: Off
Kodi
- Player
- Language
- Preferred audio language: English
- Preferred subtitle language: English
Seren
- General
- Enable search history: On
- Hide Specials: Off
- Metadata & Artwork
- Metadata location: Trakt
- Scraping
- Preferred cloud location: YOURCLOUDSERVICE
- Minimum Movie Resolution: SD
- Minimum TV Shows Resolution: SD
- Playback
- Movie Play Style: Auto Play or Source Select; if you find the automatic stream poorly loads, source select allows you to try different streams
- Episode Play Style: Auto Play or Source Select; if you find the automatic stream poorly loads, source select allows you to try different streams
Streaming Improvements & Outlook
There are quite a few things I need to change with my personal setup, or implement to improve the scope of this streaming system. Some future guides may detail:
- Installing IR remote capability on the Raspberry Pi
- Network attached storage to save media
- Power conservation
Right now I can control the Pi through TV remote using my TV's HDMI CEC (Consumer Electronics Control), but aside from the TV remote feeling bulky and straining my hand compared to my old chromecast remote, it fails to interpret long presses to access context menus within Seren. This can be an issue as you can use these context menus to modify Trakt lists and watch progress, as well as manually select sources if autoplay doesn't work. There are devices out there to receive universal IR, but it may be a fun project to rig my own IR receiver to the Pi and customize remote action that way, especially since LibreElec allows custom remote keybind tables
Some cloud services will allow you to download the media streams to local drives, meaning you can keep the media forever. If I had the budget to improve my home server, I would make heavy use of this feature to store and keep my media.
A consequence of controlling the Pi through the TV is that the power button only turns off the TV and leaves the Pi running. While there are some power conservation options through Kodi system settings, it still would be nice to suspend the Pi when I turn the TV off. I may mess around and update this point later if I find an elegant solution but for now I allow the Pi to run through the day.
Hopefully this guide helps you as much as it will help me in future reinstallations of this wonderful streaming box build. Nowadays with streaming providers constantly controlling what is and isn't inaccessible, this build provides a stable and wide variety of media to stream for a competitive subscription price. If you run into issues, you can try to contact me, but I can't guarantee immediate responses.
Until next time,
Nic