Coder Social home page Coder Social logo

raspi-video-sync's Introduction

raspi-video-sync

Sync playback of videos for a RaspberryPi Video Wall

I need to make a video wall for an art project. We had a train car set and I used 4 raspberry pis to power four displays that acted as windows in the train. They needed to play different videos in sync with each other. The code here sets up the Pis with all the libraries needed to use gstreamer to play back video on the RaspberryPis.

Why Gstreamer?

I chose gstreamer because it takes advantage of the hardware decoding of the video and provided a good APIso that I could control the videos from python.

Components

Clients

The clients reside on the RaspberryPis, they playback their respective videos and listen to broadcasts of timecodes and state. If there are timecodes, it will sync to them.

Server

The basic idea of this player is that it looks at loops.json and loops between a set of time codes. When it receives a signal it continues to play through to the next loop interval.

The server can also recieve a few other signal types which can be sent from the remote.

Remote

If you want to remotely control the videos or skip around in them then start up the remote which is a webserver. You can go to the website to go to the control. The remote controls going to different sections as defined in sections.json and going to different loos as defined in loops.json

Ansible

I use ansible to provision the raspberry pis with all the libraries they need and to start up the players in sync.


cd playbooks
ansible-playbook -i inventory.ini setup.yml --tags="copy_movie"
ansible-playbook -i inventory.ini setup.yml --tags="setup" --extra-vars="one_time=true"
ansible-playbook -i inventory.ini setup.yml --tags="setup" --extra-vars="one_time=true"
ansible-playbook -i inventory.ini setup.yml --tags="play"

# In a seperate window
python server_player.py

# In a third window
python webserver.py
firefox localhost:5981

raspi-video-sync's People

Contributors

feanil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

raspi-video-sync's Issues

Error, on my part, when trying to launch pi playback...

Great script! I just wish I could get it to work... I feel like I'm super close but missing something...
it took me awhile to get ansible operational on the pi, but its doing the thing and your script is telling me stuff which is nice to see!

I can execute the first script in your example with success:
ansible-playbook -i inventory.ini setup.yml --tags="copy_movie"

but the next 3 without success.

Here is what I get for the first script that works:
root@raspberrypi:/home/pi/playbooks# ansible-playbook -i inventory.ini setup.yml --tags="copy_movie" -u pi

PLAY [pi1] ********************************************************************
skipping: no hosts matched

PLAY [pi2] ********************************************************************

TASK: [copy over the movie] ***************************************************
ok: [192.168.0.1]

PLAY [pi3] ********************************************************************

TASK: [copy over the movie] ***************************************************
changed: [192.168.0.2]

PLAY [pi4] ********************************************************************
skipping: no hosts matched

PLAY RECAP ********************************************************************
192.168.0.1 : ok=1 changed=0 unreachable=0 failed=0
192.168.0.2 : ok=1 changed=1 unreachable=0 failed=0

And for the last one that doesn't:

root@raspberrypi:/home/pi/playbooks# ansible-playbook -i inventory.ini setup.yml --tags="play" -u pi

PLAY [pis] ********************************************************************

TASK: [play the video] ********************************************************
failed: [192.168.0.2] => {"changed": true, "cmd": " python script.py /home/pi/Desktop/movie.mp4 ", "delta": "0:00:00.190085", "end": "2013-09-19 04:47:34.649721", "rc": 2, "start": "2013-09-19 04:47:34.459636"}
stderr: python: can't open file 'script.py': [Errno 2] No such file or directory
failed: [192.168.0.1] => {"changed": true, "cmd": " python script.py /home/pi/Desktop/movie.mp4 ", "delta": "0:00:00.276689", "end": "2013-10-03 10:08:09.950425", "rc": 2, "start": "2013-10-03 10:08:09.673736"}
stderr: python: can't open file 'script.py': [Errno 2] No such file or directory

FATAL: all hosts have already failed -- aborting

PLAY RECAP ********************************************************************
to retry, use: --limit @/root/setup.retry

192.168.0.1 : ok=0 changed=0 unreachable=0 failed=1
192.168.0.2 : ok=0 changed=0 unreachable=0 failed=1

root@raspberrypi:/home/pi/playbooks#

any suggestions on what I might be missing would be great! Thank you so much!

Synchronization offset

Hi!
This is my first post, so I hope it is at the correct place...
I have a similar project and tried your implementation but I need the videos "frame synchronous".
You have already tried to synchronize with NetTimeProvider as I have seen.
Would you have an idea how to compensate the network delays?
I am testing with the big buck bunny video in 1080p h264 and you can see that the videos have an offset.

Another point:
In the inventory.ini should NOT be the server player listed, correct?
This took a while until I understood because you have written that you have 4 displays.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.