Skip to main content

Raspberry Pi Media Player from SKAARHOJ

This page aims to assist you in getting started with SKAARHOJ's Raspberry Pi-based media player. This isn't a product for sale; It's offered free of charge with no guarantee of fitness for any particular purpose. Under these conditions, you're free to use it as you wish. Internally, we utilize it as a cost-effective solution for playing back video and image content during demonstrations.

model-0.png

Features

The media player is designed to operate on a standard off-the-shelf Raspberry Pi 4 or 5 as a binary application. It utilizes common applications like ffplay, ffmpeg, ffprobe (which are standard on the Pi), as well as VLC and mplayer in certain instances.

Features include:

  • Full-screen playback of video, audio, and image files.
  • Options for looping, exiting, or freezing after playback.
  • Ability to create playlists for videos, audio, or images using VLC.
  • Full-screen display of rtsp streams and webpages.
  • Full-screen webcam viewing.
  • Remote control through a web browser on port 8080, capable of controlling similar devices on the network.
  • Compatibility with SKAARHOJ panels for control via the built-in device core interface.
  • Media accessibility through a simple USB key.
  • Autoplay feature upon startup.
  • Configuration settings stored in a JSON file.
  • Extraction of meta data and thumbnails.

The media player is intended to connect to a screen or video processor system through its HDMI-1 output. 

Web UI

The web UI of the player is depicted in the screenshots below. The first screenshot displays three columns, each representing a player found on the network, identified by distinct IDs and names. The first player (ID: 1) also hosts the web view, although in reality, all players display the same interface. When a new player is added to the network, the existing players will detect it and include it in this web UI.

piplayer2.jpg

Here's a closer look at just one of the players (the host player). The media player automatically generates thumbnails when possible, but also permits you to specify your own file for use as a thumbnail if desired. It extracts relevant metadata from the files and displays this information too. During playback, you will often see a counter indicating the current position of the player.

piplayer1.jpg

Device Core API

The player is equipped with a Device Core API, signifying that panels from SKAARHOJ, specifically those utilizing the Reactor application, will inherently support control over the media player. This integration allows users to seamlessly manage playback, and other functionalities of the media player directly from their SKAARHOJ panels. The Device Core API facilitates a direct communication channel between the media player and the panels, ensuring a smooth and responsive user experience.

Screenshot 2024-04-02 at 07.18.14.png

Incorporating panels like Frame Shot Pro or Frame Shot Uno extends the functionality to include displaying thumbnails of the media files available. This feature enriches the user interface by providing visual cues about the content, enhancing the ease of media selection. Such a capability is especially useful in environments where quick identification of media is crucial, allowing users to efficiently manage and control playback directly from these panels. 

download-(7).jpg

Installation

This guide is applicable to both Raspberry Pi 4 and 5 models, utilizing the Raspberry Pi OS available in either 32-bit or 64-bit versions. Detailed instructions for installation can be found in a separate article focused on Densitron screens. Please refer to that article and follow it up to the section titled 'Preparing the Operating System to run the Densitron screen over USB.' From that point onward, continue with the instructions provided below.

Preparing the Operating System to run the SKAARHOJ Media Player
  • Insert the microSD card into the Raspberry Pi
  • Connect an HDMI monitor to Micro-HDMI plug closest to the USB-C plug on the Pi (HDMI-1)
  • Insert a newly formatted USB key (MS-DOS FAT32) into one of the USB slots of the Pi
  • Connect the Ethernet jack to your network
  • Connect your power supply to boot it up.

You should see it boot up on the HDMI monitor. If you just flashed the memory card, it will automatically reboot a few times before it finally settles with a standard desktop. It's important to stay alert because on the final desktop you will see the DHCP provided IP address shown in the upper right corner. You need that in the next step.

Untitled-1.jpg

Untitled-2.jpg

  • On your computer, open a terminal (such as Putty on Windows) to connect with SSH to the Pi. On a Mac it would look like this:

image.png

  • Here, you need to use the username ("admin" in this case) and password that you selected when customizing the OS earlier. If you have issues with logging in, you may need to attach a mouse and keyboard to your Pi and change password using the UI (Preferences > Raspberry Pi Configuration)
WIndows Server

At the time of writing, the latest Raspberry Pi OS (codenamed "Bookworm") utilizes a display server called Wayland. While Wayland offers its own set of advantages, it is not particularly suited for this media player, primarily because managing screen resolution via the command line can be challenging. The Pi Player requires control over the screen resolution, necessitating a switch to the previous X11 window manager. Fortunately, this is an easy process:

  1. Type "sudo raspi-config" into the terminal.
  2. In the UI that appears, select "Advanced Options", then choose "Wayland".
  3. Here, you'll have the option to select X11 instead of Wayland. Do so and confirm your choice.
  4. Exit the configuration tool and reboot the Pi.

After rebooting, if you execute the command "DISPLAY=:0 xrandr", you should see information similar to the following:

Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 7680 x 7680
HDMI-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 708mm x 398mm
   1920x1080     60.00*+  50.00    50.00    59.94    30.00    25.00    24.00    29.97    23.98  
   1920x1080i    60.00    50.00    59.94  
   1280x720      60.00    50.00    59.94  
HDMI-2 disconnected (normal left inverted right x axis y axis)

This indicates that HDMI-1 is connected to a monitor or other HDMI input which supports a resolution of 1920x1080. This looks promising.

Customizing the Desktop and Hiding the Menu Bar

Next, you might want to connect a keyboard and mouse to customize the desktop. By right-clicking on the desktop, you can remove or change its background image, as well as disable the display of the Trash bin and other icons. Doing so can be advantageous, especially if you prefer a clean desktop appearance when no media is being played.

Additionally, you might find it useful to set the taskbar to auto-hide, so it's not visible by default. This adjustment ensures a more immersive viewing experience by minimizing on-screen distractions. Here's how to auto-hide the taskbar:

sudo nano .config/wf-panel-pi.ini

In this file, add these two lines and save:

autohide=true
autohide_duration=500

Important Notice And Tip

It's important to ensure that a display is connected and powered on when the Raspberry Pi boots up. If not, the window system might fail to accurately detect the available screen resolutions, potentially leaving the HDMI output blank. This requirement can be quite frustrating, but it appears to be a limitation not easy to circumvent. Therefore, it's crucial to be diligent about keeping a display attached and turned on at all times to avoid these issues.

mplayer (for WebCam)

If you want to view Webcams in full screen, please install mplayer:

sudo apt update

sudo apt install mplayer

Static IP address

Another incredibly frustrating thing for a system like Raspberry Pi OS that is supposed to evolve is that setting a static IP address is so difficult. If you have come this far, you may have succeeded it getting it done with DHCP, but some times it's just nice to set a static IP address which means it can be trusted to have it even if on a network without any other gear than the player and your laptop.

Anyway, after much searching I found this command to work:

sudo nmcli connection modify Wired\ connection\ 1 ipv4.method manual ipv4.addresses 192.168.11.22/23 ipv4.gateway 192.168.10.1 ipv4.dns "8.8.8.8, 8.8.4.4"

 

Installing core-skaarhoj-piplayer
  • In the terminal, run the following command to download the SKAARHOJ Media Player:

curl -O https://raw.githubusercontent.com/SKAARHOJ/Support/master/Files/PiPlayer/core-skaarhoj-piplayer.zip
  • Next, we need to extract the archive we have just downloaded:
unzip core-skaarhoj-piplayer.zip
  • Insert an empty USB stick and try to run it:
./core-skaarhoj-piplayer

You should see an output more or less like this:

INFO[0000] core-skaarhoj-piplayer started, version v1.0.0-pre1 (9e3d1a8)   module=main
INFO[0000] Loading config                                module=main
INFO[0000] Set up discovery of other media players on the network  module=main
INFO[0000] mDNS services initialized                     module=main
INFO[0000] Web frontend is available on http://192.168.11.23:8080  module=main
INFO[0000] Connected to XWindows Server                  module=main
INFO[0000] Disabling screen saver                        module=main

    Setting up Auto Start of core-skaarhoj-piplayer:

    It can be started by systemd creating a config file, piplayer.service, in /etc/systemd/system/ with the following contents:

    sudo nano /etc/systemd/system/piplayer.service

    [Unit]
    Description=SKAARHOJ Pi Player

    [Service]
    ExecStart=/home/admin/core-skaarhoj-piplayer
    Restart=always
    User=admin
    Group=admin
    WorkingDirectory=/home/admin

    [Install]
    WantedBy=multi-user.target

    The above config assumes you named your user "admin" and keep the binary in the home directory.

    After creating this file, you must reload systemd and set it to auto start on every boot:

    sudo systemctl daemon-reload

    sudo systemctl enable piplayer.service

    Restart if needed with this:

    sudo systemctl restart piplayer.service

    Check status like this:

    sudo systemctl status piplayer.service

    Follow log messages from the service like this:

    journalctl -u piplayer.service -f

    Installation