ffmpeg : setting a rectangle in a video to black

I want to set a rectangle in a video to black, so that each frame in the video will have this black rectangle. Is it possible ?

I want something similar to this: "How to put border around video to prevent clipping of content" but instead of a black border I want a black rectangle like this


Solution 1:

Ok, looking at the duck example I was able to do what I want:

./ffmpeg -y -i sample.mp4 -f lavfi -i color=c=black:s=30x40 -filter_complex "[1:v]scale=w=iw:h=ih[scaled]; [0:v][scaled]overlay=x=0.20*main_w:y=0.10*main_h:eof_action=‌​endall[out]; [0:a]anull[aud]" -map "[out]" -map "[aud]" -strict -2 outputfile.mp4 

this puts a 30X40 rectangle on the video.

also "drawbox" works:

ffmpeg -y -i sample.mp4 -vf "drawbox=x=10:y=10:w=100:h=100:[email protected]:t=fill"  outputfile.mp4