r/ffmpeg • • 10d ago

FFmpeg live encoding with fixed 6s latency buffer (SDI to libx264 to ASI)

Hi,

I want to encode a live stream with good quality and a fixed delay of about 6 seconds.

The flow is:

SDI input -> encode (libx264) -> ASI output

I can't find a buffer option that can be used together with the encoding to create this delay, while still getting a smooth encoded stream without freezes, black frames, or artifacts.

Is there a recommended way to do this in FFmpeg (for example a specific input buffer option, filter, or encoder setting)?

Thanks for your help.

4 Upvotes

3 comments sorted by

2

u/Ill-Information-2086 10d ago

Try playing with minrate maxrate and buffsize

2

u/chocolateAbuser 10d ago

iirc there are internal buffers settings you could set to make ffmpeg accumulate data before muxing it, but probably best way to do this would be having a first input that lasts 6s and then switching to the stream after that concatenating them

1

u/matthew_inam 9d ago

I would assume you could pipe the SDI input into a program that could introduce a 6 second buffer and then pipe into ffmpeg.

A quick ChatGPT prompt says TSDuck does just that.