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

master and slave on same pi? #98

Open zimtzeke opened 4 years ago

zimtzeke commented 4 years ago

dear turingmachine,

i'd like to start omxplayer-sync with the master and the slave on the same pi. yes, it's a pi4B!

do you think it's possible to use some kind of loopback of the dbus-messages? or set the -x DESTINATION to localhost (does not work, see below) and start 2 x omxplayer-sync (one master, one slave) on the same machine? or does the omxplayer-sync skript communicate with the same omxplayer instance if i call it twice?

with omxplayer-sync -x localhost --display 2 -m file.mov and then omxplayer-sync --display 7 -x localhost -l file.mov i get the errormessage:

OMXPlayerSync().run() File "/usr/bin/omxplayer-sync", line 121, in init self.sock = self.init_socket() File "/usr/bin/omxplayer-sync", line 352, in init_socket sock.bind(('0.0.0.0', PORT)) OSError: [Errno 98] Address already in use

when i do (echo omxplayer --display 7 file.m4v; echo omxplayer --display 2 file.m4v) | parallel it runs on both screens but as you can imagine without dbus-sync the performance depends on the scheduler of the gpu/cpu and the sync does not work after a while....(obviously) :-) but it works on both displays

is it possible to define an outgoing and a different in-port for dbus?

thanks!

side-note: i found out that the new vodafone connect box really lacks in terms of performance with omxplayer-sync (on any pi). the sync is pausing and jumping all the time. with other routers (tp-link or old fritz.box) it really works great! also on pi4 no matter if 1GB, 2GB or 4GB!

DSPeelJ commented 4 years ago

I haven't worked with a pi4 yet. Can you edit the 2 videos together into 1 double width file then play in a single instance spanning both screens?


From: zimtzeke notifications@github.com Sent: Sunday, January 26, 2020 5:52:31 PM To: turingmachine/omxplayer-sync omxplayer-sync@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [turingmachine/omxplayer-sync] master and slave on same pi? (#98)

dear turingmachine,

i'd like to start omxplayer-sync with the master and the slave on the same pi. yes, it's a pi4B!

do you think it's possible to use some kind of loopback of the dbus-messages? or set the -x DESTINATION to localhost (does not work, see below) and start 2 x omxplayer-sync (one master, one slave) on the same machine? or does the omxplayer-sync skript communicate with the same omxplayer instance if i call it twice?

with omxplayer-sync -x localhost --display 2 -m file.mov and then omxplayer-sync --display 7 -x localhost -l file.mov i get the errormessage:

OMXPlayerSync().run() File "/usr/bin/omxplayer-sync", line 121, in init self.sock = self.init_socket() File "/usr/bin/omxplayer-sync", line 352, in init_socket sock.bind(('0.0.0.0', PORT)) OSError: [Errno 98] Address already in use

when i do (echo omxplayer --display 7 file.m4v; echo omxplayer --display 2 file.m4v) | parallel it runs on both screens but as you can imagine without dbus-sync the performance depends on the scheduler of the gpu/cpu and the sync does not work after a while....(obviously) :-) but it works on both displays

is it possible to define an outgoing and a different in-port for dbus?

thanks!

side-note: i found out that the new vodafone connect box really lacks in terms of performance with omxplayer-sync (on any pi). the sync is pausing and jumping all the time. with other routers (tp-link or old fritz.box) it really works great! also on pi4 no matter if 1GB, 2GB or 4GB!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/turingmachine/omxplayer-sync/issues/98?email_source=notifications&email_token=AILUUYNLQFXNRZPWG6QDC6DQ7YO37A5CNFSM4KLZ7E52YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IIZJ7UQ, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AILUUYNH5NSSPBZJWX4YBOLQ7YO37ANCNFSM4KLZ7E5Q.

zimtzeke commented 4 years ago

hi, thanks for the answer!

full screen mode uses one screen (in my setup). editing could be an idea... but this shifts the problem from the player to the video-postproduction. as i never know which kind of displays will be exactly attached to the pi (thinking of future projects) editing 2 videos in e.g. 2x1920x1080 might work for 1 setup with 2 displays (not running in fullscreen-mode) but when i attach a different screen on one output i might get problems. and editing might get complicated when using, let's say a 100-screen setup (just to exaggerate). maybe there's a trick with dbus or 2 dbus-ports and different clients could be a solution for not having to think about too many things in the video-production phase.

i also must still make a test what happens if i call the slave twice on one single pi4... i'd like the idea to use only 20 instead of 40 pis for 40 screens.

yours

DSPeelJ commented 4 years ago

OK, I was thinking in small terms. Interesting approach for larger installations.

On Sun, Jan 26, 2020 at 6:31 PM zimtzeke notifications@github.com wrote:

hi, thanks for the answer!

full screen mode uses one screen (in my setup). editing could be an idea... but this shifts the problem from the player to the video-postproduction. as i never know which kind of displays will be exactly attached to the pi (thinking of future projects) editing 2 videos in e.g. 2x1920x1080 might work for 1 setup with 2 displays (not running in fullscreen-mode) but when i attach a different screen on one output i might get problems. and editing might get complicated when using, let's say a 100-screen setup (just to exaggerate). maybe there's a trick with dbus or 2 dbus-ports and different clients could be a solution for not having to think about too many things in the video-production phase.

i also must still make a test what happens if i call the slave twice on one single pi4... i'd like the idea to use only 20 instead of 40 pis for 40 screens.

yours

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/turingmachine/omxplayer-sync/issues/98?email_source=notifications&email_token=AILUUYPHO34XRKDAGIATOGTQ7YTO5A5CNFSM4KLZ7E52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJ6B5CI#issuecomment-578559625, or unsubscribe https://github.com/notifications/unsubscribe-auth/AILUUYMUEZ46H4TRD63SDYLQ7YTO5ANCNFSM4KLZ7E5Q .

turingmachine commented 4 years ago

@zimtzeke The problem is that the slaves binds to a specific port to receive packets from the master. The master then connects to the broadcast address and that specific port to send packets to. See https://github.com/turingmachine/omxplayer-sync/blob/master/omxplayer-sync#L343 and https://github.com/turingmachine/omxplayer-sync/blob/master/omxplayer-sync#L368. The "address already in use" error refers to the port that is used twice on the same address. You can circumvent that by binding each of the two slaves on each Pi to a separate IP address. For that to work you would first need to add an IP alias to each Pi within the same network. I'm not sure if multiple omxplayer instances can run on the same dbus instance. You could run each instance under a different username if not. Also It would make your life easier if you don't run a master and slave on the same device until you understand the setup properly.

turingmachine commented 4 years ago

This commit adds support to specify bind IP address: https://github.com/turingmachine/omxplayer-sync/commit/ccb139daf190bdf05bf4e192558caefbfb32bb97

zimtzeke commented 4 years ago

hi! thanks! i'll try that out and give a report. i also read the dbus manual and i guess i understand the -bind. you'll hear from me soon.

zimtzeke commented 4 years ago

dear turingmachine,

https://github.com/turingmachine/omxplayer-sync/commit/ccb139daf190bdf05bf4e192558caefbfb32bb97 does not work for me.

could it be that def init(self): self.sock = self.init_socket() is called before self.options.bind is read out? this seems to happen when i put print("debug"), print("debug2") to the corresponding lines.

i get the error message

Traceback (most recent call last): File "/usr/bin/omxplayer-sync", line 339, in OMXPlayerSync().run() File "/usr/bin/omxplayer-sync", line 107, in init self.sock = self.init_socket() File "/usr/bin/omxplayer-sync", line 288, in init_socket sock.bind((self.options.bind, PORT)) AttributeError: 'OMXPlayerSync' object has no attribute 'options'

thanks.