[FFmpeg-trac] #6960(avfilter:new): In drawtext filter, option fix_bounds does not do anything

FFmpeg trac at avcodec.org
Thu Jan 11 15:37:17 EET 2018


#6960: In drawtext filter,option fix_bounds does not do anything
----------------------------------+--------------------------------------
             Reporter:  Gyan      |                     Type:  defect
               Status:  new       |                 Priority:  normal
            Component:  avfilter  |                  Version:  git-master
             Keywords:            |               Blocked By:
             Blocking:            |  Reproduced by developer:  0
Analyzed by developer:  0         |
----------------------------------+--------------------------------------
 Summary of the bug:

 The boolean option fix_bounds in the drawtext filter does not bound the
 text when enabled.

 How to reproduce:
 {{{
 % ffplay -f lavfi
 "color,drawtext=fontfile=/path/to/font:fontcolor=white:x=-100:y=-100:fix_bounds=1:text='Can
 you see me now?'"
 }}}

 The no-op commit e496c45 from Libav introduced an option which allowed the
 user to relocate text to fit within the frame if it was going out of
 bounds.

 For some reason, when the merge commit b479e01 was applied, the option was
 added but the code fragment (shown below) which implemented it, was not.
 So the option was dead on arrival, and has remained impotent.

 {{{
     if (dtext->fix_bounds) {
         if (dtext->x < 0) dtext->x = 0;
         if (dtext->y < 0) dtext->y = 0;
         if ((unsigned)dtext->x + (unsigned)dtext->w > inlink->w)
             dtext->x = inlink->w - dtext->w;
         if ((unsigned)dtext->y + (unsigned)dtext->h > inlink->h)
             dtext->y = inlink->h - dtext->h;
     }
 }}}

 Patch sent to ffmpeg-devel with new implementation that respects the text
 styling elements like shadow or box. Default value changed to false so
 that filter outcome doesn't change in existing scripts.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/6960>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list