Skip to main content
Participant
December 8, 2006
Answered

Playing (and keeping in synce) multiple video streams?

  • December 8, 2006
  • 8 replies
  • 891 views
Hello All,

I wonder whether the following is possible with Flash Media Server:

We record technical breakout sessions at conferences, and we're looking for a way for people to watch them later with a very good user experience. Right now we are giving the presenters Camtasia to record their screen actions, which we then encode into one video file. We also use a video camera to record the presenter from the waist up, which we encode to a second video file. So now we have two video files that we'd like to keep in sync to display to the user simultaneously.

Is it possible to use Flash Media Server along with a custom player to do this?

Fundamentally I don’t think it would be too hard to create a single set of playback controls that sent playback request time codes back to two separate video streams. The problem as I see it would be what would happen if one of the streams lagged and had to pause to buffer while the other stream continued forward? In this case the two streams would become out of sync. Our current solution involves us rendering both streams into a single video file, which is very labor intensive and doesn't give us any flexibility down the road, but this is all we could do to guarantee that they would stay in sync as the user jumped around or as it paused for buffering.

Any thoughts?

Thanks,
Brian
    This topic is closed to new replies. Start a new post to keep the conversation going.
    Correct answer
    Unfortunately, there's no really accurate means of keeping streams in sync with FMS.

    Since there's no timecode to speak of, there's nothing to sync by other than netstream time. The only way I know of to sync by ns time is to pause and restart streams as they get out of sync, but since an FMS stream doesn't stay in cache and the buffer empties as soon as you pause the stream, it will have to rebuffer every time it's resumed. Even with a zero buffer, there's still the time it takes for the first few kb of data to get to the client, so there would still be some misalignment.

    Is FMS a requirement? I wonder if using an http application server to fake the stream might be a workable solution (example http://flashcomguru.com/index.cfm/2005/11/2/Streaming-flv-video-via-PHP-take-two ). With a progressive video, the data is in cache and you have access to bytesloaded/bytestotal as well as netstream time, so I'd think you'd be able to achieve the sync you're looking for.

    8 replies

    Participating Frequently
    December 13, 2006
    This is an old and annoying problem. The strategy suggested by Vinicius Hacebe may improve the behaviour but remain problematic. Serving a pre-recorded stream as if realtime (play method server side), can force the player to loose frames accurately only when the FLV has been encoded by a Flash Player. Infact a Flash Player encoded FLV contain D-frames (desposable frames).

    Fabio Sonnati
    http://flashvideo.progettosinergia.com
    December 13, 2006
    Oddly enough, the behavior is completely different with progressive video. I have an old laptop with a 500mhz P3 with 128mb of memory I use for testing (just barely enough resources to get windows and a browser running), and I've found that the flashplayer does a pretty good job of dropping frames to keep the playhead at the proper time.

    For a recent proof-of-concept I did, I had two videos side-by side, one at 5fps/100kbps and the other at 24fps/400kbps. On the weak laptop, the 5fps video played at it's proper framerate, where the 24fps video played at around 8fps. Although a lot of frames were dropped from the 24fps video, the audio was solid, and the stream times stayed in sync (within about 750-800ms) for the duration of playback.
    Participating Frequently
    December 14, 2006
    Jay, you are talking about discart frames, when frames are already in memory.
    In this case, the frame is decompressed but not displayed if the CPU is too slow.

    Known Participant
    December 11, 2006
    maybe if you many live stream in the server and attach each stream to each server-side stream, the user will drop frames, but will always keep the Playhead!

    I am not sure about it, but I was wondering about it!
    December 12, 2006
    quote:

    Originally posted by: Vinicius Hacebe
    maybe if you many live stream in the server and attach each stream to each server-side stream, the user will drop frames, but will always keep the Playhead!

    I am not sure about it, but I was wondering about it!


    I pulled my hair out for a while trying to get it to work... but all I got for it was less hair.

    The problem is, if you pause/seek an FMS stream, the buffer empties out. Since there's no way to make the videos buffer at the same rate, and pausing causes the buffer to empty, you can't really stop one stream to wait for another to buffer in. It's a vicious cycle really.

    It would be really nice if we could make the buffer persistent until the netstream is closed. If we could pause a stream, and keep the buffered data in buffer, we'd be able to sync.

    Participant
    December 8, 2006
    Nah, FMS is not a requirement. I was undecided on which media platform, although with that link, if I could just use my regular web server that would be great.

    I'll look more into this.
    Thanks,
    Brian
    December 8, 2006
    I should mention that you only need the php proxy if you need your viewers to be able to seek through the presentation (before the seek point has been downloaded by both streams). IF you don't need that functionality, you could do it with just netstream connections to the http server.
    Correct answer
    December 8, 2006
    Unfortunately, there's no really accurate means of keeping streams in sync with FMS.

    Since there's no timecode to speak of, there's nothing to sync by other than netstream time. The only way I know of to sync by ns time is to pause and restart streams as they get out of sync, but since an FMS stream doesn't stay in cache and the buffer empties as soon as you pause the stream, it will have to rebuffer every time it's resumed. Even with a zero buffer, there's still the time it takes for the first few kb of data to get to the client, so there would still be some misalignment.

    Is FMS a requirement? I wonder if using an http application server to fake the stream might be a workable solution (example http://flashcomguru.com/index.cfm/2005/11/2/Streaming-flv-video-via-PHP-take-two ). With a progressive video, the data is in cache and you have access to bytesloaded/bytestotal as well as netstream time, so I'd think you'd be able to achieve the sync you're looking for.