[FFmpeg-trac] #4008(avfilter:new): "main_w" value unrecognized with the new "enable" option in Drawtext

FFmpeg trac at avcodec.org
Sun Oct 5 22:52:42 CEST 2014


#4008: "main_w" value unrecognized with the new "enable" option in Drawtext
-------------------------------------+-------------------------------------
             Reporter:  beloko       |                     Type:  defect
               Status:  new          |                 Priority:  important
            Component:  avfilter     |                  Version:  2.4.2
             Keywords:  main_w       |               Blocked By:
  main_h draw enable                 |  Reproduced by developer:  0
             Blocking:               |
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Hello,

 Here is the Drawtext command I used early for write a text onto video
 output only when video input resolution width is between 700p and 1200p :


 {{{
 -filter_complex
 "drawtext=fontfile='/Windows/Fonts/arial.ttf':text='HELLO
 TEXT':fontsize=47:fontcolor=yellow:x=(main_w/2-text_w/2):y=(main_h/2-
 text_h/2):draw=gte(main_w\,700)*lte(main_w\,1200)"

 }}}


 Since "draw" option is deprecated, we have to used "enable" option instead
 :


 {{{
 -filter_complex
 "drawtext=fontfile='/Windows/Fonts/arial.ttf':text='HELLO
 TEXT':fontsize=47:fontcolor=yellow:x=(main_w/2-text_w/2):y=(main_h/2-
 text_h/2):enable=gte(main_w\,700)*lte(main_w\,1200)"

 }}}

 But now with the "enable" option I get this error :


 {{{
 [drawtext @ 0000000002be6c00] [Eval @ 000000000022ec20] Undefined constant
 or mi
 ssing '(' in 'main_w,1200)'

 [drawtext @ 0000000002be6c00] Error when evaluating the expression
 'gte(main_w,7
 00)*lte(main_w,1200)' for enable

 [AVFilterGraph @ 0000000002b42be0] Error initializing filter 'drawtext'
 with arg
 s 'fontfile=/Windows/Fonts/arial.ttf:text=HELLO
 TEXT:fontsize=47:fontcolor=yello
 w:x=(main_w/2-text_w/2):y=(main_h/2-text_h/2):enable=gte(main_w,700)*lte(main_w,
 1200)'
 Error configuring filters.

 }}}


 After looking what's wrong with this new syntax, I understand that
 "main_w" value isn't available with the new "enable" option. I think it's
 the same problem with all defined values.

 In my /libavfilter/version.h file I replaced this :
 ''LIBAVFILTER_VERSION_MAJOR < 5'' to ''LIBAVFILTER_VERSION_MAJOR < 6
 ''
 ... and rebuild my FFMPEG.
 Now "draw" option is coming back in my binary.

 While "enable" option isn't its equivalent, the deprecated "draw" option
 musn't be disabled.

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


More information about the FFmpeg-trac mailing list