Search code examples
ffmpeg

How to draw a text with perspective using ffmpeg


I need to add a text to a video using ffmpeg and it needs to be with perspective like in the image.

img

i have tried with perspective but i get perspective into the whole video not only the text.

How can i do this?


Solution

  • You want to add a text overlay, so your best option is to pick a perspective font and use that, with the drawtext filter.

    Here's an example with the font Therp. It isn't perfect but might point you in the right direction.

    ffmpeg -i input.mp4 -vf "drawtext=fontfile=./.fonts/Therp.ttf:text='Perspective': x=300: y=300:font='Therp Regular':fontsize=40:fontcolor=white:" -c:a copy -f matroska - | ffplay -autoexit -i -
    

    Result:

    enter image description here