We've launched our new site at www.openlighting.org. This wiki will remain and be updated with more technical information.
Difference between revisions of "Raspberry Pi Media Player"
From wiki.openlighting.org
Peternewman (talk | contribs) m (Peternewman moved page Rasberry PI Media Player to Raspberry Pi Media Player: SPaG) |
Peternewman (talk | contribs) m (SPaG/Formatting) |
||
Line 1: | Line 1: | ||
− | Being stuck at home | + | 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. |
− | + | Instructions: | |
− | |||
− | |||
− | + | #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 ); | |
− | omxplayer file.mp4 | + | 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. |
+ | |||
+ | omxplayer file.mp4 | ||
+ | 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.. | 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: | |
+ | mkfifo /tmp/cmd | ||
Start up omxplayer with a redirect | Start up omxplayer with a redirect | ||
− | omxplayer file.mp4 < /tmp/cmd it will just sit there; | + | omxplayer file.mp4 < /tmp/cmd it will just sit there; |
− | then via the fifo send it some key | + | then via the fifo send it some key presses |
− | + | e.g.: | |
− | 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. | + | 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 | send it another 'p' and it will play | ||
− | echo -n p >/tmp/cmd | + | echo -n p >/tmp/cmd |
− | |||
− | + | OK, so that's not DMX controlled.. that's where ola_trigger comes in. | |
− | OLA trigger lets you run | + | 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 | Config file looks like this | ||
− | 1 128-255 mycommands | + | 1 128-255 mycommands |
Shell script is really simple and looks like this; | 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.. | |
− | |||
− | |||
− | You also of course need to have configured | ||
− | Still a work in progress, and certainly the above is likely to be confusing and | + | 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 |
Latest revision as of 16:24, 28 December 2013
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.
Instructions:
- 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.
omxplayer file.mp4
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:
mkfifo /tmp/cmd
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
e.g.:
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