Wowza Community

Live Recording RTMP stream to FLV resets timestamp on reconnects

Hi,

I’ve been experimenting with different codecs and saw the same issue in recoded FLV’s. Every time RTMP stream reconnects, timestamps in output FLV get reset. It’s somewhat expected as timestamps inside RTMP stream are relative to the header packet. Header packet may contain an absolute timestamp.

I just got a raw RTMP dump and found that timestamp is there. It looks like wowza does not use that value to make base offset for flv timestamps. Is this right? Is it possible to make timestamps more consistent and abosolute? I’m trying to come up with solution that keeps two RTMP coming from the same encoder (but different content) streams synchronized. Unfortunately, it’s unreliable because of timestamps resets as one of steams may reconnect. Is it possible to embed cue points with, say, UTC time in flv file on wowza side?

Did you see the updated docs that come with the patches? They should match the patched builds.

Charlie

We really don’t support synchronizing between streams like this. If what you are doing works then I guess it is fine. We are working with the encoder companies to make stream synchronization reliable so we can properly do adpative bitrate/smooth streaming.

Charlie

Ok, I’ve figured out this from the sample MediaWriter code. I want to refactor existing MediaWriter class. Is there source code in the ServerSideAPI.pdf the latest one? If not, where can I get the updated version? If there’s a simple way to adjust base timestamp for output flv file, I would be happy to hear how to do that. :slight_smile:

Thanks!

Alex,

You can download the latest patch here to get the latest documentation, including server-side api pdf.

You don’t have to apply the patch if you are not ready, just grab the pdf from the /documentation folder.

Richard

Thanks! I was able to customize MediaWriter for my needs now. Doc was still missing couple new methods though. :slight_smile:

Yes, I used docs from the latest patch6. Example for MediaWriter was still missing isWaitForKeyFrame() and setIsWaitForKeyFrame(). Not a big deal.

By the way, what would be in your opinion the right way to synchronize timestamps across multiple streams? Problem is that econders may connect and reconnect at different points of time, but I still want to keep output FLV’s synchronized having the same absolute timestamps.

I’m currently using currentTCs structure which is used for buffer timestamp adjustment in writePackets(). It’s a bit hackish. Output buffer is accessible only in writePackets(), and it’s called when buffer is ready for flush. So I also have to remember when the method was called and calculate start timestamps for secondary streams as

secondaryStreamTC = masterStreamTC + whenSecondaryWritePacketsWasCalled - whenMasterWritePacketsWasCalled

I do this at start of writePackets(). Like I said, it’s hackish, but it works in my test setup. Can I do something similar on the incoming stream?