E
E
Eugene2017-01-20 01:06:26
fmpeg
Eugene, 2017-01-20 01:06:26

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

2 answer(s)
A
alexdora, 2017-01-20
@alexdora

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.

E
Eugene, 2017-01-22
@psypride

An interesting solution, but I have 10 threads, the embedding of which can vary in any form.
Came to a solution similar to yours, only through python/screen/ffmpeg, thanks.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question