'Inject frames into stream

I'm trying to inject and replace 100 frames in a RTSP stream every 3mins with those in another RTSP stream. For example, suppose streams A and B are both running at 25fps. Between t=00:00 and 03:00, the resulting stream will contain frames from A. Between t=3:00 and t=3:04 will contain frames from B - and repeat. The end result should be a RTSP/RTMP stream.

Is there a way to achieve this in FFMPEG (perhaps, without transcoding)?

Any advice appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source