Thursday 22 October 2015

OMX Player - Make a video wall

download omx player onto the pi by open a terminal and type

sudo apt-get install omxplayer

the omx-player website is here

Different films played on different pi's can be synchronised by wiring two buttons, one for on,one for off, to each of the pi's pins. When the button is pressed the signal is passed on to all the pi's simultaneously, syncronising all the films to start playing at once.

to see how to wire a button, and downlad the the reveliant software look here

this python script looks for two buttons, one on pin 18 and the other on pin 23, and then sends via OSC to pd. download it here

the diagrams of the pi's pins here


#!/usr/bin/python

import time
import os
import OSC
import RPi.GPIO as GPIO

# Open osc

send_address = "127.0.0.1" , 9000
c = OSC.OSCClient()
c.connect(send_address)

GPIO.setmode(GPIO.BCM)

GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(23, GPIO.IN, pull_up_down=GPIO.PUD_UP)

# Define delay between readings
delay = 0.1
while True:



  input_state2 = GPIO.input(23)
  input_state1 = GPIO.input(18)

  if input_state1 == False:
      print('Button 1  Pressed')
  if input_state2 == False:
      print('Button 2  Pressed')

  
  msg = OSC.OSCMessage()
  msg.setAddress("print")  
  msg.append(input_state1)
  msg.append(input_state2)


  c.send(msg)

  



 In the pd patch pin 18 plays a movie (called movie.mp4 in the home directory home/pi) ,if pressed again it kills the movie, press it again and it begins again. The other button shuts down the pi.
(n.b if auto-starting  the pd patch though updating the rc.local file (see starting headlessly) you need to update path name in pd)
download the patch here





omx comes with loads of commands you can send in pd via shell.

the message format is

sudo omxplayer -b -o both --loop --no-osd /home/pi/movie.mp4

-h  --help                  Print this help
-v  --version               Print version info
-k  --keys                  Print key bindings
-n  --aidx  index           Audio stream index    : e.g. 1
-o  --adev  device          Audio out device      : e.g. hdmi/local/both
-i  --info                  Dump stream format and exit
-I  --with-info             dump stream format before playback
-s  --stats                 Pts and buffer stats
-p  --passthrough           Audio passthrough
-d  --deinterlace           Force deinterlacing
    --nodeinterlace         Force no deinterlacing
    --nativedeinterlace     let display handle interlace
    --anaglyph type         convert 3d to anaglyph
    --advanced              Allow advanced deinterlace for HD videos
-w  --hw                    Hw audio decoding
-3  --3d mode               Switch tv into 3d mode (e.g. SBS/TB)
-M  --allow-mvc             Allow decoding of both views of MVC stereo stream
-y  --hdmiclocksync         Display refresh rate to match video (default)
-z  --nohdmiclocksync       Do not adjust display refresh rate to match video
-t  --sid index             Show subtitle with index
-r  --refresh               Adjust framerate/resolution to video
-g  --genlog                Generate log file
-l  --pos n                 Start position (hh:mm:ss)
-b  --blank                 Set background to black
    --loop                  Loop file. Ignored if file not seekable
    --no-boost-on-downmix   Don't boost volume when downmixing
    --vol n                 set initial volume in millibels (default 0)
    --amp n                 set initial amplification in millibels (default 0)
    --no-osd                Do not display status information on screen
    --no-keys               Disable keyboard input (prevents hangs for certain TTYs)
    --subtitles path        External subtitles in UTF-8 srt format
    --font path             Default: /usr/share/fonts/truetype/freefont/FreeSans.ttf
    --italic-font path      Default: /usr/share/fonts/truetype/freefont/FreeSansOblique.ttf
    --font-size size        Font size in 1/1000 screen height (default: 55)
    --align left/center     Subtitle alignment (default: left)
    --no-ghost-box          No semitransparent boxes behind subtitles
    --lines n               Number of lines in the subtitle buffer (default: 3)
    --win 'x1 y1 x2 y2'     Set position of video window
    --win x1,y1,x2,y2       Set position of video window
    --audio_fifo  n         Size of audio output fifo in seconds
    --video_fifo  n         Size of video output fifo in MB
    --audio_queue n         Size of audio input queue in MB
    --video_queue n         Size of video input queue in MB
    --threshold   n         Amount of buffered data required to finish buffering [s]
    --timeout     n         Timeout for stalled file/network operations (default 10s)
    --orientation n         Set orientation of video (0, 90, 180 or 270)
    --fps n                 Set fps of video where timestamps are not present
    --live                  Set for live tv or vod type stream
    --layout                Set output speaker layout (e.g. 5.1)
    --dbus_name name        default: org.mpris.MediaPlayer2.omxplayer
    --key-config <file>     Uses key bindings in <file> instead of the default
    --alpha                 Set video transparency (0..255)
    --layer n               Set video render layer number (higher numbers are on top)
    --display n             Set display to output to
    --cookie 'cookie'       Send specified cookie as part of HTTP requests
    --user-agent 'ua'       Send specified User-Agent as part of HTTP requests


No comments:

Post a Comment