Q:

How to add top and bottom frame to a video using ffmpeg and imagemagick

I'm trying to add a top and bottom section to a video like we do for image memes. I'm using ffmpeg and imagemagick but there is no inbuilt option to do this task. 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?

A:

From what I can tell something like this is what you're looking for:

Using pad and drawtext. In this example pad adds 50 pixels to the top and 50 pixels to the bottom, then two drawtext instances place each line.
ffmpeg -i input -filter_complex \
"[0:v]pad=iw:ih+100:0:(oh-ih)/2:color=white, \
 drawtext=text='ONE DOES NOT SIMPLY':fontfile=/path/to/impact.ttf:fontsize=24:x=(w-tw)/2:y=(50-th)/2, \
 drawtext=text='STOP ME FROM FILTERING':fontfile=/path/to/impact.ttf:fontsize=24:x=(w-tw)/2:y=h-25-(th/2)" \
output

