Libreelec – James Batchelor https://james-batchelor.com Useful I.T & VoIP Ramblings Sat, 17 Aug 2019 15:41:26 +0000 en-US hourly 1 https://wordpress.org/?v=6.8.5 https://james-batchelor.com/wp-content/uploads/2025/05/cropped-cropped-logo-jb-202505-32x32.png Libreelec – James Batchelor https://james-batchelor.com 32 32 LibreElec – Pi Camera Mjpeg Streaming https://james-batchelor.com/index.php/2019/08/10/libreelec-pi-camera-mjpeg-streaming/ https://james-batchelor.com/index.php/2019/08/10/libreelec-pi-camera-mjpeg-streaming/#comments Sat, 10 Aug 2019 19:20:39 +0000 http://james-batchelor.com/?p=623 Continue reading "LibreElec – Pi Camera Mjpeg Streaming"]]> Following the setup of a Cent OS CCTV server, I’ve been using Raspberry Pi’s as video sources. But what if there was a Raspberry Pi in perfect situ for a CCTV camera, but was already in use as a media player?

A Linux system has always had the impression that it is versatile, so this should be an achievable task. A barrier would be how to get this done with the operating system installed, in this case it is LibreElec, an OS with the tagline “Just enough OS for Kodi”. Therefore, it would be more of a challenge than a usual Debian install.

The team at LibreElec saw this type of thing coming, and included the Docker service as a Kodi addon to allow the curious tinkerer to add more than Kodi to a Pi.

If you have the LibreElec based Pi in the opportune placement to add a camera, here is how to add Mjpeg streaming capabilities…

Add the Addons

Via Kodi on the screen, goto:

Addons --> Install from Repositories --> Services

Then install the two addons required:

RaspiTools
Docker

CLI Access

To setup Docker and its container (the Mjpeg streamer) requires Command Line Interface (CLI) access to the Pi, if not already enabled during setup enable it via Kodi by navigating to:

Settings --> LibreElec --> Services --> SSH

Mjpeg streamer

The M-Jpeg-streamer is a well-used Linux library, and have chosen the Open-Horizon version of a Docker image for this task.

Log in to the Pi via SSH and run the following:

docker pull openhorizon/mjpg-streamer-pi3:latest

Follow the prompts and be prepared to wait as the Docker image builds.

When complete, start the Docker container with:

docker run --restart=always -it -d --privileged -p 8081:8080
openhorizon/mjpg-streamer-pi3 ./mjpg_streamer -o "output_http.so -w
./www" -i "input_raspicam.so -x 1280 -y 720 -fps 10 -ex night"

This code explained:

docker run: start a Docker container
–restart=always: Restarts a container if the system is restarted
-it: allocate a pseudo-TTY for debugging and to stop it.
-d: Run in background, enables CLI to exit without stopping container.
–privileged: Give privileges that allows access to the camera.
-p 8081:8080: Translate streaming port from 8080 to 8081, as not to conflict with Kodi.
openhorizon/mjpg-streamer-pi3 ./mjpg_streamer: name of Docker image.
-o “output_http.so -w ./www”: internal reference.
-i “input_raspicam.so -x 1280 -y 720 -fps 10 -ex night”: Camera settings, set resolution, frames per second and Pi camera filters.

Run

The Docker container should now be running, check this by entering this in the CLI:

docker ps -a

To show running containers.

Now you can access the web GUI by visiting http://ip_address:8081 to test.

From here it can be added as a Network Camera to MotionEye.

Configuration

During setup its important to consider the hardware it running on. This was running on a Wi-Fi only Raspberry Pi 3A+, while it’s processing power was more than adequate for my initial setup of 1920×1080@20fps this saturated the network connection, leaving no bandwidth left to stream the media LibreElec was designed for. The reduction to 1280×720@10fps reduced the active bandwidth enough as not to interrupt the media players primary function.

]]>
https://james-batchelor.com/index.php/2019/08/10/libreelec-pi-camera-mjpeg-streaming/feed/ 1
OSMC on Pi 3A+ Problems – Switch to LibreELEC https://james-batchelor.com/index.php/2019/05/22/osmc-on-pi-3a-problems-switch-to-libreelec/ https://james-batchelor.com/index.php/2019/05/22/osmc-on-pi-3a-problems-switch-to-libreelec/#comments Wed, 22 May 2019 19:08:49 +0000 http://james-batchelor.com/?p=591 Continue reading "OSMC on Pi 3A+ Problems – Switch to LibreELEC"]]> For years, since it was XBMC on the original Pi I have been using OSMC as my Raspberry Pi media player. And following on from a whole home Pi redeployment for to include a CCTV system the latest installment was to install OSMC to two Raspberry Pi 3A+.

Raspberry Pi 3A+

Raspberry Pi 3A+

The Pi 3A+ plus is the cut down little brother to the latest 3B+ much akin to the original Pi B and A models. Both have the same quad-core ARM v8 processor, Broadcom Videocore-IV GPU and importantly the 2.4GHz and 5GHz 802.11b/g/n/ac Wi-Fi module for faster and stable WIFI out of the box. What’s cut down is the RAM, halved at 512MB, USB ports are reduced to one due to the removal of the onboard USB and gone is the ethernet port.

All the power without the ports make its perfect as a media player, all that’s needed to connect is the HDMI, with remote control provided via a CEC equipped TV.

The issue with OSMC

Here are the issues I experienced with OSMC on the Pi3A+, this is in no way a snarl at the developers who are doing an amazing job. I believe the 3 A+ is still a new and niche model so it’s understandable that development is slow for this product. I’m just hoping this will eventually be looked into and resolved, and putting it out there in case others have the same issue. Performance on the 3B+ is still exceptional.

From boot, selecting a 720p file (via Samba and h264 encoding) is fine, with subsequent auto-play files playing with no issues. However, with the next selection the issues start, selecting a file loads it but doesn’t play, having to go to the main menu and selecting Full-Screen to play the file. But then it buffers constantly. On the third play this workaround fails, and selecting Full-Screen results in a black screen.

In addition, even from boot any 1080p content fails to play with a black screen in its place, and playing h265 encoded files results in an immediate system crash.

480p content remains unaffected and plays perfectly.

LibreELEC to the rescue

Without resorting to buying a 3 B+, your media experience can still be made on 3 A+ by using LibreELEC, an alternative to OSMC that has the same goal of getting Kodi on the Raspberry Pi.

This distro gives the exact same experience, assuming you use the Kodi default Confluence skin and not the custom default on OSMC.

Installation is just as easy with installer package available on Windows, however its not as refined as the OSMC equivalent, first there is no option to pre-configure the wireless settings needed on the Pi A models, but is included in the setup wizard when booting up on your TV.

Second, and the point if this post, the Windows installer as problems overwriting SD cards with an existing file system, and gives a write error before the program hangs.

To overcome this, the SD card needs to be purged of its previous partitions:

In a File Explorer window, right click This PC and click Management

In Computer Management, click on Disk Manager

Identify the SD card in the lower graphic, the best way to achieve this is to match the drive capacity of the SD card, in this case it is the 8GB drive.

Right click every allocated partition, identified by the upper blue band, and click delete volume.

When complete, the drive will look like this.

From here, re-run the installer and choose the drive that matches the SD card capacity, the installer should now write to the card with no issues.

LibreELEC in action

If you are moving from Pi 2/3 B model to a 3A+ then it’s business as normal, 1080p h264 files, and up to 720p h265 files play without issues. Although those hoping for 1080p h265 encoded playback will be eternally disappointed given that this exceeds the Pi’s hardware capability.

One curious note for a UK resident, there is no regional setting for the United Kingdom, so have to resort in using an Isle of Man profile to get the correct time, and manually setting the region variables.

]]>
https://james-batchelor.com/index.php/2019/05/22/osmc-on-pi-3a-problems-switch-to-libreelec/feed/ 1