Answer the question
In order to leave comments, you need to log in
Is it possible to implement picture in picture (ffmpeg \ rtmp streams) only when the second stream is active?
Conditions:
1. The main rtmp stream is broadcast (text and graphics are superimposed on it through drawtext and watermark through filter_complex)
2. When the second rtmp stream rises, it is embedded in the first one as PIP (without restarting ffmpeg)
3. The second stream also has drawtext (without watermark)
4. When the second PIP stream goes down, it disappears from the first one
. After restarting ffmpeg, it works, but without breaks in any way.
Maybe someone has ideas for implementation or a ready-made algorithm?
Answer the question
In order to leave comments, you need to log in
If implemented through NGINX, then through the use of stub statistics. Our task was different, to put a stub in the event of a collapse in the flow from the chamber. But it suits you too.
[LIVE] rtmp://*/live - Broadcast
[CAM1] rtmp://*/cam1 - Main camera << cam >> ffmpeg >> /live
[CAM2] rtmp://*/cam2 - Second camera << cam2 >> ffmpeg >> [wait]
[PIP] rtmp://*/pip - Where to split >> ffmpeg cam1 + cam2 >> /live
Here's how it will be in words in your case:
Every second the script checks on stub for the presence and speed of the cam2 stream. When the flow and speed appear, the ffmpeg process is killed [CAM1] and [PIP] is launched.
No other way has yet been found, a sharp change in the image looks live. We have a stub, so there is an intermediate point on ffmpeg pull. But in your task it is not needed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question