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:
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):
The solution I'm looking for is to utilize some clever ffmpeg approach:
- ffmpeg opens the stream on MachineA
- 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:
- fill up the buffer
- 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.