Opened 10 years ago

Closed 13 months ago

#3740 closed defect (invalid)

drawtext drops backslashes

Reported by: Andrey Utkin 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 (3)

comment:1 by Carl Eugen Hoyos, 10 years ago

Keywords: drawtext added

comment:2 by Cigaes, 10 years ago

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.

comment:3 by Elon Musk, 13 months ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.