[FFmpeg-user] drawtext so that it cover whole page

anshul anshul.ffmpeg at gmail.com
Mon Jan 27 11:34:00 CET 2014


On 01/27/2014 03:52 PM, Carl Eugen Hoyos wrote:
> anshul <anshul.ffmpeg <at> gmail.com> writes:
>
>> I want to use  drawtext filter of ffmpeg so that my
>> fontsize is automatically increased in such a way,
>> so that it cover whole frame.
> What happens if you set the video height as fontsize?
>
> Carl Eugen
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
If i set fontsize as some percentage of video  height, then it would 
work only for single word not for paragraphs

I am looking for solution for paragraphs, just now my code is too dirty 
it works some time but
also fails many time, since I have not consider actual rndered height 
but it I am considering max_glyph_w max_glyph_h
for a particular font on basis of font size

If anyone interested, this is some part of my code in python

     //arialbd character have 4/3 w/h ratio
     font_size = int(math.sqrt( (w*h*4)/ (len(istr) *3) ))

         if mlen > (w/font_size):
             font_size = w/mlen

         line_split = 2*(w/font_size)
         font_size = str(font_size)
         out_word = ""
         sword = ""
         num_lines = 1
         for word in istr.split(" "):
             if len(sword + word) > line_split:
                 out_word = out_word + sword + "\f"
                 sword = word
                 num_lines += 1
             else:
                 sword = sword + " " + word
         out_word = out_word + sword




Thanks
Anshul


More information about the ffmpeg-user mailing list