[FFmpeg-user] How to avoid blurred text when using drawtext filter?

pgoldweic pgoldweic at northwestern.edu
Wed Jun 22 23:14:58 CEST 2011


When I run ffmpeg with the drawtext filter, I get the desired result (a title
on top of a movie) in a small size movie, but I get blurred text when I type
the same command using a larger input movie.  What causes this? How can I
change my command to avoid the blurred text? 
For specific details, the command I'm using is:
ffmpeg -i mymovie.mp4 -vcodec libx264 -acodec copy -vf
"drawtext=fontfile=/usr/share/fonts/bitstream-vera/VeraSe.ttf:fontsize=30:x=50:y=50:fontcolor=white:text='this
is a title'" mytitledmovie.mp4

And the complete output from ffmpeg is:
---------------------------------------------------------------------------------
ffmpeg version 0.7-rc1, Copyright (c) 2000-2011 the FFmpeg developers
  built on Jun 14 2011 12:55:59 with gcc 4.1.2 20080704 (Red Hat 4.1.2-50)
  configuration: --enable-libvpx --enable-libfaac --enable-shared
--enable-memalign-hack --enable-gpl --enable-libtheora --enable-libmp3lame
--enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree
--enable-postproc --enable-avfilter --enable-swscale --enable-pthreads
--enable-libfreetype --arch=x86_64
  libavutil    50. 40. 1 / 50. 40. 1
  libavcodec   52.120. 0 / 52.120. 0
  libavformat  52.108. 0 / 52.108. 0
  libavdevice  52.  4. 0 / 52.  4. 0
  libavfilter   1. 77. 0 /  1. 77. 0
  libswscale    0. 13. 0 /  0. 13. 0
  libpostproc  51.  2. 0 / 51.  2. 0

Seems stream 0 codec frame rate differs from container frame rate: 2997.00
(2997/1) -> 29.97 (2997/100)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'openEmptyTitle.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    creation_time   : 1970-01-01 00:00:00
    encoder         : Lavf52.108.0
  Duration: 00:00:06.25, start: 0.000000, bitrate: 1053 kb/s
    Stream #0.0(eng): Video: mpeg4, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9],
1171 kb/s, 29.97 fps, 29.97 tbr, 2997 tbn, 2997 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
    Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16, 3 kb/s
    Metadata:
      creation_time   : 1970-01-01 00:00:00
File 'mytitledmovie.mp4' already exists. Overwrite ? [y/N] y
[buffer @ 0x1351b030] w:1920 h:1080 pixfmt:yuv420p
[libx264 @ 0x135199e0] Default settings detected, using medium profile
[libx264 @ 0x135199e0] using SAR=1/1
[libx264 @ 0x135199e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
[libx264 @ 0x135199e0] profile High, level 4.0
[libx264 @ 0x135199e0] 264 - core 115 r1995 c1e60b9 - H.264/MPEG-4 AVC codec
- Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1
ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11
fast_pskip=1 chroma_qp_offset=-2 threads=1 sliced_threads=0 nr=0 decimate=1
interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2
b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250
keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1
bitrate=200 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40
aq=1:1.00
Output #0, mp4, to 'mytitledmovie.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    creation_time   : 1970-01-01 00:00:00
    encoder         : Lavf52.108.0
    Stream #0.0(eng): Video: libx264, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9],
q=2-31, 200 kb/s, 2997 tbn, 29.97 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
    Stream #0.1(eng): Audio: libfaac, 48000 Hz, stereo, 3 kb/s
    Metadata:
      creation_time   : 1970-01-01 00:00:00
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Press [q] to stop encoding
frame=  167 fps=  9 q=31.0 Lsize=      31kB time=5.51 bitrate=  45.7kbits/s    
video:22kB audio:3kB global headers:0kB muxing overhead 24.411660%
frame I:1     Avg QP:48.23  size:   628
[libx264 @ 0x135199e0] frame P:52    Avg QP:44.40  size:   249
[libx264 @ 0x135199e0] frame B:114   Avg QP:50.55  size:    73
[libx264 @ 0x135199e0] consecutive B-frames:  7.8%  3.6%  0.0% 88.6%
[libx264 @ 0x135199e0] mb I  I16..4: 83.7% 16.0%  0.2%
[libx264 @ 0x135199e0] mb P  I16..4:  3.9% 12.3%  0.0%  P16..4:  1.1%  0.1% 
0.0%  0.0%  0.0%    skip:82.7%
[libx264 @ 0x135199e0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.1%  0.0% 
0.0%  direct: 0.0%  skip:99.9%  L0:25.6% L1:73.9% BI: 0.5%
[libx264 @ 0x135199e0] final ratefactor: 30.83
[libx264 @ 0x135199e0] 8x8 transform intra:69.6% inter:17.7%
[libx264 @ 0x135199e0] coded y,uvDC,uvAC intra: 0.0% 0.0% 0.0% inter: 0.0%
0.0% 0.0%
[libx264 @ 0x135199e0] i16 v,h,dc,p: 99%  0%  1%  0%
[libx264 @ 0x135199e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  0%  1% 98%  0%  0% 
0%  0%  0%  0%
[libx264 @ 0x135199e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 22% 32%  2%  3% 
5%  2%  0%  1%
[libx264 @ 0x135199e0] i8c dc,h,v,p: 98%  0%  2%  0%
[libx264 @ 0x135199e0] Weighted P-Frames: Y:21.2% UV:11.5%
[libx264 @ 0x135199e0] ref P L0: 89.2%  0.5%  9.7%  0.4%  0.1%
[libx264 @ 0x135199e0] ref B L0: 37.7% 62.3%
[libx264 @ 0x135199e0] ref B L1: 78.0% 22.0%
[libx264 @ 0x135199e0] kb/s:31.41
-----------------------------------------------------------------------------------

Any suggestions will be appreciated. Thanks.

--
View this message in context: http://ffmpeg-users.933282.n4.nabble.com/How-to-avoid-blurred-text-when-using-drawtext-filter-tp3618274p3618274.html
Sent from the FFmpeg-users mailing list archive at Nabble.com.


More information about the ffmpeg-user mailing list