[FFmpeg-trac] #3253(avfilter:new): drawtext filter: problems with text expansions
FFmpeg
trac at avcodec.org
Sun Dec 29 16:01:31 CET 2013
#3253: drawtext filter: problems with text expansions
----------------------------------+---------------------------------------
Reporter: Krieger | Type: defect
Status: new | Priority: normal
Component: avfilter | Version: unspecified
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
----------------------------------+---------------------------------------
Summary of the bug:
Text expansion seem to be not working.
How to reproduce:
{{{
$ ffmpeg -re -f lavfi -i testsrc -filter:v
'drawtext=text=%{expr:t}:fontfile=/usr/share/fonts/corefonts/verdana.ttf:fontsize=50:fontcolor=red'
-y ~/netdisk/tmp/tmp.ts
ffmpeg version N-59414-g8a0d446 Copyright (c) 2000-2013 the FFmpeg
developers
built on Dec 29 2013 16:17:21 with gcc 4.6.3 (Gentoo 4.6.3 p1.13,
pie-0.5.2)
configuration: --enable-gpl --enable-libx264 --enable-encoder=libx264
--disable-stripping --enable-debug --extra-cflags='-O0 -g -ggdb' --enable-
libopus --enable-libvpx --enable-x11grab --enable-libfreetype --enable-
filter=drawtext
libavutil 52. 59.100 / 52. 59.100
libavcodec 55. 47.100 / 55. 47.100
libavformat 55. 22.100 / 55. 22.100
libavdevice 55. 5.102 / 55. 5.102
libavfilter 4. 0.103 / 4. 0.103
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Input #0, lavfi, from 'testsrc':
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
Output #0, mpegts, to '/home/krieger/netdisk/tmp/tmp.ts':
Metadata:
encoder : Lavf55.22.100
Stream #0:0: Video: mpeg2video, yuv420p, 320x240 [SAR 1:1 DAR 4:3],
q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo -> mpeg2video)
Press [q] to stop, [?] for help
frame= 35 fps= 26 q=2.0 Lsize= 75kB time=00:00:01.36 bitrate=
451.2kbits/s
video:65kB audio:0kB subtitle:0 global headers:0kB muxing overhead
15.131411%
Received signal 2: terminating.
}}}
The desired effect is printing of timestamp in seconds (see t variable in
drawtext doc section). This way we have printed text "t}", which is
nonsense.
If we swap the order of filter params "text" and "fontfile", it fails to
start. Tried both escaping and not escaping semicolon in expansion block.
{{{
$ ffmpeg -re -f lavfi -i testsrc -filter:v
'drawtext=fontfile=/usr/share/fonts/corefonts/verdana.ttf:text=%{e:
t}:fontsize=50:fontcolor=red' -y ~/netdisk/tmp/tmp.ts
ffmpeg version N-59414-g8a0d446 Copyright (c) 2000-2013 the FFmpeg
developers
built on Dec 29 2013 16:17:21 with gcc 4.6.3 (Gentoo 4.6.3 p1.13,
pie-0.5.2)
configuration: --enable-gpl --enable-libx264 --enable-encoder=libx264
--disable-stripping --enable-debug --extra-cflags='-O0 -g -ggdb' --enable-
libopus --enable-libvpx --enable-x11grab --enable-libfreetype --enable-
filter=drawtext
libavutil 52. 59.100 / 52. 59.100
libavcodec 55. 47.100 / 55. 47.100
libavformat 55. 22.100 / 55. 22.100
libavdevice 55. 5.102 / 55. 5.102
libavfilter 4. 0.103 / 4. 0.103
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Input #0, lavfi, from 'testsrc':
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
[Parsed_drawtext_0 @ 0x24cd8a0] Could not load font "t}": cannot open
resource
[AVFilterGraph @ 0x24d47e0] Error initializing filter 'drawtext' with args
'fontfile=/usr/share/fonts/corefonts/verdana.ttf:text=%{e:
t}:fontsize=50:fontcolor=red'
Error opening filters!
[ERR]
16:56:12krieger at zver /usr/local/src/ffmpeg
$ ffmpeg -re -f lavfi -i testsrc -filter:v
'drawtext=fontfile=/usr/share/fonts/corefonts/verdana.ttf:text=%{e\:
t}:fontsize=50:fontcolor=red' -y ~/netdisk/tmp/tmp.ts
ffmpeg version N-59414-g8a0d446 Copyright (c) 2000-2013 the FFmpeg
developers
built on Dec 29 2013 16:17:21 with gcc 4.6.3 (Gentoo 4.6.3 p1.13,
pie-0.5.2)
configuration: --enable-gpl --enable-libx264 --enable-encoder=libx264
--disable-stripping --enable-debug --extra-cflags='-O0 -g -ggdb' --enable-
libopus --enable-libvpx --enable-x11grab --enable-libfreetype --enable-
filter=drawtext
libavutil 52. 59.100 / 52. 59.100
libavcodec 55. 47.100 / 55. 47.100
libavformat 55. 22.100 / 55. 22.100
libavdevice 55. 5.102 / 55. 5.102
libavfilter 4. 0.103 / 4. 0.103
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Input #0, lavfi, from 'testsrc':
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
[Parsed_drawtext_0 @ 0x1dc28a0] Could not load font "t}": cannot open
resource
[AVFilterGraph @ 0x1dc97e0] Error initializing filter 'drawtext' with args
'fontfile=/usr/share/fonts/corefonts/verdana.ttf:text=%{e:
t}:fontsize=50:fontcolor=red'
Error opening filters!
[ERR]
}}}
--
Ticket URL: <https://trac.ffmpeg.org/ticket/3253>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list