[FFmpeg-user] drawtext 4:3 vs 16:9

naser sonbaty naser.sonbaty at gmail.com
Sat May 14 22:52:29 CEST 2016


Hi,

I need help with filter_complex and drawtext.
drawtext on aspect 4:3 are correct but drawtext on aspect 16:9 are
stretched.

thx for help ...

ffmpeg -i C:\ffmpeg\test-4.3.mp4 -filter_complex
"drawtext=fontfile=/Windows/Fonts/arial.ttf:text='0123456789':fontsize=20:fontcolor=white:x=10:y=10"
-aspect 4/3 -map 0 -map -0:d -vcodec libx264 -acodec aac -y
C:\ffmpeg\test-4.3-text.mp4
ffmpeg version N-79947-gcd244fa Copyright (c) 2000-2016 the FFmpeg
developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme
--enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-libopus --enable-librtmp
--enable-libschroedinger --enable-libsnappy --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg
--enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 24.100 / 55. 24.100
  libavcodec     57. 41.102 / 57. 41.102
  libavformat    57. 36.100 / 57. 36.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 45.100 /  6. 45.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\ffmpeg\test-4.3.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.36.100
  Duration: 00:01:00.02, start: 0.000000, bitrate: 1324 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
720x576 [SAR 16:15 DAR 4:3], 1190 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 4.0,
fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[libx264 @ 000000000255ac60] using SAR=16/15
[libx264 @ 000000000255ac60] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2
[libx264 @ 000000000255ac60] profile High, level 3.0
[libx264 @ 000000000255ac60] 264 - core 148 r2694 3b70645 - H.264/MPEG-4
AVC codec - Copyleft 2003-2016 - 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=6
lookahead_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=crf mbtree=1 crf=23.0
qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[mp4 @ 0000000002556e20] Using AVStream.codec to pass codec parameters to
muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, mp4, to 'C:\ffmpeg\test-4.3-text.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.36.100
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 720x576
[SAR 16:15 DAR 4:3], q=2-31, 25 fps, 12800 tbn (default)
    Metadata:
      encoder         : Lavc57.41.102 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz,
4.0, fltp, 266 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc57.41.102 aac
Stream mapping:
  Stream #0:0 (h264) -> drawtext (graph 0)
  drawtext (graph 0) -> Stream #0:0 (libx264)
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame= 1500 fps= 15 q=-1.0 Lsize=   10495kB time=00:01:00.01
bitrate=1432.7kbits/s speed=0.587x
video:8495kB audio:1955kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.439394%


ffmpeg -i C:\ffmpeg\test-16.9.mp4 -filter_complex
"drawtext=fontfile=/Windows/Fonts/arial.ttf:text='0123456789':fontsize=20:fontcolor=white:x=10:y=10"
-aspect 16/9 -map 0 -map -0:d -vcodec libx264 -acodec aac -y
C:\ffmpeg\test-16.9-text.mp4
ffmpeg version N-79947-gcd244fa Copyright (c) 2000-2016 the FFmpeg
developers
  built with gcc 5.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme
--enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-libopus --enable-librtmp
--enable-libschroedinger --enable-libsnappy --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis
--enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg
--enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 24.100 / 55. 24.100
  libavcodec     57. 41.102 / 57. 41.102
  libavformat    57. 36.100 / 57. 36.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 45.100 /  6. 45.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\ffmpeg\test-16.9.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.36.100
  Duration: 00:01:00.02, start: 0.000000, bitrate: 1412 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p,
720x576 [SAR 64:45 DAR 16:9], 1279 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      timecode        : 00:00:00:00
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74)
    Metadata:
      handler_name    : TimeCodeHandler
      timecode        : 00:00:00:00
[libx264 @ 000000000289f8c0] using SAR=64/45
[libx264 @ 000000000289f8c0] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2
[libx264 @ 000000000289f8c0] profile High, level 3.0
[libx264 @ 000000000289f8c0] 264 - core 148 r2694 3b70645 - H.264/MPEG-4
AVC codec - Copyleft 2003-2016 - 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=6
lookahead_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=crf mbtree=1 crf=23.0
qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[mp4 @ 000000000289e0e0] Using AVStream.codec to pass codec parameters to
muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
Output #0, mp4, to 'C:\ffmpeg\test-16.9-text.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.36.100
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 720x576
[SAR 64:45 DAR 16:9], q=2-31, 25 fps, 12800 tbn (default)
    Metadata:
      encoder         : Lavc57.41.102 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz,
stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc57.41.102 aac
Stream mapping:
  Stream #0:0 (h264) -> drawtext (graph 0)
  drawtext (graph 0) -> Stream #0:0 (libx264)
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame= 1500 fps= 17 q=-1.0 Lsize=    6787kB time=00:01:00.01 bitrate=
926.5kbits/s speed=0.686x
video:5809kB audio:932kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.677075%


More information about the ffmpeg-user mailing list