链接绘制文本以覆盖FFMPEG

时间:2018-07-14 07:19:35

标签: ffmpeg

我正在尝试使用绘图文本向视频中添加一些文本。也可以将fontcolor用作白色吗?

这是我正在尝试的命令

ffmpeg -i test.mp4 -i Watermark.png -filter_complex "[0:v][1:v] overlay=0:0:enable='between(t,5,30)'[v]; [0]volume=0:enable='between(t,5,30)'[a];drawtext=fontsize=50:fontfile=FreeSerif.ttf:text='This screen is redacted':x=(w-text_w)/2:y=(h-text_h)/2" -map "[v]" -map "[a]" -preset ultrafast output.mp4

我明白了-在过滤器Parsed_drawtext_2上找不到未标记输入板0的匹配流

使用以下答案,此视频失败。

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'austin.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2018-07-14T04:40:00.000000Z
    location        : -34.8857+138.5805/
    location-eng    : -34.8857+138.5805/
    com.android.version: 8.1.0
    com.android.capture.fps: 30.000000
  Duration: 00:01:12.00, start: 0.000000, bitrate: 48200 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, smpte170m), 3840x2160, 48060 kb/s, SAR 1:1 DAR 16:9, 30 fps, 30 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2018-07-14T04:40:00.000000Z
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 96 kb/s (default)
    Metadata:
      creation_time   : 2018-07-14T04:40:00.000000Z
      handler_name    : SoundHandle

我不断收到此错误:

x264 [错误]:大小为22688384的malloc失败我= 00:00:01.00比特率= 0.4kbits / s

speed=   1x
Video encoding failed
[aac @ 000002727e589f00] Qavg: 4246.095
[aac @ 000002727e589f00] 2 frames left in the queue on closing
Conversion failed!

1 个答案:

答案 0 :(得分:2)

使用

ffmpeg -i test.mp4 -i Watermark.png -filter_complex "[0:v][1:v] overlay=0:0:enable='between(t,5,30)', drawtext=fontfile=FreeSerif.ttf:fontcolor=white:fontsize=50:text='This screen is redacted':x=(w-text_w)/2:y=(h-text_h)/2[v];[0]volume=0:enable='between(t,5,30)'[a]" -map "[v]" -map "[a]" -preset ultrafast output.mp4