drawtext automatic font size

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

drawtext automatic font size

FFmpeg-users mailing list

Hello, can someone please explain is it possible to make text fit in the picture with ffmpeg drawtext?
I have many various fonts and all have various size but i set "fontsize=48"

ffmpeg -i background.mp4 -vf "drawtext=text='Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua':x=240:y=570:fontfile=Caveat-Bold.ttf:fontsize=48:box=0:boxborderw=2:boxcolor=white@0.1:fontcolor=white@1:shadowcolor=black:shadowx=2:shadowy=3:enable=between'(t,0,5)'" -q:v 0 -threads 2 -video_track_timescale 30k -an -c:v libx264 -preset ultrafast -t 5 Caveat-Bold.mp4
and its make output like this:
https://www.infinitube.live/ffmpeg/Caveat-Bold.mp4
it draw many characters


but another font "TenorSans-Regular.ttf" draw much less letters in my video

ffmpeg -i background.mp4 -vf "drawtext=text='Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua':x=240:y=570:fontfile= TenorSans-Regular.ttf :fontsize=48:box=0:boxborderw=2:boxcolor=white@0.1:fontcolor=white@1:shadowcolor=black:shadowx=2:shadowy=3:enable=between'(t,0,5)'" -q:v 0 -threads 2 -video_track_timescale 30k -an -c:v libx264 -preset ultrafast -t 5  TenorSans .mp4

will results:
https://www.infinitube.live/ffmpeg/TenorSans.mp4


Maybe i can use some scale for font or i need calculate font width automaticaly before set it in " fontsize" option ? is it possible to make with ffmpeg?
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".