2

I want to trim a video then convert a video using FFMPEG and place a watermark with multiple texts on it. I have commands for trimming :

ffmpeg -i 1.mp4 -ss 00:00:03 -t 00:03:08 -async 1 -c copy output1.mp4

and for watermark with text placing

ffmpeg -i 1.mp4 -i watermark_small.png -filter_complex "[0:v][1:v]overlay=10:10, drawtext=enable='between(t,0,12)':fontfile=font.ttf:text='Some text' : fontcolor=black: fontsize=18: box=1: boxcolor=yellow@0.5:boxborderw=5: x=(w-text_w)/1.15:y=30, drawtext=enable='between(t,14,22)':fontfile=font.ttf:text='Next text' : fontcolor=black: fontsize=18: box=1: boxcolor=yellow@0.5:boxborderw=5: x=(w-text_w)/1.15:y=30" -codec:v libx264 -preset ultrafast output1.mp4

Can someone help me to combine them together?

  • The answer is to use the `-ss` and `-t` options in your second command and skip the first command, but your durations don't make sense. You want to combine commands, but you used `-ss` and `-t` to make 5 second output. But your second command enables drawtext from 0-12 and from 14-22, but `output1.mp4` input file duration is only 5 seconds. – llogan Nov 20 '16 at 22:14
  • @LordNeckbeard the idea is not about the time but how to combine these two commands in order to create a filter chain – Iura Gaitur Nov 21 '16 at 16:45

1 Answers1

2

Use

ffmpeg -ss 00:00:03 -t 00:00:08 -i 1.mp4 -i watermark_small.png -filter_complex 
  "[0:v][1:v]overlay=10:10, 
   drawtext=enable='between(t,0,12)':fontfile=font.ttf:text='Some text' : fontcolor=black:
   fontsize=18: box=1: boxcolor=yellow@0.5:boxborderw=5: x=(w-text_w)/1.15:y=30,
   drawtext=enable='between(t,14,22)':fontfile=font.ttf:text='Next text':fontcolor=black:
   fontsize=18: box=1: boxcolor=yellow@0.5:boxborderw=5: x=(w-text_w)/1.15:y=30"
-c:v libx264 -preset ultrafast output1.mp4
Gyan
  • 85,394
  • 9
  • 169
  • 201