没有这样的过滤器:'drawtext'

时间:2017-12-28 11:42:35

标签: video ffmpeg

我的主要目标是收集用户输入并将其转换为黑色背景的视频,然后输入文本将从左向右移动,同时视频在后台播放音频。

目前我被建议使用“drawtext”,但我还没有找到它。

我的命令:

ffmpeg -i test.mp4 -vf "drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSerif-Bold.ttf:textfile=text.txt:reload=1:y=h-line_h-10:x=(W/tw)*n" textover7.mpg -report
ffmpeg version git-2017-12-28-be4dfbf Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-18)
  configuration: --prefix=/usr/local/ffmpeg --extra-cflags=-I/usr/local/ffmpeg/include --extra-ldflags=-L/usr/local/ffmpeg/lib --bindir=/usr/local/bin --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libx264 --enable-libtheora --enable-filter=drawtext
  libavutil      56.  7.100 / 56.  7.100
  libavcodec     58.  9.100 / 58.  9.100
  libavformat    58.  3.100 / 58.  3.100
  libavdevice    58.  0.100 / 58.  0.100
  libavfilter     7.  8.100 /  7.  8.100
  libswscale      5.  0.101 /  5.  0.101
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2014-01-19T03:12:30.000000Z
  Duration: 00:07:15.00, start: 0.000000, bitrate: 201 kb/s
    Stream #0:0(und), 8, 1/30: Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360, 103 kb/s, 15 fps, 15 tbr, 30 tbn, 30 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und), 1, 1/44100: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s (default)
    Metadata:
      creation_time   : 2014-01-19T03:12:31.000000Z
      handler_name    : IsoMedia File Produced by Google, 5-11-2011
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> mpeg1video (native))
  Stream #0:1 -> #0:1 (aac (native) -> mp2 (native))
Press [q] to stop, [?] for help
[AVFilterGraph @ 0x466e4c0] No such filter: 'drawtext'
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
Conversion failed!

2 个答案:

答案 0 :(得分:6)

如果您的ffmpeg编译时没有libfreetype,则会发生drawtext错误。

适用于Mac OS的解决方案:

# If ffmpeg is already installed, you need to uninstall it.
brew uninstall --ignore-dependencies ffmpeg

# you may very well want to specify other options
brew install ffmpeg --with-freetype

答案 1 :(得分:3)

您的ffmpeg不支持drawtext filter。它缺少此过滤器所需的配置选项--enable-libfreetype

compile ffmpeg使用此选项,或只是download an already compiled ffmpeg build。当然,您必须确保您的脚本正在执行新的ffmpeg