Forum

Play multiple videos (same resolution and frame count) absolutely synchronized?

Hey evvvveryone.

I already posted this in the VLC plugin comments. But hopefully more people will stumble upon it here:

Is there a way to play multiple looped 720p videos with the same frame count absolutely synchronized? I’ve done some testing with the newest VLC plugin and there’s always a slightly varying frame difference. Sometimes more, sometimes less.
The difference even gets bigger with every run if I don’t integrate a feedback loop that hits doseek as soon as one of the videos has reached the final frame.

would be awesome if there’s a way to get a grip on this.

That’s because every video plays in its own thread. I can only ask ‘could you please start playing this video’, and from then on it’s pretty much out of my control :)

What you could try is using avisynth to stick these 2 video-files together (StackVertical or Stackhorizontal), and only show the needed part of the texture.

(Vlc player can play avisynth files by using this nifty tool: avfs.)

not on a system with vlc right now, so I am not sure it works with vlc, but as far as I recall there is a speed setting on it, so it should work.

the way I have done it previously is that I use the position output to determine where the master is, then I compare the position on the second player with the position on the master player. if it is behind, I change the speed up a bit and if it is ahead, I change the speed down a bit. if it is the same I set the speed to 1. this is checked once every 10 seconds or so. and when the first video loop, then I just banged DoSeek to reset the video all over.
this sync info can also be sent via network to sync several machines over network.

this require that the video is encoded using a codec that allows for small adjustments of the speed, eg. mjpeg.

I hope it helps

-sunep

Thanks guys.

@ft: my knowledge about the deeper functionality of vvvv is not that vast. But for a better understanding: as you mentioned that every video plays in its own thread I remembered to read that vvvv is single threaded. How can every video have its own thread then?
In my understanding that means that every video should playback the same amount of frames by every iteration of vvvv. If that’s wrong (what’s obviously the case here) I’d be delighted to be enlightened :).

boy! ft, thanks for that avisynth hint.
I did some experiments with StackVertical and it seems to work just fine!
To test it, I merged 6 quite large videos into one video which I play with your VLC plugin.
My machine doesn’t really start to sweat… crazy.

@rosenfranz:
If people say vvvv is single threaded, that means that the main application has 1 thread, that will calculate a new frame every X milliseconds (or as fast as possible). Since the nodes are connected to each other, you have to start at the top-most node, and ask ‘calculate your new output now’. You have to wait for it to finish, and when you have the result, you can ask the next node down the line ‘calculate your output now with this input (that I just got from the node above you)’. In that sense vvvv indeed is single threaded.

But of course that doesn’t mean that a clever node can’t start calculating new values in a seperate thread, while waiting until the next time the ‘main thread’ asks for the current output. And this is typically true for video, where you will want to decode a new video-frame, and copy it to the graphics-hardware beforehand. Then, when vvvv asks for the next frame, you can immediately say “here it is, I already decoded it for you while waiting, because I knew you were going to ask :)”, instead of starting that whole process at that time, and making everything else wait until you have finished.

I hope this makes it a little more understandable.

would that be possible to have a nativ node in VVVV to synchronize perfectly videos ?

this is possible with the current alpha. the Sync node has a hidden pin IsClient for that use case. check the latest alpha where i added the pin to the boygroup module.

local_sync.v4p (9.9 kB)

ahhhhhhhh… thats great to hear !
does this synchronisation affect alos the sound ? ( remembering a nightmare with a long wvm source) ?

yes, audio works too, but it has a time filter on the directshow side, so it needs some frames more than the video to be in sync.

nice to read that, tonfilm!

ahh and thanks for the explanation ft. Made things quite clear.

Whoa, IRIS looks great, I totally missed that. :o

I have the same problem, but I dont mind if it resets everytime it reaches the end, how would I reset the clips.

Thanks

John

you just need to bang the Do Seek of the FileStream node with a Seek Time of 0.