Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-12T21:14:01.440Z
Answers.Text: Yes. Of course. But the filters I am targeting should only read frames (for detection. Like freezedetect, silencedetect, and blackdetect).
Answers.UserDisplayName: angel_30
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-12T21:27:54.787Z
Answers.Text: Btw, when calling a filter, it gets a `buffersrc` along with the frame. Each filter should have its own buffer, right?
Answers.UserDisplayName: angel_30
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-12T18:56:18.430Z
Answers.LastActivityDate: 2019-08-12T18:56:18.430Z
Answers.UserDisplayName: SlimSCSI
Body: <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>
  
Tags: <video><ffmpeg><video-editor><streaming><decoding>
Title: FFmpeg run multiple filters in parallel from C API
UserDisplayName: angel_30
ThreadText: # 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?  
  
  ---
  
  