I have devices thay play video files from their local disk basing on a pre-defined playlist (every device plays exactly the same movie in the same order, every device knows in advance what videos will be played and what is their duration). There is no master device, every one is equal (there is a server though, but it's only used for downloading the video files for the first time and it can be in an entirely different network, and it doesn't do any video playback).

The devices are all exactly the same (the entire hardware is identical and the OS (linux) also) I'm using a custom video player based on GStreamer library (in Qt).

I want to synchronize the video playback between all these devices in the same local area network (over UDP packets). I'm trying to find the best solution for my circumstances. I tried doing it so that the devices periodically send an "i am alive" packet over UDP broadcast, and before starting the video playback they send a "i am ready" packet with a predefined number that is periodically decremented by other devices (so if one device loses power for example, the number will go down to 0, if it comes back there will be a re-synchronization). If all devices are ready, then they all start playing. There are some small differences, but it's acceptable.

Here are my main points regarding the synchronization:

  1. I cannot use an NTP-synced clock, because the devices often work in a cut-off network that has no access to any NTP server. Even if they had, I think NTP is not a good way to do this (not really that synced). This also prevents me from using any sort of timestamps, since they can be totally different on every device (they have an RTC module, but in case the battery goes low there will be differences)
  2. I can pause/seek the video as needed, but I'd rather not seek the video during playback because that would produce a weird effect.
  3. In case any device goes behind (or gets restarted), videos need to be re-synchronized
  4. I cannot do video streaming (I tried already, it produces many other problems such as artifacts and doesn't really produce a perfect sync)
  5. There is no (at least there shouldn't be) any visible gap between the videos, they are played one after one in a seamless loop.
  6. There is no audio involved, so it doesn't need to be synced.

What are your ideas on achieving this?

  • Install NTP on your server and then use NTP? – user253751 Feb 4 at 11:42

There has been some research on detecting clock skew. Check out "Real Time Clock Skew Estimation over Network Delays" and detecting spoofed messages.

Also, I don't have a good source for this, computers while running have very precise clocks. It's the battery powered RTC that runs when they are off that tends to skew.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.