Opened 6 years ago

Closed 6 years ago

#6960 closed defect (fixed)

In drawtext filter, option fix_bounds does not do anything

Reported by: Gyan Owned by:
Priority: normal Component: avfilter
Version: git-master Keywords: drawtext
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

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.

Change History (2)

comment:1 by Gyan, 6 years ago

Summary: In drawtext filter,option fix_bounds does not do anythingIn drawtext filter, option fix_bounds does not do anything

comment:2 by Carl Eugen Hoyos, 6 years ago

Keywords: drawtext added
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.