Last active
January 27, 2019 19:01
-
-
Save crashGoBoom/1af67f7a2fc06e3d438dfeb9e0db3075 to your computer and use it in GitHub Desktop.
Create video from text
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This will create a 5 second long mp4 file using the provided font, text and image with a fade in and out effect. | |
_dur=5 | |
_framerate=30 | |
_fontfile='/tmp/somefont.ttf' | |
_fontsize=30 | |
_fontcolor='white' | |
_text='Sample Bumper Video' | |
_background_color='black' | |
_drawtext="fontfile=${_fontfile}:fontsize=${_fontsize}" | |
_fade="fade=in:0:25,fade=out:50:60" | |
_logo="logo.png" | |
ffmpeg -f lavfi \ | |
-i color=c="${_background_color}":s=1280x720:d="${_dur}":r="${_framerate}" \ | |
-i ${_logo} \ | |
-filter_complex \ | |
"[0] drawtext=${_drawtext}:fontcolor=${_fontcolor}:x=(w-text_w)/2:y=(h-text_h)/1.1:text='${_text}', ${_fade} [b]; [b] overlay=(W-w)/2:(H-h)/2, ${_fade}" \ | |
output.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment