2

I'm trying to add a top section to a video like we do for image memes. I'm using drawtext option for that but the text is wrapped in output video.

Let's say I have a video and I need to add the caption like this to the whole video. How can i achieve this?

Expected output Expected video output

Resulted outputResulted output

I use below command for above result

ffmpeg -ss 20 -i D:\21-03-2018\15271618235b06a3df9d5cb.mp4 -filter_complex "[0:v]pad=iw:ih+50:0:50:color=white, drawtext=text='Meme Top Text will go here but it\\\\\'s a long text with multi line option. Line 1 text \n line 2 text \n line 3 text':fix_bounds=true:fontfile=Arial.ttf:fontsize=30:fontcolor=black:x=(w-tw)/2:y=(50-th)/2" -vframes 1 D:\21-03-2018\output.jpg

Praveen Tamil
  • 1,076
  • 11
  • 22
  • 1
    Line wrap isn't implemented. Supply text via text file. See drawtext [docs](https://ffmpeg.org/ffmpeg-filters.html#drawtext-1). – Gyan Jun 25 '18 at 08:03
  • Is there any way to specify line-height of drawtext and dynamic padding for video based on drawtext result? – Praveen Tamil Jun 25 '18 at 08:31
  • Not implemented. You'll have to use multiple drawtext or use subtitles filter with ASS subtitles. – Gyan Jun 25 '18 at 08:55
  • @PraveenTamil Related: [How to add top and bottom frame to a video using ffmpeg and imagemagick](https://stackoverflow.com/questions/33255582/how-to-add-top-and-bottom-frame-to-a-video-using-ffmpeg-and-imagemagick/33287276) – llogan Jun 25 '18 at 18:57

0 Answers0