Opened 4 years ago

Last modified 4 years ago

#3740 new defect

drawtext drops backslashes

Reported by: Krieger 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:
How to reproduce:
Create files for tests, with contents:
/tmp/tmp0:

testsrc,drawtext=text=TEST\\\\:fontsize=50:fontfile=/usr/share/fonts/corefonts/verdana.ttf:fontcolor=red

/tmp/tmp1:

testsrc,drawtext=text=TEST\\\\TEST:fontsize=50:fontfile=/usr/share/fonts/corefonts/verdana.ttf:fontcolor=red

ffplay -f lavfi -graph_file /tmp/tmp0 -i nullsrc gives correct results - we have a backslash in the end of drawn text , but
ffplay -f lavfi -graph_file /tmp/tmp1 -i nullsrc gives no backslash.

The second variant with adding expansion=none works correctly.

The uncut console output:

ffplay version N-64175-g33ab751 Copyright (c) 2003-2014 the FFmpeg developers
  built on Jun 24 2014 17:05:19 with gcc 4.7.3 (Gentoo 4.7.3-r1 p1.4, pie-0.5.5)
  configuration: --enable-debug --extra-cflags='-O0 -g -ggdb' --enable-pic --disable-stripping --enable-openssl --enable-protocol=file --enable-protocol=pipe --enable-protocol=http --enable-protocol=https --enable-muxer=matroska --enable-muxer=mjpeg --enable-muxer=rtp --enable-muxer=mp4 --enable-demuxer=rtsp --enable-demuxer=matroska --enable-demuxer=mjpeg --enable-decoder=h264 --enable-decoder=mpeg4 --enable-decoder=mjpeg --enable-parser=h264 --enable-parser=mpeg4video --enable-parser=mjpeg --enable-encoder=mjpeg --enable-libfreetype
  libavutil      52. 90.100 / 52. 90.100
  libavcodec     55. 68.100 / 55. 68.100
  libavformat    55. 44.100 / 55. 44.100
  libavdevice    55. 13.101 / 55. 13.101
  libavfilter     4.  9.100 /  4.  9.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
Input #0, lavfi, from 'nullsrc':   0KB vq=    0KB sq=    0B f=0/0   
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
   6.24 M-V:  0.000 fd=   0 aq=    0KB vq= 1350KB sq=    0B f=0/0

Change History (2)

comment:1 Changed 4 years ago by cehoyos

  • Keywords drawtext added

comment:2 Changed 4 years ago by Cigaes

Can you explain why you consider this a bug? You noticed that this is related to expansion: obviously, the backslash is doing its job of preventing the expansion of the next character.

The fact that a trailing backslash is preserved instead of either being dropped or causing an error is an undocumented and unsupported corner case of the expansion code.

You will notice that putting two backslashes in the text option gives the correct result in both cases. Of course, to put two backslashes in the text option, you need to put four backslashes in the drawtext argument string, and therefore eight in the graph description. Still no solution for the escaping madness, but it works reliably and predictably.

Note: See TracTickets for help on using tickets.