[MPlayer-users] UDP -udp-slave video sync

316 views
Skip to first unread message

r...@goto10.org

unread,
Jun 2, 2011, 2:06:14 PM6/2/11
to mplaye...@mplayerhq.hu
hello,

i've just built the latest mplayer from svn on debian and all went well
- my goal was to try and use the -udp-master -udp-slave stuff to sync
over the network - but i cant get it to work - when i try

mplayer -udp-slave myvid.mkv

then mplayer should apparently freeze on a frame and wait for messages
from a master instance - for me this does not happen - it just plays as
normal... i get no error messges about -udp-* even with a -v

i am doing a project syncing 8 videos/computers/mplayers for an art
project - atm i use mplayer in slave mode sending transport messages to
the fifo over parallel-ssh which seems to work pretty well... but of
course if this udp stuff works then it would be prefereable

any clues?

thanks

rob
_______________________________________________
MPlayer-users mailing list
MPlaye...@mplayerhq.hu
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-users

Morris Beverly

unread,
Jun 6, 2011, 2:29:12 PM6/6/11
to MPlayer usage questions, feature requests, bug reports

mplayer -udp-slave myvid.mkv
>
> then mplayer should apparently freeze on a frame and wait for messages
> from a master instance - for me this does not happen - it just plays
> as normal... i get no error messges about -udp-* even with a -v
>
I haven't tried this yet myself, but it looks pretty cool. Just a
thought though -- did you set up your broadcast address as mentioned in
the man page?

morris

r...@goto10.org

unread,
Jun 7, 2011, 6:16:41 PM6/7/11
to mplaye...@mplayerhq.hu, jh...@google.com
On Mon, 06 Jun 2011 14:29:12 -0400, Morris Beverly wrote:
> mplayer -udp-slave myvid.mkv
>>
>> then mplayer should apparently freeze on a frame and wait for
>> messages from a master instance - for me this does not happen - it
>> just plays as normal... i get no error messges about -udp-* even with
>> a -v
>>
> I haven't tried this yet myself, but it looks pretty cool. Just a
> thought though -- did you set up your broadcast address as mentioned
> in the man page?

yeah this would be really nice to get working - yes i checked my
broadcast address with ifconfig - but i think -udp-slave shoud just
freeze and listen waiting for the master - nevertheless i have tried
many combinations ...
got my info here

http://www.mplayerhq.hu/DOCS/HTML/en/networksync.html
and
http://code.google.com/p/liquid-galaxy/wiki/PanoramicVideo

i cc in jholt who i think is the author of the patch - and sorry in
advance if i am missing something obvious

cheers

rob

r...@goto10.org

unread,
Jun 8, 2011, 9:40:57 AM6/8/11
to Jason Holt, mplaye...@mplayerhq.hu
On Tue, 7 Jun 2011 18:29:12 -0700, Jason Holt wrote:

> On Tue, Jun 7, 2011 at 3:16 PM, wrote:
>
>> On Mon, 06 Jun 2011 14:29:12 -0400, Morris Beverly wrote:
>>
>>> mplayer -udp-slave myvid.mkv
>>>
>>>> then mplayer should apparently freeze on a frame and wait for
>>>> messages from a  master instance - for me this does not happen
>>>> - it just plays as normal... i get no error messges about
>>> -udp-*
>>>> even with a -v
>
> ... 

>
>> i cc in jholt who i think is the author of the patch - and sorry in
>> advance if i am missing something obvious
>
> This does indeed appear to be broken.  It kinda works if I start
> the master first, but not very well.
>
> If I start it without a master present, it renders frames as fast as
> it possibly can, because udp_slave_sync() returns immediately,
> causing
> sleep_until_update() to return immediately.
>
> Then, during "normal" playback, once the slave gets synced up with
> the master and should be playing in lock step, the
> udp_master_position
> ends up == MP_NOPTS_VALUE for about 10 invocations due to the
> nonblocking get_udp trying to tell it that there aren't any messages
> yet.  So udp_slave_sync returns immediately, and mplayer plays frames
> as fast as it can once again.  When a datagram finally comes in, the
> slave is way ahead of the master, so it blocks until the master
> catches up, then runs ahead again.
>
> The attached patch makes the slave block if the master isn't up yet,
> which was the original behavior, and which I think is better than
> having it play normally in most instances.  (If you gave -udp-sync,
> you probably want it to wait.)  And it makes udp_master_position
> static, so that it's only set to MP_NOPTS_VALUE on startup and after
> blocking get_udp calls.

ok great thank you! - i applied the patch and now it works as expected
- the only thing i have noticed is that the audio and video go out of
sync on the slave instance - its as if the udp packets tell the video
which frame it should be playing but the audio doesnt jump to keep up

i tried passing mplayer some flags to try and fix it -mc 1 -autosync 1
etc but none made any difference

any clue how this could be fixed so the audio and video stay in sync on
the slave instances?

(i know if i were doing a video wall then you could just use the audio
from one source - but this is not what i am doing)

thanks for the quick reply and patch fix!

rob

T.Reifenrath

unread,
Jun 8, 2011, 11:24:41 AM6/8/11
to MPlayer usage questions, feature requests, bug reports
I still have the same problem......

I just get the new Version with this Filename: MPlayer-athlon-svn-33488

Tried to play the 4 Videos on a single machine with these batch-files:

Master:
mplayer -udp-master -noborder -geometry 0:0 -vf scale=128:72 Video1_1.mp4

Slave1:
mplayer -udp-slave -noborder -geometry 128:0 -vf scale=128:72 Video1_2.mp4

Slave2:
mplayer -udp-slave -noborder -geometry 256:0 -vf scale=128:72 Video1_3.mp4

Slave3:
mplayer -udp-slave -noborder -geometry 384:0 -vf scale=128:72 Video1_4.mp4


Videos are running after starting the batch-files ( still get a message
"unsupported Pixelformat 61" / "unsupported Pixelformat 61" )
But they don´t sync with the master.

If I just start one of the slaves and after the master, the slave is waiting
but does nothing. When the master is finished, the slave ends, too.
But this is only if ONE slave is started. When all slave are started, just
the first one is waiting while the others are playing.

Can anybody help ???


-----Ursprüngliche Nachricht-----
From: r...@goto10.org
Sent: Wednesday, June 08, 2011 3:40 PM
To: Jason Holt
Cc: mplaye...@mplayerhq.hu
Subject: Re: [MPlayer-users] UDP -udp-slave video sync

r...@goto10.org

unread,
Jun 8, 2011, 11:58:02 AM6/8/11
to mplaye...@mplayerhq.hu
On Wed, 8 Jun 2011 17:24:41 +0200, T.Reifenrath wrote:
> I still have the same problem......
>
> I just get the new Version with this Filename:
> MPlayer-athlon-svn-33488
>
> Tried to play the 4 Videos on a single machine with these
> batch-files:
>
> Master:
> mplayer -udp-master -noborder -geometry 0:0 -vf scale=128:72
> Video1_1.mp4

hi,
you need to tell it the broadcast ip of your network (sudo ifconfig
will show you this)
mplayer -udp-ip 192.168.1.255 -udp-master Video1_1.mp4
HTH
rob

r...@goto10.org

unread,
Jun 8, 2011, 12:05:24 PM6/8/11
to mplaye...@mplayerhq.hu
On Wed, 08 Jun 2011 16:58:02 +0100, r...@goto10.org wrote:
> On Wed, 8 Jun 2011 17:24:41 +0200, T.Reifenrath wrote:
>> I still have the same problem......
>>
>> I just get the new Version with this Filename:
>> MPlayer-athlon-svn-33488
>>
>> Tried to play the 4 Videos on a single machine with these
>> batch-files:
>>
>> Master:
>> mplayer -udp-master -noborder -geometry 0:0 -vf scale=128:72
>> Video1_1.mp4
>
>
>
> hi,
> you need to tell it the broadcast ip of your network (sudo ifconfig
> will show you this)
> mplayer -udp-ip 192.168.1.255 -udp-master Video1_1.mp4
> HTH
> rob

oops sorry thats not true if you are on the same machine
you patched the source with the patch from Jason right?

Reimar Döffinger

unread,
Jun 8, 2011, 3:07:26 PM6/8/11
to MPlayer usage questions, feature requests, bug reports
On Wed, Jun 08, 2011 at 02:40:57PM +0100, r...@goto10.org wrote:
> ok great thank you! - i applied the patch and now it works as
> expected

Unfortunately I couldn't see the patch. However the behaviour
was due to a stupid bug I introduced, and that happened because
with vsync enabled the video I tested actually did run at about
correct speed so the behaviour wasn't as bad as what you experienced.
Assuming it really works this time, the change in SVN should have
the advantage that the slave instances will start playing independently
after 30 seconds.

> - the only thing i have noticed is that the audio and video
> go out of sync on the slave instance - its as if the udp packets
> tell the video which frame it should be playing but the audio doesnt
> jump to keep up

Well, MPlayer never ever adjusts audio playback speed so it can't
keep sync in this case.

> (i know if i were doing a video wall then you could just use the
> audio from one source - but this is not what i am doing)

Might help to say what you are doing. You can certainly just
set up an audio server and transmit the audio to the slaves via
network, independent of the MPlayer slaves.

T.Reifenrath

unread,
Jun 8, 2011, 3:14:26 PM6/8/11
to MPlayer usage questions, feature requests, bug reports
I tried both !!!

I used the broadcast address of my network ( mplayer -udp-ip
192.168.0.255 -udp-master Video1_1.mp4) and also the localhost adress
127.0.0.1

The result is always the same. Maybe I have to use another SVN ?


-----Ursprüngliche Nachricht-----
From: r...@goto10.org
Sent: Wednesday, June 08, 2011 6:05 PM
To: mplaye...@mplayerhq.hu

Rob Canning

unread,
Jun 8, 2011, 4:46:07 PM6/8/11
to MPlayer usage questions, feature requests, bug reports, Reimar.D...@gmx.de, jh...@google.com
Reimar Döffinger wrote:
> On Wed, Jun 08, 2011 at 02:40:57PM +0100, r...@goto10.org wrote:
>
>> ok great thank you! - i applied the patch and now it works as
>> expected
>>
>
> Unfortunately I couldn't see the patch. However the behaviour
> was due to a stupid bug I introduced, and that happened because
> with vsync enabled the video I tested actually did run at about
> correct speed so the behaviour wasn't as bad as what you experienced.
> Assuming it really works this time, the change in SVN should have
>
is this a recent change in the SVN - should i update and recompile it ?

> the advantage that the slave instances will start playing independently
> after 30 seconds.
>
>
does this mean after 30 seconds of being synced then the independent
playback will kick in and the audio/video sync lag will be able to
rectify itself?

>> - the only thing i have noticed is that the audio and video
>> go out of sync on the slave instance - its as if the udp packets
>> tell the video which frame it should be playing but the audio doesnt
>> jump to keep up
>>
>
> Well, MPlayer never ever adjusts audio playback speed so it can't
> keep sync in this case.
>
>
>> (i know if i were doing a video wall then you could just use the
>> audio from one source - but this is not what i am doing)
>>
>
> Might help to say what you are doing. You can certainly just
> set up an audio server and transmit the audio to the slaves via
> network, independent of the MPlayer slaves.
>

ok so i have 8 computers each playing a 720HD mkv file with 5.1 sound -
each playback computer needs to have the video and 5.1 in sync and each
of the 8 computers also in sync - the material on each of the playback
computers is different but of equal duration - the udp master slave
thing seemed like it might be a solution but the lack of absolute sync
between the audio and video within each machine is a problem
any suggestions on how to make this happen would be most appreciated

thanks

rob

Rob Canning

unread,
Jun 8, 2011, 5:49:48 PM6/8/11
to MPlayer usage questions, feature requests, bug reports, Reimar.D...@gmx.de, jh...@google.com
brief addendum to the reply inline below... sorry for noise..

the sync between the audio/video on the individual slaves seems to be
erratic - sometimes i start it and its perfect and sometime its up to
around 20 frames out of sync - once its rolling and in sync it remains
in sync and does not drift - but the randomness of when it starts in
sync and when it doesnt is whats stoping it being a solution atm
thanks
rob

Reimar Döffinger

unread,
Jun 9, 2011, 1:19:40 PM6/9/11
to MPlayer usage questions, feature requests, bug reports
On Wed, Jun 08, 2011 at 09:46:07PM +0100, Rob Canning wrote:
> Reimar Döffinger wrote:
> >On Wed, Jun 08, 2011 at 02:40:57PM +0100, r...@goto10.org wrote:
> >>ok great thank you! - i applied the patch and now it works as
> >>expected
> >
> >Unfortunately I couldn't see the patch. However the behaviour
> >was due to a stupid bug I introduced, and that happened because
> >with vsync enabled the video I tested actually did run at about
> >correct speed so the behaviour wasn't as bad as what you experienced.
> >Assuming it really works this time, the change in SVN should have
> is this a recent change in the SVN - should i update and recompile it ?

Yes.

> >the advantage that the slave instances will start playing independently
> >after 30 seconds.
> >
> does this mean after 30 seconds of being synced then the independent
> playback will kick in and the audio/video sync lag will be able to
> rectify itself?

No, it means after the network being down for 30 seconds or the master
having died unexpectedly or whatever the slaves start playing
normally, waiting for the master to become available again.

> >>(i know if i were doing a video wall then you could just use the
> >>audio from one source - but this is not what i am doing)
> >
> >Might help to say what you are doing. You can certainly just
> >set up an audio server and transmit the audio to the slaves via
> >network, independent of the MPlayer slaves.
> ok so i have 8 computers each playing a 720HD mkv file with 5.1
> sound - each playback computer needs to have the video and 5.1 in
> sync and each of the 8 computers also in sync - the material on each
> of the playback computers is different but of equal duration - the
> udp master slave thing seemed like it might be a solution but the
> lack of absolute sync between the audio and video within each
> machine is a problem
> any suggestions on how to make this happen would be most appreciated

What is the duration? How precisely must it be in sync?
In principle it is possible to change playback speed dynamically
(which in case of -udp-slave would only affect audio) but it's
not implemented yet to do that based on UDP sync or something
and I'm not sure it's a good idea anyway since it decreases audio
quality and introduces jitter even with a good implementation.

Reimar Döffinger

unread,
Jun 9, 2011, 1:30:24 PM6/9/11
to MPlayer usage questions, feature requests, bug reports
On Wed, Jun 08, 2011 at 10:49:48PM +0100, Rob Canning wrote:
> brief addendum to the reply inline below... sorry for noise..
>
> the sync between the audio/video on the individual slaves seems to
> be erratic - sometimes i start it and its perfect and sometime its
> up to around 20 frames out of sync - once its rolling and in sync it
> remains in sync and does not drift - but the randomness of when it
> starts in sync and when it doesnt is whats stoping it being a
> solution atm

It definitely _will_ drift, even if it might not be enough to
matter for your use case.
However if only initial sync is an issue it might help to change
the code to start audio playback only once the first packet
from the master has been received.
It's not acceptable for SVN as-is, but something like this:
Index: mplayer.c
===================================================================
--- mplayer.c (revision 33574)
+++ mplayer.c (working copy)
@@ -3803,11 +3803,16 @@

/*========================== PLAY AUDIO ============================*/

+ static int udp_slave_startup = 1;
+#ifdef CONFIG_NETWORKING
+ if (!udp_slave || !udp_slave_startup)
+#endif
if (mpctx->sh_audio)
if (!fill_audio_out_buffers())
// at eof, all audio at least written to ao
if (!mpctx->sh_video)
mpctx->eof = PT_NEXT_ENTRY;
+ udp_slave_startup = 0;

if (!mpctx->sh_video) {
// handle audio-only case:

Reply all
Reply to author
Forward
0 new messages