Payal Pipalva
Payal Pipalva

Reputation: 11

Can i add solid background with center text in video as ending screen using ffmpeg?

I would like to create a video consisting of some text. The background should just be some color, I have already one video, In that i want to add solid background with text as just ending screen, but cant find anywhere how this could be done without a photo, just using text to create such video.

Can you help me ? Thanks in advance

Upvotes: 0

Views: 395

Answers (1)

llogan
llogan

Reputation: 134093

Use:

  • color filter to make the colored background.
  • scale2ref filter to automatically match the size of the main video.
  • drawtext filter (or subtitles filter) to make text.
  • anullsrc filter to generate silent audio for the ending screen which is required to concatenate to the main stream if it also contains audio.
  • concat filter to concatenate.

Example:

ffmpeg -i input -t 5 -f lavfi -i anullsrc -filter_complex "color=duration=5:color=blue[bg];[bg][0]scale2ref[bg2][main];[bg2]setsar=1,drawtext=text='Ending':fontsize=20:x=(w-text_w)/2:y=(h-text_h)/2[text];[main][0:a][text][1]concat=n=2:v=1:a=1[v][a]" -map "[v]" -map "[a]" output.mp4

Upvotes: 2

Related Questions