Search code examples
ffmpegdrawtext

How to drawtext in ffmpeg with box sampled from video?


As can be seen in these video screenshots, I would like to replace the hardcoded text in the upper left of the videos to another language.

What comes to mind is drawtext with a box. Due to different gradient backgrounds, I was thinking if there is a way so the drawtext box is (1) a gradient (geq?) and (2) the colors are automatically sampled from the video background (along the edges of the box).

For each specific video file, the background gradient doesn't change, so it can be sampled only once for each file.

Any suggestions on how this might be achieved?

enter image description here


Solution

  • FFmpeg delogo filter

    For the videos above, I used: (set show=1 to test)

    delogo=x=85:y=47:w=300:h=40:show=0

    drawtext filter can be used with delogo in one go in ffmpeg/ffplay on chained -vf values.

    delogo results are impressive. I wonder what the algos are. Pretty fast too.