# Keep stream alive for 2 sec after unpublish

**URL:** <https://community.wowza.com/t/keep-stream-alive-for-2-sec-after-unpublish/48675>\
**Category:** Wowza Streaming Engine\
**Created:** [May 6, 2017, 7:08am UTC](https://community.wowza.com/t/keep-stream-alive-for-2-sec-after-unpublish/48675 "2017-05-06T07:08:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Crys.fmA](https://avatars.discourse-cdn.com/v4/letter/c/e480ec/32.png) [@Crys.fmA](https://community.wowza.com/u/Crys.fmA)\
**Post date:** [May 6, 2017, 7:08am UTC](https://community.wowza.com/t/keep-stream-alive-for-2-sec-after-unpublish/48675/1 "2017-05-06T07:08:45Z")

</div>

I am streaming VOD files(http) to WOWZA server(RTMP). My problem is Wowza RTMP player skips playing last sec of the video file. Any solution?

I guess keeping alive unpublished stream will fix this. Is is possible?

Tried multiple approaches to fix the issue but couldn’t succeed.

My Encoders - ffmpeg, avconv & gstreamer  
VOD files are mp4(H.264/AAC) stored on remote server

**Encoder Code:**

**gstreamer**

gst-launch-1.0 uridecodebin name=uridec uri=http://www.example.com/videofilename.mp4 ! queue ! videoconvert ! x264enc ! flvmux streamable=true name=mux ! queue ! rtmpsink location=‘rtmp://localhost:1935/live/gtest live=true’ uridec. ! audioconvert ! voaacenc ! queue ! mux.

**ffmpeg**

ffmpeg -re -i [http://www.example.com/videofilename.mp4](http://www.example.com/videofilename.mp4) -codec copy -f flv “rtmp://localhost:1935/live/lineartvtest live=1”

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/system/32/447_2.png) [@system](https://community.wowza.com/u/system)\
**Post date:** [May 6, 2017, 11:46pm UTC](https://community.wowza.com/t/keep-stream-alive-for-2-sec-after-unpublish/48675/2 "2017-05-06T23:46:44Z")

</div>

The moment an encoder disconnects all packetizers are flushed. If you were delivering segmented content such as HLS then the playlist and all segments will be flushed as well.
