0

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?

1
  • 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
    Commented Dec 1 at 8:50

1 Answer 1

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

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.