0

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.

1 Answer 1

1

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.

3
  • Yes. Of course. But the filters I am targeting should only read frames (for detection. Like freezedetect, silencedetect, and blackdetect).
    – angel_30
    Commented Aug 12, 2019 at 21:14
  • Btw, when calling a filter, it gets a buffersrc along with the frame. Each filter should have its own buffer, right?
    – angel_30
    Commented Aug 12, 2019 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.
    – user12174
    Commented Aug 13, 2019 at 13:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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