<p>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.  </p>

CC BY-SA 4.0
2019-08-12T21:14:01.440Z
Yes. Of course. But the filters I am targeting should only read frames (for detection. Like freezedetect, silencedetect, and blackdetect).
angel_30
CC BY-SA 4.0
2019-08-12T21:27:54.787Z
Btw, when calling a filter, it gets a `buffersrc` along with the frame. Each filter should have its own buffer, right?
angel_30
CC BY-SA 4.0
2019-08-12T18:56:18.430Z
2019-08-12T18:56:18.430Z
SlimSCSI
<p>I successfully applied a FFmpeg filter from C API (my previous question <a href="https://video.stackexchange.com/questions/27554/call-ffmpeg-filter-from-source-code-c-api">here</a>). 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.</p>

<p>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.</p>

<video><ffmpeg><video-editor><streaming><decoding>
FFmpeg run multiple filters in parallel from C API
angel_30
# FFmpeg run multiple filters in parallel from C API

(Asked by: username_0 on 2019-08-12)

I successfully applied a FFmpeg filter from C API (my previous question [here](https://video.stackexchange.com/questions/27554/call-ffmpeg-filter-from-source-code-c-api)). 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.

**Tags:** video, ffmpeg, video-editor, streaming, decoding


---

## 1 answers

### Answer by username_1 on 2019-08-12. Score: 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.

> **Comments:**
> **username_0**: Yes. Of course. But the filters I am targeting should only read frames (for detection. Like freezedetect, silencedetect, and blackdetect).  
> **username_0**: Btw, when calling a filter, it gets a `buffersrc` along with the frame. Each filter should have its own buffer, right?  

---

