Wowza Community

Synchronizing two videos - is it possible?

Hi all,

I’m trying to use Wowza for a project we’ve currently started to stream lectures.

The idea is to have two videos:

  • one with the lecture itself (e.g. video of the lecturer delivering the lecture)

  • one with the slides (e.g., for the moment, a video of the slides being projected).

The problem is that we need to ensure that the two videos run in synch. Is there any way of doing this?

If the problem is not clear enough, just think about the following problem: displaying the same music video in two streams tiled on the same page, in such a way that the two videos run exactly (or, for our goal, with at most 1sec of delay) at the same time.

Thanks to any help or hint!

Giuseppe Sollazzo

Systems developer and administrator

St George’s University of London

One way to do it is with cuepoints. Add cuepoints to the lecture video that trigger a function in the client that does a netstream.seek on the slide video.

You can use a program like Captionate to add cuepoints to a video, or you can add a cuepoint to live stream:

netstreamPublish.send("synchStreams", 50); 

In the Flash app that is going to play both videos, setup the cuepoint handler when you create the netstream that plays the lecture video:

var clientObj:Object;
clientObj.syncStreams = syncHandler;
netstreamLecture.client = clientObj;
netstreamLecture.play("lecture.flv");

private function syncHandler(seekTo:int):void
{
netstreamSlides.seek(seekTo);
}

Richard

JW Player is a Flash app (also called “the client” in a streaming application). If you are going to use a packaged player system like JW Player for this, you will need two of them, and you will have to use JW Player’s Javascript API to synchronize. And it requires modification to the Actionscript of JW player. The snip I showed is actionscript.

Another option that might be easier if you are going to go in this direction is the Wowza example player. It would easier to take that and modify it to have two video objects and synchronize as I outlined below just with actionscript and not have to bridge with javascript.

Richard

The examples are in the examples folder where Wowza is installed.

NetStream.send is actionscript used in Flash application that is publishing a live stream. I’m not really sure how to synch two live streams or the suggestion above. There are many scenarios. In some cases it might be possible, in others it is probably impossible.

Richard

netstream.send will not work because you are not publishing with Flash.

You could inject cuepoints with timecodes server-side. You can use the compact version in the 2nd post of the other thread you are posting in:

http://www.wowza.com/community/t/-/238#2

Then, you will need to modify the player somehow to read those cuepoints in each stream and adjust them as necessary.

The governor will be the system clock on the Wowza server where you are publishing each stream at the same time, and injecting cuepoints.

This would take a fair amount of work and experimenting. I have not done anything like this.

Richard

Hi Richard, thanks for the reply!

I would ask you a clarification. When you write the following code example, it’s not exactly clear to me what do you mean to “add to the Flash app that is going to play both videos”.

I will have a web page with a plugin, like JW player, to play the videos. (If you were suggesting something different, it’s alright - I can still experiment at this stage).

Sorry if my question is stupid. It’s my first experience with streaming and I’m trying to understand the whole issue better.

Thanks,

Giuseppe

In the Flash app that is going to play both videos, setup the cuepoint handler when you create the netstream that plays the lecture video:

var clientObj:Object;
clientObj.syncStreams = syncHandler;
netstreamLecture.client = clientObj;
netstreamLecture.play("lecture.flv");
private function syncHandler(seekTo:int):void
{
netstreamSlides.seek(seekTo);
}

Richard

Thanks a lot Richard, this was very helpful!

Best regards,

Giuseppe

Where can I find the Wowza example player?

I’m also trying to find a way of making 2 live streams in synch.

Is this method above still valid?

Do u have other methods of doing this now?

I’m using wowza 2.1.

The code for adding cuepoints is:

netstreamPublish.send(“synchStreams”, 50);

But where to put that code?

Our scenario is that we have one live main stream(audio&video in flv) send by wirecast and 3 more live streams(only audio in mp3 packed in flv) send by FMLE.

At the end we have all 4 streams in the content directory.

Later during the day we are using LiveStudio to rebroadcast all 4 streams.

We want that the 3 audio streams are in synch with the main stream.

What would be the best approach?