Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#2769 closed enhancement (worksforme)

drawtext: draw expression on a range on frames

Reported by: Charlie Owned by:
Priority: normal Component: avfilter
Version: unspecified Keywords: drawtext
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
Hi, drawtext option has a 'draw' expression that specifies if the text should be drawn.
http://www.ffmpeg.org/ffmpeg-filters.html#drawtext-1

I figured out we could use the following expressions to write on, before, or after a specific frame: :draw='eq(n,42)', :draw='lt(n,42)', :draw='gt(n,42)'

Do you know how to combine two expressions to write text, for instance, on every frame between frames 10 and 42 ?
I couldn't find doc or examples for combining expressions, and the following don't work:
:draw='gt(n,10)&&lt(n,42)' -> crash
:draw='gt(n,10);lt(n,42)' -> only applies second expression
:draw='gt(n,10)':draw='lt(n,42)' -> only applies second expression

Thanks in advance

How to reproduce:

% ffmpeg -i test.mov -vf "[in]drawtext=fontsize=40:fontcolor=White:fontfile='/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf':draw='gt(n,10)':draw='lt(n,42)':text='test':x=50:y=35" -vframes 60 -qscale 0 -preset medium -vcodec libx264 -pix_fmt yuv420p -strict experimental -y test.mp4
ffmpeg version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
  built on Apr  2 2013 17:02:36 with gcc 4.6.3

Change History (6)

comment:1 by Carl Eugen Hoyos, 11 years ago

Component: FFmpegavfilter
Keywords: fraw expression range frame removed
Version: 0.8.14unspecified

in reply to:  description comment:2 by Carl Eugen Hoyos, 11 years ago

Resolution: worksforme
Status: newclosed

Replying to Charlie:

Do you know how to combine two expressions to write text, for instance, on every frame between frames 10 and 42 ?

The following works fine here:
draw='gt(n,10)*lt(n,42)'
draw='if(gt(n,10),lt(n,42))'
See http://ffmpeg.org/ffmpeg-all.html#Expression-Evaluation and please understand that this is a bug tracker, post usage questions on the ffmpeg-user mailing list.

Last edited 11 years ago by Carl Eugen Hoyos (previous) (diff)

comment:3 by Charlie, 11 years ago

Hi cehoyos,
I'm sorry if I posted my question on the wrong website.
I already read this article but I couldn't find an answer both on ffmpeg & libav documentations.
However, I've just found the answer in an ffmpeg forum: http://ffmpeg.gusari.org/viewtopic.php?f=16&t=769&p=1351&hilit=drawtext#p1351

:draw='gt(n,10)*lt(n,42)'

Thanks

comment:4 by Charlie, 11 years ago

RE: just saw your answer. Thank you very much.
If I have another doc question, I'll use the mailing list.

comment:5 by Elon Musk, 11 years ago

You are using ffmpeg from Libav and reporting their bug on FFmpeg but tracker.

comment:6 by Charlie, 11 years ago

Hi richardpl, sorry for my mistake.

Note: See TracTickets for help on using tickets.