Skip to main content
Inspiring
May 16, 2011
Question

Sync of two FLV files.

  • May 16, 2011
  • 1 reply
  • 1043 views

Hi

We developed one application in which a user can chat with a customer. But FLV size of user is double than that of customer FLV. At the time of playing we are getting problem of sync issue between FLV files. We are setting buffer size of 10 seconds.

Is their any other way so that we can sync both FLV and an officer can view the communication of user and customer.

Is DVR helps in sync? If yes then how?

Please reply.

Thanks

    This topic has been closed for replies.

    1 reply

    May 16, 2011

    DVR doesn't hepl sync between two files... it just records live streams.

    About the flv files in question, do they both start at the top of the file, or do you need to manage offsets in time? It's possible to sync two recorded streams, but the best approach depends on the files and whether they are timed to both start from the first frame in the file.

    Inspiring
    May 16, 2011

    Hello

    We need to sync the conversation of both user and customer as happened in the live chating. Suppose we have two files A and B. B size is double than the size of A. When we are trying to play the recorded file using bufferTime set to 10 seconds at that time file B buffered less as compare to file A which causes miscommunication.

    Suppose in the recording time we have file B :- Whats your name?

    File A :- Samir

    At the playing time we are getting file B: What

    File A :Samir

    This cause a major problem. How to resolve this?

    Thanks

    May 16, 2011

    I find that using bufferTime alone really isn't enough to kep sync. Here;s what I do:

    1. During recording, I inject timestamps into each of the recording streams on an interval (i typically do one every 250ms). This is done using Stream.send. I use system time in milliseconds as the timestamp value.

    2. In the playback application, I have methods on my netstreams' client objects that receive the calls with the timestamps.

    3. during playback, I monitor the current timestamp from each netstream. If there is more than 250ms difference between them, I pause the stream with the greater timestamp, and wait for the timestamp on the other stream to catch up.

    By taking this route, I'm able to keep perfect sync between the streams, with a variance of 500ms or less.

    Also, when the streams first start playing, but before displaying video or audio, i inspect the first timestamp received from each stream. If there is a large difference (for example, if one stream started recording several minutes before the other), I'll perform a seek operation on the stream with the smaller timestamp to get to the point in the video where both streams have media. This may or may not be suitable for your application.... you may just want to pause the stream with the greater timestamp until the stream with the smaller timestamp has played to the point where the other stream come in.