# Brief freezing of video when switching sources for an output stream

**URL:** <https://community.wowza.com/t/brief-freezing-of-video-when-switching-sources-for-an-output-stream/54285>\
**Category:** Wowza Streaming Engine\
**Created:** [December 4, 2019, 2:56pm UTC](https://community.wowza.com/t/brief-freezing-of-video-when-switching-sources-for-an-output-stream/54285 "2019-12-04T14:56:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Louis\_Wang](https://avatars.discourse-cdn.com/v4/letter/l/51bf81/32.png) [@Louis\_Wang](https://community.wowza.com/u/Louis_Wang)\
**Post date:** [December 4, 2019, 2:56pm UTC](https://community.wowza.com/t/brief-freezing-of-video-when-switching-sources-for-an-output-stream/54285/1 "2019-12-04T14:56:38Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![Rose\_Power-Wowza\_Com](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/rose_power-wowza_com/32/431_2.png) [@Rose\_Power-Wowza\_Com](https://community.wowza.com/u/Rose_Power-Wowza_Com)\
**Post date:** [December 4, 2019, 5:29pm UTC](https://community.wowza.com/t/brief-freezing-of-video-when-switching-sources-for-an-output-stream/54285/2 "2019-12-04T17:29:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![video\_streaming](https://avatars.discourse-cdn.com/v4/letter/v/22d042/32.png) [@video\_streaming](https://community.wowza.com/u/video_streaming)\
**Post date:** [December 4, 2019, 5:47pm UTC](https://community.wowza.com/t/brief-freezing-of-video-when-switching-sources-for-an-output-stream/54285/3 "2019-12-04T17:47:38Z")

</div>

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:

```auto
stream.setStartLiveOnPreviousKeyFrame(true);

```

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

```auto
stream.setStartLiveOnPreviousBufferTime(time);

```

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