I'm trying to achieve something pretty simple, but it's very hard to describe:

There is a live video stream which uses h264 for it's video, and m4a for it's audio. This stream is not mine, and I have absolutely no control on it: I can use it as-is.

The required transfer bandwidth graph looks like this below:

enter image description here

Huge impact when there is a keyframe, then relax period until next keyframe.

My MachineA receives this stream, and I want to republish it to my other MachineB (only to 1 single place).

Why? Because MachineA can receive the stream, however MachineB (due to geo-lock), can't.

But, between MachineA and MachineB there is a VPN, so MachineA could (and actually can) forward (republish) the stream to MachineB.

The only problem is, that there is a bandwidth limitation between MachineA and MachineB, which causes the stream to quite frequently pausing: (green line shows the bandwidth limitation):

enter image description here

The solution I'm looking for is to utilize some clever ffmpeg approach:

  1. ffmpeg opens the stream on MachineA
  2. On MachineB I open the stream from MachineA, and buffers it for X seconds, before playing.

So I basically want to solve this problem similar to old-school disc-man's anti-shock protection:

  1. fill up the buffer
  2. play the buffer

This was a FIFO approach, ie.: MachineA sends a frame to MachineB, which puts it into buffer. Once buffer is full, MachineB starts feeding it to decoder. This way it can smoothen the bandwidth, as long as the average bandwidth of the stream is less-than-equal to the max bandwidth of the VPN between machines.

How could I manage this with ffmpeg? I.e.: ffmpeg on MachineA receives the stream and republish to ffmpeg on MachineB. ffmpeg on MachineB applies this FIFO approach, and then it displays the received stream.

1 Answer 1


You might have done by this time. Please share if done.

ffmpeg -i input -c copy -f fifo -fifo_format flv -map 0:v -map 0:a rtmp://url

Ref: http://underpop.online.fr/f/ffmpeg/help/fifo.htm.gz

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.