[FFmpeg-user] correctly escaping text in drawtext
Tracey Jaquith
tracey at archive.org
Fri Mar 22 19:56:44 CET 2013
here's an example of 3+ levels deep of quoting/escaping for a draw text overlay…
ffmpeg -y -f mpegts -i input.ts -vf "scale=360:240,drawtext=fontcolor=red:box=1:boxcolor=0x00000000 at 0.7:fontsize=14:fontfile=/usr/share/fonts/truetype/freefont/FreeSans.ttf:expansion=normal:timecode=11\\\:30\\\:00.00:r=29.97:text=' | A Very Nice Show (PDT) '" pro.mp4
-tracey
On Mar 22, 2013, at 11:09 AM, Alex Vasilenko <aa.vasilenko at gmail.com> wrote:
> On Thursday, March 21, 2013 at 22:03 , Alex Vasilenko wrote:
>> Hello,
>>
>> According to documentation %{}:, should be escaped with slash. But when I escape % the text is not added. There's error message saying "Stray % near ')'". But what does it mean? Command and output:
>>
>> $ /usr/bin/ffmpeg -y -i /home/www/255871.mov -af 'aresample=async=1:min_hard_comp=0.100000' -vf 'scale=480:trunc(ow/a/2)*2,transpose=1 [in];movie=watermarks/text-box440.mov,scale=320:55 [bg];[in][bg] overlay=x=20:y=main_h-80,drawtext=fontsize=20:fix_bounds=1:fontfile=Helvetica\\:Style=bold:fontcolor=0xe6b300:text=small kitten \%\):x=30:y=h-80+ascent/2:draw=gte(t\,0)\;lt(t\,5) [out]' -pix_fmt yuv420p -r 24.39 -map_metadata -1 -movflags +faststart -f mp4 -vcodec libx264 -b:v 800k -maxrate 1100k -bufsize 2M -bt 256k -profile:vbaseline -acodec libfdk_aac -ab 64k -ar 44100 -ac 1 /tmp/kitten.mp4
>> ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers
>> built on Mar 15 2013 18:40:14 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
>> configuration: --enable-gpl --enable-libmp3lame --enable-libvo-aacenc --enable-libx264 --enable-version3 --enable-pthreads --enable-libfaac --enable-nonfree --enable-libfdk_a
>> ac --enable-fontconfig --enable-libfreetype
>> libavutil 52. 18.100 / 52. 18.100
>> libavcodec 54. 92.100 / 54. 92.100
>> libavformat 54. 63.104 / 54. 63.104
>> libavdevice 54. 3.103 / 54. 3.103
>> libavfilter 3. 42.103 / 3. 42.103
>> libswscale 2. 2.100 / 2. 2.100
>> libswresample 0. 17.102 / 0. 17.102
>> libpostproc 52. 2.100 / 52. 2.100
>> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/www/255871.mov':
>> Metadata:
>> major_brand : qt
>> minor_version : 0
>> compatible_brands: qt
>> creation_time : 2012-07-17 07:42:35
>> model : iPhone 3GS
>> model-rus : iPhone 3GS
>> encoder : 4.2.1
>> encoder-rus : 4.2.1
>> date : 2012-07-17T10:42:35+0300
>> date-rus : 2012-07-17T10:42:35+0300
>> make : Apple
>> make-rus : Apple
>> Duration: 00:00:09.38, start: 0.000000, bitrate: 790 kb/s
>> Stream #0:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 480x360, 720 kb/s, 29.97 fps, 29.97 tbr, 600 tbn, 1200 tbc
>> Metadata:
>> rotate : 90
>> creation_time : 2012-07-17 07:42:35
>> handler_name : Core Media Data Handler
>> Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 63 kb/s
>> Metadata:
>> creation_time : 2012-07-17 07:42:35
>> handler_name : Core Media Data Handler
>> [Parsed_drawtext_5 @ 0x2ae9b00] Using "/usr/share/fonts/default/Type1/n019003l.pfb"
>> [libx264 @ 0x2ae7d40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
>> [libx264 @ 0x2ae7d40] profile Constrained Baseline, level 2.1
>> [libx264 @ 0x2ae7d40] 264 - core 130 r2274 c832fe9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=0 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=800 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=1100 vbv_bufsize=2000 nal_hrd=none ip_ratio=1.40 aq=1:1.00
>> Output #0, mp4, to '/tmp/kitten.mp4':
>> Metadata:
>> encoder : Lavf54.63.104
>> Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 360x480, q=-1--1, 800 kb/s, 19512 tbn, 24.39 tbc
>> Stream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, mono, s16, 64 kb/s
>> Stream mapping:
>> Stream #0:0 -> #0:0 (h264 -> libx264)
>> Stream #0:1 -> #0:1 (aac -> libfdk_aac)
>> Press [q] to stop, [?] for help
>> [Parsed_drawtext_5 @ 0x2ae9b00] Stray % near ')'
>> Last message repeated 201 times
>> Stray % near ')'0.0 q=27.0 size= 480kB time=00:00:07.96 bitrate= 493.4kbits/s dup=0 drop=35
>> [Parsed_drawtext_5 @ 0x2ae9b00] Stray % near ')'
>> Last message repeated 77 times
>> Starting second pass: moving header on top of the file
>> frame= 231 fps=0.0 q=-1.0 Lsize= 1002kB time=00:00:09.47 bitrate= 866.6kbits/s dup=0 drop=50
>> video:921kB audio:74kB subtitle:0 global headers:0kB muxing overhead 0.680957%
>> [libx264 @ 0x2ae7d40] frame I:1 Avg QP:24.43 size: 13264
>> [libx264 @ 0x2ae7d40] frame P:230 Avg QP:23.72 size: 4041
>> [libx264 @ 0x2ae7d40] mb I I16..4: 24.8% 0.0% 75.2%
>> [libx264 @ 0x2ae7d40] mb P I16..4: 2.3% 0.0% 4.8% P16..4: 34.4% 28.8% 9.4% 0.0% 0.0% skip:20.3%
>> [libx264 @ 0x2ae7d40] coded y,uvDC,uvAC intra: 62.5% 54.2% 4.4% inter: 19.6% 20.3% 0.1%
>> [libx264 @ 0x2ae7d40] i16 v,h,dc,p: 36% 29% 19% 16%
>> [libx264 @ 0x2ae7d40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 21% 20% 6% 8% 7% 7% 6% 6%
>> [libx264 @ 0x2ae7d40] i8c dc,h,v,p: 65% 15% 17% 3%
>> [libx264 @ 0x2ae7d40] ref P L0: 93.4% 4.3% 2.3%
>> [libx264 @ 0x2ae7d40] kb/s:796.32
>>
>>
>> --
>> Alex Vasilenko
>>
>
> Can anyone help? with it
>
> Thanks,
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
More information about the ffmpeg-user
mailing list