Raspberry Pi Media Player
Being stuck at home definitely has its advantages, one is that I finally got to mess with my Raspberry Pi's a little.. What I've wanted for quite a while is to be able to trigger video/audio via DMX/E1.31/Artnet.. And now I have the start of solution.
- Raspberry Pi model B, 4GB Class 4 SD card ( I'm using a SanDisk one )..
- Used Raspbian Operating System. ( Raspbian is Debian Linux built for Raspberry Pi ).. I'm sure you can use something else if you want
- Installed Open Lighting Architecture ( www.opendmx.net )
Media playback is via omxplayer ( its part of the Raspbian build );
To play a file, it's pretty simple.. You'll obviously need to copy a file to the machine or be able to access it via a network.
There are some other options like -o hdmi to play audio via the hdmi, etc, check the man pages
omxplayer accepts some basic transport controls via keypress's... ie 'p' for pause.. Not much use for control via DMX... so..
Set up a FIFO:
Start up omxplayer with a redirect
omxplayer file.mp4 < /tmp/cmd it will just sit there;
then via the fifo send it some key presses
echo -n p > /tmp/cmd
this sends it a pause, but what it will do is load the file to memory and be ready to play.
send it another 'p' and it will play
echo -n p >/tmp/cmd
OK, so that's not DMX controlled.. that's where ola_trigger comes in.
OLA trigger lets you run arbitrary commands based on the values of DMX data coming in.. OLA_DMX_Trigger
Unfortunately you can't use a redirect in the OLA config file, so what I do is create a small shell script, and make the action in the OLA trigger config, that shell script..
Config file looks like this
1 128-255 mycommands
Shell script is really simple and looks like this;
echo -n p >/tmp/cmd
You also of course need to have configured the universes in OLA.. Then from your favourite sequencer you can send it DMX commands and fire off your videos in sync.. The methods can be extended of course to be able to select multiple videos and the likes..
Still a work in progress, and certainly the above is likely to be confusing and definitely incomplete, but it actually works, and you have a HD 1080p capable player for $35 that you can control via DMX or e1.31