I successfully applied a FFmpeg filter from C API (my previous question here). I see the filters are running sequentially. Now the question is, how can I run multiple filters in parallel? If run sequentially, that causes so much delays.

I'm using ffmpeg as the base for stream processing. As we receive the streams, I need to apply 2 filters and produce metadata in parallel. Of course, with minimum delay issues.


Filters cant really run in parallel because they can modify frames, and you can’t modify a frame in two threads at the same time. You can make a copy of the frame and run two filter graphs.

  • Yes. Of course. But the filters I am targeting should only read frames (for detection. Like freezedetect, silencedetect, and blackdetect). – Tina J Aug 12 '19 at 21:14
  • Btw, when calling a filter, it gets a buffersrc along with the frame. Each filter should have its own buffer, right? – Tina J Aug 12 '19 at 21:27
  • Yes, you can use separate filtergraph for each detection filter you use, i dunno how much speed gain you can expect from this. It is same approach as running 2 or more ffmpeg commands in parallel. – Paul B. Mahol Aug 13 '19 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.