2

We seek a command to be able to add/remove video/audio inputs on the fly and apply filters without restarting a command. That way, we may continuously manipulate the output stream without restarting it - both a recorded file as well as the stream. Is it feasible doing?

We tried this approach Switch video from webcam while stream live but it only manipulates existing inputs.

  • 1
    It's possible switching between 2 inputs on the fly, but the input streams must be "alive" all the time. I was playing with it, and got the following example: `ffmpeg -y -re -f lavfi -i testsrc=size=192x108:rate=25 -re -f lavfi -i color=blue:size=192x108:rate=25 -f lavfi -i sine=frequency=500 -filter_complex "sendcmd='0.0 streamselect map 0',zmq,streamselect@my=inputs=2:map=1" -vcodec libx264 -tune zerolatency -crf 17 -pix_fmt yuv420p -f flv pipe: | ffplay -probesize 1024 pipe:`. Switching (in Windows) execute: `echo streamselect@my map 1 | zmqsend` and `echo streamselect@my map 0 | zmqsend`. – Rotem Nov 27 '22 at 17:10
  • 1
    Thanks for a reply. The problem we have is that we need adding/removing a stream on the fly. Switching is quite limited. – Petro O. Bochan Nov 27 '22 at 18:57
  • You may try using HLS protocol as suggested [here](https://stackoverflow.com/a/42817449/4926757). I don't think it's possible adding/removing a stream on the fly. – Rotem Nov 27 '22 at 21:15
  • @PetroO.Bochan I'm not sure what you're building, but you might find it easier to do this sort of thing in your own application. I do similar things in Node.js, executing FFmpeg as a child process. FFmpeg's native `nut` container can be used to send data from one child process, to your application, and then out to a different child process. – Brad Nov 28 '22 at 05:18
  • Thanks for feedback, we are trying to add/remove inputs on the fly without restarting ffmpeg so that when we do rtmp streaming clients don't get disconnected. We are able to manipulate the existing streams that were added at the command start but are unable to add/remove more. – Petro O. Bochan Nov 28 '22 at 08:32

0 Answers0