Wowza Community

How can I add a pre-transcode delay / buffer?

How can I increase the input buffering for an incoming stream, or otherwise add a fixed time delay (something between 15-45s), before the stream is transcoded?

Our video application has late arriving overlays. So this delay needs to be on the “input” side of things (pre-overlay application).

I believe there is an 8s input buffer but the impression I had was that this was primarily for handling jitter.

I can double check, but I’m not sure on the input side. I will check for you though.

There is a EXT-X-PROGRAM-DATE-TIME tag that can be added to the manifest which should specify the exact presentation time of a chunk so if the player supports it then it could maybe be used for alignment.

[https://tools.ietf.org/html/draft-pantos-http-live-streaming-13#section-3.4.5](https://tools.ietf.org/html/draft-pantos-http-live-streaming-13#section-3.4.5)
[https://www.wowza.com/docs/how-to-control-display-of-program-date-and-time-headers-in-apple-hls-chunklists-for-live-streams-ext-x-program-date-time](https://www.wowza.com/docs/how-to-control-display-of-program-date-and-time-headers-in-apple-hls-chunklists-for-live-streams-ext-x-program-date-time)

EXT-X-PROGRAM-DATE-TIME

sounds like a cool feature when synchronizing cameras, but I don’t think it will solve my problem.

I am applying overlays within the transcoder, and need the content to be ~30 seconds buffered for proper overlay + content synchronization. Hope we can find a way to do this!

One ugly way to accomplish this is to send in RTMP feed, then use stream target to automatically feed that stream back to a different source stream on localhost:1935. Transcode the looped back stream. I think this gives something like 7-10 seconds delay. I’d prefer a better solution, but if this was the only option, is there a way to add a longer delay now if we have this complete content path to play with?

I’m discussing with an engineer…be back soon. Thanks for sharing more info.

You can try a couple of things:

A. I’m not sure however how large you can safely make that buffer - it will chew up memory, but you can try this:

https://www.wowza.com/docs/how-to-fix-unaligned-video-and-audio-with-a-server-side-sort-buffer

B. Here is a particular module for adding delay to a stream:

http://www.wowzamedia.com/downloads/forums/publishwithdelay/PublishWithDelay.zip

You can tweak that so that you start up the transcoder after the delay.

Hope that helps.

Hi Ben,
you can use the module developed by our company - PWI Time-shift Streaming Addon for Wowza Streaming Engine . It will allow you to add 15-45s fixed delay to the incoming stream and transcode it after. Pls e-mail us if you are interested.

Thank you Alexey!

A. This works great, when I set the server-side sort buffer to 30000 (ms), I see that the transcoded video is delayed by an additional 30 seconds. I assume that this happens for all streams under that app.

It would be nice to do this on a per-transcoder basis. Is that possible?

B. I’m confused about how PublishWithDelay module works and exactly what it does. When I follow the README, the final step involves clicking on this not-really-documented window. I can tell I’m connecting but nothing really happens… ?

The first video object is the camera. The second is the non-delayed stream. The third is the delayed stream.

(that’s from the README included in the zip file)

But, you don’t really need to use this page, what you should see, when you add the module, is that all streams published to the application will generate another stream that is delayed (usually postfixed with Delay in the name)

The page is just to be able to run a test, but you can skip this page, and just publish a stream directly to the application.

I thought I knew what I was doing, but I am seeing some behavior that does not make sense.

This is what I want to happen:

RTMP source --> Sort Buffer --> Transcode --> Stream Target --> RTMP out
                   /               \
                  /                 \
 in properties/Streams       encodeOverlay.png
     sortPackets=True
     sortBufferSize=30000  

My goal is to have a 30s pre-transcode delay. This is because encodeOverlay.png is rendered 30s after the live event, so the delay allows proper matching of video + overlay.

I followed @Rose Power-Wowza Community Manager’s directions. In step A I configured as shown in diagram. I do not know if step B took but I was told this was optional. (is that correct?)

I can confirm that my video stream is delayed by an additional 30s under this configuration. So I was happy.

But when I do tests, it appears that encodeOverlay.png is being applied immediately to content coming from the RTMP source. And not content that is 30s old.

(1) This does not make sense to me, because I cannot imagine a sort buffer on the output side of the transcoder. Am I missing something?

(2) @video streaming mentioned that a delayed stream would be named _delay, but I do not see that name in “Incoming Streams”. Again, am I missing something?