This example code shows a way to play a single video on multiple screens. Each of them has to have its own Raspberry PI running info-beamer to display part of the video.
This setup assumes that you want to play a single "virtual" video and that is then visualized using multiple screens that cover the area of that video.
An example: You setup a virtual video sized 120cm x 70cm. You can then use four 27" screens arranged in a 2x2 grid to cover this area. Each of those monitors will then show one quadrant of the video.
Or you can have a 100cm x 100cm video (the video file should have 1:1 aspect ratio then) and place 10 screens freely arranged and tilted. Once you have created a configuration that captures the screen setup, each of them will display the correct region of the video.
Creating a configuration shouldn't be too hard. There is a configuration tool provided in index.html. Just open it with a browser.
(Use it here: https://info-beamer.github.io/multiscreen/)
In the upper area you see the current setup. The dark area represents the virtual video area. The are multiple screens that cover this area.
To change your screen setup, just move the screens around by drag-/dropping them. You can tilt them by hovering over them and using your mouse wheel.
Below in a text area you'll find the representation of this setup written as JSON.
This configuration is in sync with the graphical representation, so you can make changes in both of them and the other will reflect those changes.
To change the size of the video area you have to edit the
JSON by hand. Just change the values of width
and height
in the video
section to the size in centimeters.
You can change screen sizes as well as there resolution
in the JSON text: Just edit the values width
, height
and inches
to match the screens you want to use.
Once you have finalized your setup, save it by clicking
the Download button and save the file screens.json
.
To edit an existing configuration, just open the
previously saved screens.json
file (using for
example notepad) and copy the text into the text area
of the configuration page. You can then start editing
it.
You have to repeat this step for each Pi you want to use.
Install Raspbian.
Download info-beamer for the pi
and extract the tar.gz somewhere. This readme assumes
you extracted the tar to /root/info-beamer-pi
.
Please follow the instructions in
/root/info-beamer-pi/README.txt
to make sure your
Pi has enough video memory available. You can test
info-beamer by running:
$ /root/info-beamer-pi/info-beamer /root/info-beamer-pi/samples/hello
This readme also assumes that this readme and all
related files (node.lua, master.py, ...) are in
/root/multiscreen
.
Copy the videos(s) you want to display to the directory
/root/multiscreen
. Only h264 videos aresupported. For the
best performance it's recommended to use SD (1280x720)
videos. Higher resolutions might not play smoothly.
Create the file playlist.txt
and add the filenames
of each video you want to play. It might look like this:
video1.mp4
video2.mp4
Edit /etc/rc.local
and add the following line
before the existing exit 0
line:
INFOBEAMER_ADDR=0.0.0.0 /root/info-beamer-pi/info-beamer /root/multiscreen &
This will start info-beamer each time the Pi starts. Make sure you have ssh access configured for the Pi, otherwise the screen will be black after booting since info-beamer will show a black screen while waiting for video playback.
Be careful: This setup assumes that your network is trusted. Any machine in the same network can control which of the provided videos is displayed on each screen.
Once all PIs are configured it's time to start playing videos. One of the PIs (or any other computer) will act as the master server that coordinates playback.
This readme assumes that one of the previously configured PIs acts as the master.
Copy the screens.json
file generated by the
configuration tool to /root/multiscreen
.
Assuming your screens.json
is configured for two
screens, run master.py like this:
cd /root/multiscreen
python master.py screens.json playlist.txt 192.168.1.50 192.168.1.51
This assumes that the PI for the first screen configured uses the IP address 192.168.1.50 and the second one uses 192.168.1.51. Yours probably have other IP addresses, so be sure to change those values.
If this is running successfully you might want to add
those lines to /etc/rc.local
as well. It might look like this
(be sure to change the IP addresses as well as there number
to match your setup) on the master PI now:
INFOBEAMER_ADDR=0.0.0.0 /root/info-beamer-pi/info-beamer /root/multiscreen &
cd /root/multiscreen
python master.py screens.json playlist.txt 192.168.1.50 192.168.1.51 &