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

Eventual drift out of sync #79

Closed muff7 closed 5 years ago

muff7 commented 5 years ago

I have this set up and running on 2 Raspberry Pi 3b+'s.

Both machines start up in perfect sync +/- 1 frames which is perfectly fine for my use case. Although when I leave the machines running overnight, by the next morning they're seconds out and not correcting back to the master.

Anything I can try to fix this?

Thanks for the great work!

DSPeelJ commented 5 years ago

How do you have the Pi's networked? I'm using a managed switch, assigned each Pi a static IP and used the switch IP as the gateway. I've got 24 Pi's running basically 24/7 and haven't seen this behavior.

muff7 commented 5 years ago

Connected through a switch, static IP's and all. Ping between the machines is 0.242ms pretty sharp!

turingmachine commented 5 years ago

@muff7 Can you give some information about the content you are playing? How many files etc?

muff7 commented 5 years ago

@turingmachine thanks! Just trying the included synctest.mp4 at the moment.

muff7 commented 5 years ago

Left the machines running overnight again and this morning and they're 11 frames out.

turingmachine commented 5 years ago

@muff7 What value are you using for SYNC_TOLERANCE?

DSPeelJ commented 5 years ago

I'll look at my config. I did cut down the sync tolerance on my setup by half, I think. I'll confirm and let you know

turingmachine commented 5 years ago

The acutal value would be of interest. The current default ist set to 0.05 seconds. This is a little more than the duration of one frame (1/24). This means if the deviation is more than this value it will resync. @muff7 This poses the question why it didn't resync whenn 11 frames apart. Can you verify network connectivity at this time? Does omxplayer-sync throw any errors?

muff7 commented 5 years ago

What value are you using for SYNC_TOLERANCE?

Yup sync_tolerence is set to 0.05 as per default; SYNC_TOLERANCE = .05 SYNC_GRACE_TIME = 5 SYNC_JUMP_AHEAD = 3

Can you verify network connectivity at this time?

Yes, both Pi's are connectable and running.

Does omxplayer-sync throw any errors?

None that I can see, is there a log file I can share?

Thanks again.

DSPeelJ commented 5 years ago

I set the SYNC_TOLERANCE to .025 on my setup very early on and forgot to mention it earlier. Grace time and jump ahead are unchanged. It seemed to tighten things up for me. I also changed the sleep( ) #wait for omxplayer to appear on dbus value to 20 as I was having problems with the files loading. No other changes. My videos have about 25 seconds of black at the beginning and that is plenty to get them all in sync. The files are all encoded identically. I did a sample run with a time code overlay and they were within a frame or two at all times.
I uploaded a few sample clips here: https://youtu.be/zupHpzgcJqc and here: https://youtu.be/Xp6GKFaw0io

I did my initial testing in February or March but it seems like I had similar drifting before I tightened up the sync value.

muff7 commented 5 years ago

Hey all,

update from me here. I've now set the SYNC_TOLERANCE to .025 and I'm still getting frame drift. Overnight the players are 10 or so frames out and not correcting still. Any other suggestions?

DSPeelJ commented 5 years ago

Is your system fully updated? Just going back to basics... You don't have loggging enabled? I could upload an image of my SD card for you to try.

muff7 commented 5 years ago

Yes fully updated, logging as in Verbose mode? I have had that running, I'll disable and test again.

magdesign commented 5 years ago

Do you have the exact same setup, that means same resolution, same sd cards, same OS setup ? Is it syncing in anyway or just both player starting at the same time (you can try this with pausing the master a few seconds and starting it again to see if the slave resyncs)? @DSPeelJ : may we use your youtube link in the readme as a demo example?

DSPeelJ commented 5 years ago

Another note. I added the startup command to the rc.local file so it starts automatically on boot. I have the piconfig set to wait for network. If you start the slave first, it should pause, waiting for the sync commands from the master. When the master boots, the slave should start to follow then. I'm using the same image on all Pi's, identical encoding on the videos, and the same brand and size of sd cards. I then went in, changed the IP addresses, added the appropriate command to rc.local, and loaded the appropriate video file. Over the last few months, I've had a few players hang on occasion (they'll be on a blank screen when we turn the screens on) but I can just reboot the Pi and it falls back in sync within 20 seconds or so. This has happened maybe 3 or 4 times with 24 Pi's running 24/7, so while a quirk, hardly a deal breaker for my installation. I haven't had to reboot the entire setup since I turned it on in early May. I've got heat sinks on the Pi's too but don't think that overheating is any issue.

Happy to have you use the clip as a demo. Thanks,

DSPeelJ commented 5 years ago

Also booting to console, not to desktop.

muff7 commented 5 years ago

Yup, exactly the same configuration used here also.

I set up one of the Pi's then cloned the SD Card image to the other. I'm running Stretch Lite with no desktop. I haven't yet set the sync to start on boot I simply run the commands manually.

When in verbose mode the pi's do show that they are pausing and correcting at first so I do think there is some sort of syncing happening! I'd be very happy to try your pi image @DSPeelJ!

M

DSPeelJ commented 5 years ago

I'm pretty sure I'm on Jesse. What ever was current in February or march. I'm using a 32 gb sd card so the image is that. I'm not at work and have pretty pokey internet where I am. Happy to upload though( it will take a while!) Regarding adding to rc.local, I'm fuzzy on killing the process once it starts, so would use a linux laptop to get back in and do any other edits. Shouldn't be hard to use killall but I just didn't mess with it since I had a laptop available.

turingmachine commented 5 years ago

@muff7 Are you running any other programs that could affect performance?

DSPeelJ commented 5 years ago

I did disable bluetooth and wireless. Not sure if that made any difference but I tried to keep it as lean as possible.

hitesh83 commented 5 years ago

Sorry to jumping in between discussion. @DSPeelJ can you enable verbose mode on both (Master & Slave ) , try to keep them side by side and take a photo of console ? this will enable every one to know the difference as per the program and not as per visually. Same way I diagnosed one of my issue with OmxSync and found out my file was too short to get sync. (not the same issue for you but still one more method to know whats going on )

DSPeelJ commented 5 years ago

No worries, I won't be able to until Monday earliest, I'm off for a few. My files are about 15 minutes long.

DSPeelJ commented 5 years ago

Not what you asked for but I did have a shot of 12 screens with timecode embedded in the video files. The setup was running for several days when this was taken. rodeo timecode

DSPeelJ commented 5 years ago

Can you try Jessie instead of Stretch?

DSPeelJ commented 5 years ago

Back at work today. I checked the os version and I'm running Stretch but on a PI 3 not the newest 3 B+ I purchased all of mine about a month before the release of the 3 B+

DSPeelJ commented 5 years ago

@muff7 I'm redoing the system image in to smaller pieces so I can upload them. I'll let you know.

magdesign commented 5 years ago

Basically you can just take a "raspian jessie" light image and install omxplayer-sync as described in the readme and everything will work as expected. I am aware that there are issues with stretch but don't have the time right now to solve them, hoping to get some inputs from the community.

ghost commented 5 years ago

ohh dat nice....

On Thu, Aug 2, 2018 at 11:34 AM, DSPeelJ notifications@github.com wrote:

Not what you asked for but I did have a shot of 12 screens with timecode embedded in the video files. The setup was running for several days when this was taken. [image: rodeo timecode] https://user-images.githubusercontent.com/35080801/43594216-5425f5f8-963f-11e8-8089-e100a7a32323.jpg

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/turingmachine/omxplayer-sync/issues/79#issuecomment-409968906, or mute the thread https://github.com/notifications/unsubscribe-auth/AOKZ3taLMAiiIlLhaYC_6NB6K5jqAp6fks5uMxwKgaJpZM4VmM4_ .

--

DSPeelJ commented 5 years ago

Here are links to an image of of my Stretch install. you'll need all 3 parts, then un-rar, Nothing special here but this does work well for me on a PI 3. Not tested on a 3 b+

https://www.icloud.com/iclouddrive/032TQPsrGjEfqWmnE2cBBMbLw#pisync180223.part1.rar https://www.icloud.com/iclouddrive/0cjZhupaQcfCoXwCGueaa6G9Q#pisync180223.part2.rar https://www.icloud.com/iclouddrive/0_WeRaMmTZYXPC8B_3M_8FcCQ#pisync180223.part3.rar

I just followed the readme but, again, this is working for sure.