Keep stream alive for 2 sec after unpublish

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 -codec copy -f flv “rtmp://localhost:1935/live/lineartvtest live=1”

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.