Wowza Community

Brief freezing of video when switching sources for an output stream

We built a custom module that allows us to switch between two different input streams for a single output stream. This is done by switching between two playlists, each with one input stream. We followed the line of the example in the following

https://www.wowza.com/docs/how-to-switch-streams-using-stream-class-streams

The switching works, but there’s frequently brief freezes (from a fraction of a second to up to 1-2 seconds) after the switch. During this brief moment, audio continues smoothly, but video does not.

We’re looking for any suggestions as to how to mitigate and minimize this kind of freezing.

Thank you.

I see that you have submitted ticket #340107 regarding this issue and I am following the conversation to see you get this resolved @Louis Wang.

Your engineers will be updating your ticket soon @Louis Wang, but for everyone here to know should they experience something similar, there is a property that can reduce that video delay. Normally, it will seek the next keyframe to switch streams, but in this case, it is best practice to have it look for the previous keyframe in the packet so it can switch without delay.

Try this property in your config:

stream.setStartLiveOnPreviousKeyFrame(true);

Also, you can configure how far back you’d like it to look back with this:

stream.setStartLiveOnPreviousBufferTime(time);

The default is 4100 ms, but you can adjust it to suit your needs.