Raspberry Pi4/400 DMX MEDIA SERVER PROJECT

Wanting to have the ability to be able to project logos and loops to match lighting scenes without too much expenditure for Charity Events, I opted for a Raspberry Pi, and after a lot of trawling about the internet for help and advice, I came up with the following solution, which I have recently updated.

 

Simple Media Server for the Raspberry Pi4/400 driven by WiFI, controlled by Freestyler DMX (http://www.freestylerdmx.be/) using sACN E1.31. OLA has been installed (https://www.openlighting.org/ola/), and using OMXplayer under dbus control.

The Pi acts as a simple Video Media server that can store 254 HD 1920x1080 H264 mp4 Video loops located in the home/pi/Videos directory. They are named 1.mp4,2.mp4, 3.mp4 etc named sequentially. Video 0.mp4 is black.

Video 1.mp4 is selected by DMX level 1 on DMX channel 1 on Pi, thus DMX level 2 selects 2.mp2 and so on upto 254.mp4. DMX value 255 provides a park DMX level with no action. DMX level 0 loads a black mp4 loop.

Due to the nature of the DMX selection channel recalling loops in steps i.e. DMX level 1 calls loop 1, DMX level 2 calls loop2, and as it is the Pi performing the mix, which can be up to several seconds long, this transition needs to complete before a new DMX level is set. Consequently the Pi is not ideally suitable for a Lighting Desk using Faders (keypad entry to a DMX level is ok). The DMX level needs to step as a cut to next DMX selection level, and sequences must be programmed as cuts for the Pi, which is possible in Freestyler ( and also QLC+). However there is a built in level of protection on DMX select, as the selection interval drops, the mix rate on the Pi is dynamically reduced to a faster mix and then a cut, this is restored to the original value after the selection interval has returned to more than a few seconds

I have built in a layer of protection with a section of the load script which checks running OMXplayer process and closes all not required.

It can also be driven from the DMX Console in the remote OLA web interface from a PC on the same network as the Pi without any DMX software.

OLA allows selection of different input plugins to choose the received DMX input. Consequently, it is also possible to configure this to the Pi’s ethernet for Artnet input. I also use a DMX King Micro USB as a DMX input, which when used with a Wireless DMX system allows extended cable free range from the Pi.

I have tested these on both an RPI4 and RPI400, I had to change the GPU memory setting to at least 128MB.

This project uses OMXplayer which has sadly been depreciated from the latest Bullseye version of Raspberry OS, and the images use the Legacy Version.

If you would like a copy email me at : d.lites.uk@gmail.com

 

I created a profiles for for Freestyler with a set off Macros . There is also a profile for QLC+

Information on how it works:

Using my second DMX Universe in Freestyler DMX as sACN E1.31 and using a Raspberry Pi4/400 with Raspbian Legacy OS, either connecting via WiFi (or Ethernet using Artnet).

Installing OLA ( Open Lighting Architecture www.openlighting.org ), and using OLA trigger to run various bash scripts. Using  modified dbus control scripts for different users: pi, root. (https://github.com/popcornmix/omxplayer/blob/master/dbuscontrol.sh ) to adjust running processes of Omxplayer (https://github.com/popcornmix/omxplayer).

OLA Trigger (https://www.openlighting.org/ola/advanced-topics/ola-dmx-trigger/) calls bash scripts and saves variables to the tmp (located in RAM) directory for use in other scripts.

For each layer two users are used to toggle between instances of OMXplayer, the live user’s OMXplayer is tracked by a variable. On selection of a new clip, the script checks for the existence of the clip, and if it doesn’t exist, exits the script without action. Otherwise a sub script starts an new instance of OMXplayer for the other user. For safety it kills any previous instance for that user, loads it on a layer below the running OMXplayer, sets Alpha variables. It then waits using its dbuscontrol script for the status to change to playing, before returning to main script. There is an intrinsic delay in OMXplayer on loading clips depending on file size, and this method introduces minimum delay so as not to catch OMXplayer background on load.

The mix method depends on dimmer setting. Above DMX level 244 the incoming clip is set to dimmer level, and the original clip, on a layer above it, has its alpha reduced in a series of steps at a rate derived from the rate DMX level setting. When the DMX level is below 244 the incoming OMXplayer’s alpha is set to 1 and then incremented up to Dimmer level, as the outgoing is decremeted down to zero. If the dimmer level is below 128 there is some scaling on the rate to provide more steps to keep the rate about the same. Once the mix/cut has finished the original OMXplayer process is killed, and the new one moved to top layer.

As the two instances alpha levels drop towards zero they become transparent, showing the Pi Desktop. On account of this the Pi desktop wallpaper is used as a background. The Pi taskbar is set to autohide, unclutter has been installed to hide the mouse after 2 seconds. On initialisation of the Media Server, xdotool is used to minimise any open windows to taskbar, and set mouse to coordinates 1920,1080 so taskbar hides. Pcmanfm is used to set desktop wallpaper to 0.png (a black graphic). On close of media server wallpaper is set to 255.png ( which is default wallpaper).

Video clips are named sequentially 1.mp4,2.mp4,3.mp4 etc in the home/pi/Videos folder.This allows selection of 254 HD 1920x1080 mp4 ( H264-AVC) Video Loops.

These can be uploaded via Putty (www.putty.org), a headless operation can be obtained via VNC (www.realvnc.com/). The Pi can be set to auto start with black looping on its HDMI output.