<p>Simply chain the filters in a sequence.</p>
<p><code>ffmpeg -i video.mp4 -vf &quot;drawbox=x=0:y=0:w=5:h=3:color=#ff0000:t=fill:enable='not(mod(n,2))',drawbox=x=0:y=0:w=5:h=3:color=#00ff00:t=fill:enable='mod(n,2)'&quot; greenred.mp4</code></p>

CC BY-SA 4.0
2024-12-01T09:08:07.417Z
2024-12-01T09:08:07.417Z
Gyan
<p>I have a task to label video frames. I need to mark all odd frames of a video with green pixels and even ones with red pixels. I do this in two steps:</p>
<p><code>ffmpeg -i video.mp4 -filter_complex &quot;drawbox=x=0:y=0:w=5:h=3:color=#ff0000:t=fill:enable='not(mod(n,2))'&quot; green.mp4</code></p>
<p><code>ffmpeg -i green.mp4 -filter_complex &quot;drawbox=x=0:y=0:w=5:h=3:color=#00ff00:t=fill:enable='mod(n,2)'&quot; greenred.mp4</code></p>
<p>Can you please tell me how to combine this into one step?</p>

CC BY-SA 4.0
2024-12-01T08:50:37.223Z
Hi Dmitry - please post future questions in English, as this site is English speaking only. 
I used google translate for you this time.
Dr Mayhem
<ffmpeg>
How can I combine these ffmpeg commands into one step?
Dmitry
# How can I combine these ffmpeg commands into one step?

(Asked by: username_0 on 2024-12-01)

I have a task to label video frames. I need to mark all odd frames of a video with green pixels and even ones with red pixels. I do this in two steps:

`ffmpeg -i video.mp4 -filter_complex "drawbox=x=0:y=0:w=5:h=3:color=#ff0000:t=fill:enable='not(mod(n,2))'" green.mp4`

`ffmpeg -i green.mp4 -filter_complex "drawbox=x=0:y=0:w=5:h=3:color=#00ff00:t=fill:enable='mod(n,2)'" greenred.mp4`

Can you please tell me how to combine this into one step?

**Tags:** ffmpeg

> **Comments:**
> **username_1**: Hi username_0 - please post future questions in English, as this site is English speaking only.  I used google translate for you this time.  

---

## 1 answers

### Answer by username_2 on 2024-12-01. Score: 0

Simply chain the filters in a sequence.

`ffmpeg -i video.mp4 -vf "drawbox=x=0:y=0:w=5:h=3:color=#ff0000:t=fill:enable='not(mod(n,2))',drawbox=x=0:y=0:w=5:h=3:color=#00ff00:t=fill:enable='mod(n,2)'" greenred.mp4`


---

