watermark text with background at the bottom center of video

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

watermark text with background at the bottom center of video

davidjesse
I am currently using the following command which writes text with a black background, but the text goes to the top left of the video.

ffmpeg -i myvideo.flv -vf drawtext="fontfile=/root/video/Bristol.otf: text='Stack Overflow': fontcolor=white: fontsize=24: box=1: boxcolor=black@1:  x=(w-text_w)/2: y=(h-text_h)/2" -codec:a copy output.flv

I want to have a full black background cover the bottom of the video and in the center of the black background write the text.

How would I achieve this?
Reply | Threaded
Open this post in threaded view
|

Re: watermark text with background at the bottom center of video

Peter White
Am 21.07.2016 um 04:48 schrieb davidjesse:
 > ffmpeg -i myvideo.flv -vf
 > drawtext="fontfile=/root/video/Bristol.otf:
 > text='Stack Overflow': fontcolor=white: fontsize=24: box=1:
 > boxcolor=black@1:  x=(w-text_w)/2: y=(h-text_h)/2" -codec:a copy
 > output.flv
 >
 > I want to have a full black background cover the bottom of the video
 > and in the center of the black background write the text.

Well, it works for me. The text goes to the *center* of the image
though, which is due to "y=(h-text_h)/2". Don't divide by 2 and it
goes to the bottom.
Also, the box does not span the whole width of the video. I think that
cannot be achieved with this filter though, because there is no way to
specify the width of the box.

Have you tried the latest git master? Maybe there is a bug in an older
version.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: watermark text with background at the bottom center of video

davidjesse
I think the best way would be to draw the box first with the drawbox filer and then write text over it.

I was able to draw a box with the following filter

drawbox=x=10:y=10:w=100:h=100:color=pink@0.5:t=max

But I get the following errors when I change the x and y params

 drawbox="x=(w-text_w)/2:y=(h-text_h):w=3000:h=10:color=black@1:t=max"


[Parsed_drawbox_0 @ 0x9fd7a0] [Eval @ 0x7ffcafc98720] Undefined constant or missing '(' in 'text_w)/2'
[Parsed_drawbox_0 @ 0x9fd7a0] [Eval @ 0x7ffcafc98720] Undefined constant or missing '(' in 'text_h)'
[Parsed_drawbox_0 @ 0x9fd7a0] [Eval @ 0x7ffcafc98720] Undefined constant or missing '(' in 'text_w)/2'
[Parsed_drawbox_0 @ 0x9fd7a0] [Eval @ 0x7ffcafc98720] Undefined constant or missing '(' in 'text_h)'
[Parsed_drawbox_0 @ 0x9fd7a0] [Eval @ 0x7ffcafc98720] Undefined constant or missing '(' in 'text_w)/2'
[Parsed_drawbox_0 @ 0x9fd7a0] [Eval @ 0x7ffcafc98720] Undefined constant or missing '(' in 'text_h)'
[Parsed_drawbox_0 @ 0x9fd7a0] [Eval @ 0x7ffcafc98720] Undefined constant or missing '(' in 'text_w)/2'
[Parsed_drawbox_0 @ 0x9fd7a0] [Eval @ 0x7ffcafc98720] Undefined constant or missing '(' in 'text_h)'
[Parsed_drawbox_0 @ 0x9fd7a0] [Eval @ 0x7ffcafc98720] Undefined constant or missing '(' in 'text_w)/2'
[Parsed_drawbox_0 @ 0x9fd7a0] [Eval @ 0x7ffcafc98720] Undefined constant or missing '(' in 'text_h)'
[Parsed_drawbox_0 @ 0x9fd7a0] [Eval @ 0x7ffcafc98720] Undefined constant or missing '(' in 'text_w)/2'
[Parsed_drawbox_0 @ 0x9fd7a0] Error when evaluating the expression '(w-text_w)/2'.
[Parsed_drawbox_0 @ 0x9fd7a0] Failed to configure input pad on Parsed_drawbox_0
Error opening filters!

Reply | Threaded
Open this post in threaded view
|

Re: watermark text with background at the bottom center of video

Peter White
Am 22.07.2016 um 01:58 schrieb davidjesse:
  > But I get the following errors when I change the x and y params
  >
  >  drawbox="x=(w-text_w)/2:y=(h-text_h):w=3000:h=10:color=black@1:t=max"

That's because the drawbox filter does not know anything about
text_w or text_h. Also w and h are the desired box dimensions not the
dimensions of the video. And BTW, x should be 0, if you want the box
to span from the left to the right edge of the frame. Also, you can
omit w if the box shall span the video width.
Have a look at which constants this filter accepts.

Here is an example that works:

    drawbox="y=(ih-h):h=30:color=black@1:t=max"
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

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