turingmachine / omxplayer-sync

OMXPlayer-Sync facilitates synchronization of multiple OMXPlayer instances over the network in a master/slave fashion.
194 stars 70 forks source link

I get meaningless offsets #5

Closed pukster closed 10 years ago

pukster commented 10 years ago

When i run in verbose mode, here is the output I get

Master: $ omxplayer-sync -v -m -x 192.168.1.71 /full/path/to/movie local: 0.00 0 local: 0.00 0 local: 0.00 0 ...

Slave: $ omxplayer-sync -v -l /full/path/to/movie local: 0.00 master: 0.00 deviation: 0.00 wait: False local: 0.00 master: 0.00 deviation: 0.00 wait: False local: 0.00 master: 0.00 deviation: 0.00 wait: False ...

This can't be correct. Also, it goes without saying that the two videos are not synchronized. Finally, I am calling the omxplayer-sync Python script and I have modified the code such that it calls your build of omxplayer as the executable.

pukster commented 10 years ago

I've been tracing the program further and what is happening is that in this snippet of code:

while True:
   eof = False
   while True:
      index = process.expect([
         REGEX_STATUS,
         pexpect.TIMEOUT,
         pexpect.EOF,
         REGEX_DONE,
      ])
      if index == 1:
         break
      elif index in (2,3):
         if options.verbose:
            print "omxplayer has ended..."
         eof = True
         break
      else:
         position_local = float(process.match.group(1)) + adjust
   if eof: break

The if index == 1: conditional catches it everytime. To the best of my knowledge the else conditional is the only place in all of this code that the position_local variable is set. Therefore, it is not being updated.

Now I just have to figure out what REGEX_STATUS is and why it is being caught everytime

pukster commented 10 years ago

I figured it out. All I had to do was change

REGEX_STATUS = re.compile(r".*V:\s*([\d\.]+).*")

to

REGEX_STATUS = re.compile(r".*V:\s*([\d\.]+).*")

NOTE: I removed the space between 'V' and ':' and I added a '.*' before the 'V'

Quite frankly I don't know how this code worked before.

Now at least it displays the time information, however, the videos are still not being synchronized.

turingmachine commented 10 years ago

The stats output of omxplayer did change frequently between releases. For omxplayer c0dd950 it must look like this:

re.compile("M\s*:\s*(\d+).*")

The .* at beginning (and also at the end) are not needed, because the regex is not anchored and will match any part of the output.

I assume on both the master and the slave the local: section of the console log output gets uppdated. On the slave, does the console log output under master: display the time of the master?

pukster commented 10 years ago

Yes I figured this out eventually. I don't know how I was working with an older version of omxplayer-sync. Have you noticed serious issues with this script? Under certain situations the code can hang indefinitely. I am still working on this, and I have forked this project