alan samuel
alan samuel

Reputation: 425

Chaining drawtext to overlay in FFMPEG

I am trying to add some text to a video using draw text. Is it also possible to use fontcolor to white?

Here is my command I am trying

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

I get - Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_drawtext_2

With the below answer it is failing for this video.

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

I keep getting this error:

x264 [error]: malloc of size 22688384 failedme=00:00:01.00 bitrate= 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!

Upvotes: 1

Views: 957

Answers (1)

Gyan
Gyan

Reputation: 93058

Use

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

Upvotes: 2

Related Questions